From fced4cf12fc303540066b460fa850eea634cd053 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Tue, 9 Mar 2021 22:18:08 +0000 Subject: [PATCH] Add coc-{clangd,go,json,yaml} modules --- coc/commands | 1 + .../node_modules/coc-clangd/LICENSE | 219 + .../node_modules/coc-clangd/README.md | 70 + .../node_modules/coc-clangd/esbuild.js | 33 + .../node_modules/coc-clangd/lib/index.js | 26957 ++++++++ .../node_modules/coc-clangd/package.json | 166 + .../node_modules/coc-go/.editorconfig | 12 + .../node_modules/coc-go/.eslintignore | 2 + coc/extensions/node_modules/coc-go/.eslintrc | 17 + .../coc-go/.github/workflows/main.yml | 19 + .../.github/workflows/update-settings.yml | 32 + .../coc-go/.vim/coc-settings.json | 11 + coc/extensions/node_modules/coc-go/LICENSE | 21 + coc/extensions/node_modules/coc-go/README.md | 185 + .../node_modules/coc-go/debug/Dockerfile | 20 + .../node_modules/coc-go/debug/init.vim | 196 + .../node_modules/coc-go/lib/binaries.js | 16 + .../node_modules/coc-go/lib/commands.js | 104 + .../node_modules/coc-go/lib/editor.js | 13 + .../node_modules/coc-go/lib/extension.js | 110 + .../node_modules/coc-go/lib/utils/checktag.js | 22 + .../node_modules/coc-go/lib/utils/config.js | 27 + .../node_modules/coc-go/lib/utils/fs.js | 15 + .../node_modules/coc-go/lib/utils/fs.test.js | 29 + .../node_modules/coc-go/lib/utils/impl.js | 43 + .../coc-go/lib/utils/modify-tags.js | 113 + .../coc-go/lib/utils/playground.js | 22 + .../node_modules/coc-go/lib/utils/tests.js | 85 + .../coc-go/lib/utils/tests.test.js | 21 + .../node_modules/coc-go/lib/utils/tools.js | 121 + .../node_modules/coc-go/lib/utils/versions.js | 33 + .../coc-go/lib/utils/versions.test.js | 58 + .../coc-go/node_modules/.bin/node-which | 1 + .../coc-go/node_modules/.package-lock.json | 50 + .../coc-go/node_modules/isexe/.npmignore | 2 + .../coc-go/node_modules/isexe/LICENSE | 15 + .../coc-go/node_modules/isexe/README.md | 51 + .../coc-go/node_modules/isexe/index.js | 57 + .../coc-go/node_modules/isexe/mode.js | 41 + .../coc-go/node_modules/isexe/package.json | 31 + .../coc-go/node_modules/isexe/test/basic.js | 221 + .../coc-go/node_modules/isexe/windows.js | 42 + .../node_modules/node-fetch/CHANGELOG.md | 272 + .../coc-go/node_modules/node-fetch/LICENSE.md | 22 + .../coc-go/node_modules/node-fetch/README.md | 590 + .../coc-go/node_modules/node-fetch/browser.js | 25 + .../node_modules/node-fetch/lib/index.es.js | 1640 + .../node_modules/node-fetch/lib/index.js | 1649 + .../node_modules/node-fetch/lib/index.mjs | 1638 + .../node_modules/node-fetch/package.json | 66 + .../node_modules/tslib/CopyrightNotice.txt | 15 + .../coc-go/node_modules/tslib/LICENSE.txt | 12 + .../coc-go/node_modules/tslib/README.md | 154 + .../node_modules/tslib/modules/index.js | 53 + .../node_modules/tslib/modules/package.json | 3 + .../coc-go/node_modules/tslib/package.json | 37 + .../coc-go/node_modules/tslib/tslib.d.ts | 40 + .../coc-go/node_modules/tslib/tslib.es6.html | 1 + .../coc-go/node_modules/tslib/tslib.es6.js | 237 + .../coc-go/node_modules/tslib/tslib.html | 1 + .../coc-go/node_modules/tslib/tslib.js | 304 + .../.eslintignore | 1 + .../License.txt | 11 + .../README.md | 18 + .../lib/esm/main.d.ts | 180 + .../lib/esm/main.js | 269 + .../lib/tsconfig.esm.tsbuildInfo | 403 + .../lib/umd/main.d.ts | 180 + .../lib/umd/main.js | 280 + .../package.json | 28 + .../tsconfig.esm.json | 18 + .../coc-go/node_modules/vscode-uri/LICENSE.md | 9 + .../coc-go/node_modules/vscode-uri/README.md | 67 + .../node_modules/vscode-uri/lib/esm/index.js | 2 + .../vscode-uri/lib/esm/index.js.map | 1 + .../vscode-uri/lib/umd/charCode.d.ts | 415 + .../vscode-uri/lib/umd/index.d.ts | 3 + .../node_modules/vscode-uri/lib/umd/index.js | 2 + .../vscode-uri/lib/umd/index.js.map | 1 + .../vscode-uri/lib/umd/platform.d.ts | 1 + .../node_modules/vscode-uri/lib/umd/uri.d.ts | 145 + .../vscode-uri/lib/umd/utils.d.ts | 58 + .../node_modules/vscode-uri/package.json | 37 + .../coc-go/node_modules/which/CHANGELOG.md | 166 + .../coc-go/node_modules/which/LICENSE | 15 + .../coc-go/node_modules/which/README.md | 54 + .../coc-go/node_modules/which/bin/node-which | 52 + .../coc-go/node_modules/which/package.json | 43 + .../coc-go/node_modules/which/which.js | 125 + .../node_modules/coc-go/package-lock.json | 4365 ++ .../node_modules/coc-go/package.json | 733 + .../node_modules/coc-go/snippets/go.json | 447 + .../node_modules/coc-go/snippets/gomod.json | 37 + .../node_modules/coc-json/Readme.md | 65 + .../node_modules/coc-json/esbuild.js | 50 + .../node_modules/coc-json/lib/index.js | 34 + .../node_modules/coc-json/lib/server.js | 87 + .../node_modules/coc-json/package.json | 119 + coc/extensions/node_modules/coc-json/sync.sh | 6 + .../node_modules/coc-yaml/.github/FUNDING.yml | 4 + .../node_modules/coc-yaml/Readme.md | 172 + .../node_modules/coc-yaml/esbuild.js | 18 + .../node_modules/coc-yaml/lib/index.js | 247 + .../coc-yaml/node_modules/.bin/esparse | 1 + .../coc-yaml/node_modules/.bin/esvalidate | 1 + .../.bin/installServerIntoExtension | 1 + .../coc-yaml/node_modules/.bin/js-yaml | 1 + .../coc-yaml/node_modules/.bin/prettier | 1 + .../node_modules/.bin/yaml-language-server | 1 + .../coc-yaml/node_modules/.package-lock.json | 249 + .../node_modules/agent-base/.travis.yml | 24 + .../node_modules/agent-base/History.md | 113 + .../node_modules/agent-base/README.md | 145 + .../node_modules/agent-base/index.d.ts | 43 + .../coc-yaml/node_modules/agent-base/index.js | 170 + .../node_modules/agent-base/package.json | 37 + .../node_modules/agent-base/patch-core.js | 51 + .../agent-base/test/ssl-cert-snakeoil.key | 15 + .../agent-base/test/ssl-cert-snakeoil.pem | 12 + .../node_modules/agent-base/test/test.js | 728 + .../node_modules/argparse/CHANGELOG.md | 185 + .../coc-yaml/node_modules/argparse/LICENSE | 21 + .../coc-yaml/node_modules/argparse/README.md | 257 + .../coc-yaml/node_modules/argparse/index.js | 3 + .../node_modules/argparse/lib/action.js | 146 + .../argparse/lib/action/append.js | 53 + .../argparse/lib/action/append/constant.js | 47 + .../node_modules/argparse/lib/action/count.js | 40 + .../node_modules/argparse/lib/action/help.js | 47 + .../node_modules/argparse/lib/action/store.js | 50 + .../argparse/lib/action/store/constant.js | 43 + .../argparse/lib/action/store/false.js | 27 + .../argparse/lib/action/store/true.js | 26 + .../argparse/lib/action/subparsers.js | 149 + .../argparse/lib/action/version.js | 47 + .../argparse/lib/action_container.js | 482 + .../node_modules/argparse/lib/argparse.js | 14 + .../argparse/lib/argument/error.js | 50 + .../argparse/lib/argument/exclusive.js | 54 + .../argparse/lib/argument/group.js | 75 + .../argparse/lib/argument_parser.js | 1161 + .../node_modules/argparse/lib/const.js | 21 + .../argparse/lib/help/added_formatters.js | 87 + .../argparse/lib/help/formatter.js | 795 + .../node_modules/argparse/lib/namespace.js | 76 + .../node_modules/argparse/lib/utils.js | 57 + .../node_modules/argparse/package.json | 34 + .../node_modules/debug/.coveralls.yml | 1 + .../coc-yaml/node_modules/debug/.eslintrc | 14 + .../coc-yaml/node_modules/debug/.npmignore | 9 + .../coc-yaml/node_modules/debug/.travis.yml | 20 + .../coc-yaml/node_modules/debug/CHANGELOG.md | 395 + .../coc-yaml/node_modules/debug/LICENSE | 19 + .../coc-yaml/node_modules/debug/Makefile | 58 + .../coc-yaml/node_modules/debug/README.md | 368 + .../coc-yaml/node_modules/debug/karma.conf.js | 70 + .../coc-yaml/node_modules/debug/node.js | 1 + .../coc-yaml/node_modules/debug/package.json | 43 + .../node_modules/debug/src/browser.js | 195 + .../coc-yaml/node_modules/debug/src/debug.js | 225 + .../coc-yaml/node_modules/debug/src/index.js | 10 + .../coc-yaml/node_modules/debug/src/node.js | 186 + .../node_modules/es6-promise/CHANGELOG.md | 155 + .../coc-yaml/node_modules/es6-promise/LICENSE | 19 + .../node_modules/es6-promise/README.md | 97 + .../coc-yaml/node_modules/es6-promise/auto.js | 4 + .../es6-promise/dist/es6-promise.auto.js | 1176 + .../es6-promise/dist/es6-promise.auto.map | 1 + .../es6-promise/dist/es6-promise.auto.min.js | 1 + .../es6-promise/dist/es6-promise.auto.min.map | 1 + .../es6-promise/dist/es6-promise.js | 1174 + .../es6-promise/dist/es6-promise.map | 1 + .../es6-promise/dist/es6-promise.min.js | 1 + .../es6-promise/dist/es6-promise.min.map | 1 + .../node_modules/es6-promise/es6-promise.d.ts | 85 + .../es6-promise/lib/es6-promise.auto.js | 3 + .../es6-promise/lib/es6-promise.js | 7 + .../es6-promise/lib/es6-promise/-internal.js | 243 + .../es6-promise/lib/es6-promise/asap.js | 119 + .../es6-promise/lib/es6-promise/enumerator.js | 124 + .../es6-promise/lib/es6-promise/polyfill.js | 35 + .../es6-promise/lib/es6-promise/promise.js | 431 + .../lib/es6-promise/promise/all.js | 52 + .../lib/es6-promise/promise/race.js | 84 + .../lib/es6-promise/promise/reject.js | 46 + .../lib/es6-promise/promise/resolve.js | 48 + .../es6-promise/lib/es6-promise/then.js | 32 + .../es6-promise/lib/es6-promise/utils.js | 21 + .../node_modules/es6-promise/package.json | 78 + .../node_modules/es6-promisify/README.md | 89 + .../es6-promisify/dist/promise.js | 73 + .../es6-promisify/dist/promisify.js | 85 + .../node_modules/es6-promisify/package.json | 41 + .../coc-yaml/node_modules/esprima/ChangeLog | 235 + .../coc-yaml/node_modules/esprima/LICENSE.BSD | 21 + .../coc-yaml/node_modules/esprima/README.md | 46 + .../node_modules/esprima/bin/esparse.js | 139 + .../node_modules/esprima/bin/esvalidate.js | 236 + .../node_modules/esprima/dist/esprima.js | 6709 ++ .../node_modules/esprima/package.json | 112 + .../node_modules/http-proxy-agent/.travis.yml | 22 + .../node_modules/http-proxy-agent/History.md | 101 + .../node_modules/http-proxy-agent/README.md | 74 + .../node_modules/http-proxy-agent/index.js | 111 + .../http-proxy-agent/package.json | 35 + .../test/ssl-cert-snakeoil.key | 15 + .../test/ssl-cert-snakeoil.pem | 12 + .../http-proxy-agent/test/test.js | 303 + .../https-proxy-agent/.editorconfig | 37 + .../https-proxy-agent/.eslintrc.js | 86 + .../node_modules/https-proxy-agent/History.md | 124 + .../node_modules/https-proxy-agent/README.md | 137 + .../node_modules/https-proxy-agent/index.d.ts | 22 + .../node_modules/https-proxy-agent/index.js | 241 + .../https-proxy-agent/package.json | 36 + .../node_modules/js-yaml/CHANGELOG.md | 557 + .../coc-yaml/node_modules/js-yaml/LICENSE | 21 + .../coc-yaml/node_modules/js-yaml/README.md | 299 + .../node_modules/js-yaml/bin/js-yaml.js | 132 + .../node_modules/js-yaml/dist/js-yaml.js | 3989 ++ .../node_modules/js-yaml/dist/js-yaml.min.js | 1 + .../coc-yaml/node_modules/js-yaml/index.js | 7 + .../node_modules/js-yaml/lib/js-yaml.js | 39 + .../js-yaml/lib/js-yaml/common.js | 59 + .../js-yaml/lib/js-yaml/dumper.js | 850 + .../js-yaml/lib/js-yaml/exception.js | 43 + .../js-yaml/lib/js-yaml/loader.js | 1644 + .../node_modules/js-yaml/lib/js-yaml/mark.js | 76 + .../js-yaml/lib/js-yaml/schema.js | 108 + .../js-yaml/lib/js-yaml/schema/core.js | 18 + .../lib/js-yaml/schema/default_full.js | 25 + .../lib/js-yaml/schema/default_safe.js | 28 + .../js-yaml/lib/js-yaml/schema/failsafe.js | 17 + .../js-yaml/lib/js-yaml/schema/json.js | 25 + .../node_modules/js-yaml/lib/js-yaml/type.js | 61 + .../js-yaml/lib/js-yaml/type/binary.js | 138 + .../js-yaml/lib/js-yaml/type/bool.js | 35 + .../js-yaml/lib/js-yaml/type/float.js | 116 + .../js-yaml/lib/js-yaml/type/int.js | 173 + .../js-yaml/lib/js-yaml/type/js/function.js | 93 + .../js-yaml/lib/js-yaml/type/js/regexp.js | 60 + .../js-yaml/lib/js-yaml/type/js/undefined.js | 28 + .../js-yaml/lib/js-yaml/type/map.js | 8 + .../js-yaml/lib/js-yaml/type/merge.js | 12 + .../js-yaml/lib/js-yaml/type/null.js | 34 + .../js-yaml/lib/js-yaml/type/omap.js | 44 + .../js-yaml/lib/js-yaml/type/pairs.js | 53 + .../js-yaml/lib/js-yaml/type/seq.js | 8 + .../js-yaml/lib/js-yaml/type/set.js | 29 + .../js-yaml/lib/js-yaml/type/str.js | 8 + .../js-yaml/lib/js-yaml/type/timestamp.js | 88 + .../node_modules/js-yaml/package.json | 49 + .../node_modules/jsonc-parser/.eslintrc.json | 31 + .../node_modules/jsonc-parser/.mocharc.json | 4 + .../node_modules/jsonc-parser/CHANGELOG.md | 56 + .../node_modules/jsonc-parser/LICENSE.md | 21 + .../node_modules/jsonc-parser/README.md | 309 + .../jsonc-parser/lib/esm/impl/edit.js | 186 + .../jsonc-parser/lib/esm/impl/format.js | 194 + .../jsonc-parser/lib/esm/impl/parser.js | 621 + .../jsonc-parser/lib/esm/impl/scanner.js | 363 + .../jsonc-parser/lib/esm/main.d.ts | 312 + .../node_modules/jsonc-parser/lib/esm/main.js | 116 + .../jsonc-parser/lib/umd/impl/edit.js | 202 + .../jsonc-parser/lib/umd/impl/format.js | 208 + .../jsonc-parser/lib/umd/impl/parser.js | 644 + .../jsonc-parser/lib/umd/impl/scanner.js | 376 + .../jsonc-parser/lib/umd/main.d.ts | 312 + .../node_modules/jsonc-parser/lib/umd/main.js | 132 + .../node_modules/jsonc-parser/package.json | 40 + .../coc-yaml/node_modules/ms/index.js | 152 + .../coc-yaml/node_modules/ms/license.md | 21 + .../coc-yaml/node_modules/ms/package.json | 37 + .../coc-yaml/node_modules/ms/readme.md | 51 + .../coc-yaml/node_modules/prettier/LICENSE | 7 + .../coc-yaml/node_modules/prettier/README.md | 111 + .../node_modules/prettier/bin-prettier.js | 54351 ++++++++++++++++ .../coc-yaml/node_modules/prettier/doc.js | 2137 + .../coc-yaml/node_modules/prettier/index.js | 51680 +++++++++++++++ .../node_modules/prettier/package.json | 20 + .../node_modules/prettier/parser-angular.js | 650 + .../node_modules/prettier/parser-babel.js | 1 + .../node_modules/prettier/parser-flow.js | 1 + .../node_modules/prettier/parser-glimmer.js | 1 + .../node_modules/prettier/parser-graphql.js | 1 + .../node_modules/prettier/parser-html.js | 113 + .../node_modules/prettier/parser-markdown.js | 19 + .../node_modules/prettier/parser-postcss.js | 8 + .../prettier/parser-typescript.js | 14 + .../node_modules/prettier/parser-yaml.js | 16 + .../node_modules/prettier/standalone.js | 32923 ++++++++++ .../node_modules/prettier/third-party.js | 12474 ++++ .../request-light/.github/assignment.yml | 4 + .../node_modules/request-light/CHANGELOG.md | 12 + .../node_modules/request-light/LICENSE.md | 21 + .../node_modules/request-light/README.md | 2 + .../request-light/build/post-publish.js | 41 + .../build/remove-sourcemap-refs.js | 32 + .../node_modules/request-light/lib/main.d.ts | 23 + .../node_modules/request-light/lib/main.js | 203 + .../node_modules/request-light/package.json | 34 + .../request-light/thirdpartynotices.txt | 31 + .../node_modules/sprintf-js/.npmignore | 1 + .../coc-yaml/node_modules/sprintf-js/LICENSE | 24 + .../node_modules/sprintf-js/README.md | 88 + .../node_modules/sprintf-js/bower.json | 14 + .../node_modules/sprintf-js/demo/angular.html | 20 + .../sprintf-js/dist/angular-sprintf.min.js | 4 + .../dist/angular-sprintf.min.js.map | 1 + .../sprintf-js/dist/angular-sprintf.min.map | 1 + .../sprintf-js/dist/sprintf.min.js | 4 + .../sprintf-js/dist/sprintf.min.js.map | 1 + .../sprintf-js/dist/sprintf.min.map | 1 + .../node_modules/sprintf-js/gruntfile.js | 36 + .../node_modules/sprintf-js/package.json | 22 + .../sprintf-js/src/angular-sprintf.js | 18 + .../node_modules/sprintf-js/src/sprintf.js | 208 + .../node_modules/sprintf-js/test/test.js | 82 + .../vscode-json-languageservice/CHANGELOG.md | 119 + .../vscode-json-languageservice/LICENSE.md | 21 + .../vscode-json-languageservice/README.md | 65 + .../lib/esm/jsonContributions.d.ts | 17 + .../lib/esm/jsonContributions.js | 1 + .../lib/esm/jsonLanguageService.d.ts | 30 + .../lib/esm/jsonLanguageService.js | 66 + .../lib/esm/jsonLanguageTypes.d.ts | 274 + .../lib/esm/jsonLanguageTypes.js | 45 + .../lib/esm/jsonSchema.d.ts | 70 + .../lib/esm/jsonSchema.js | 1 + .../lib/esm/parser/jsonParser.js | 1209 + .../lib/esm/services/configuration.js | 530 + .../lib/esm/services/jsonCompletion.js | 934 + .../lib/esm/services/jsonDocumentSymbols.js | 278 + .../lib/esm/services/jsonFolding.js | 121 + .../lib/esm/services/jsonHover.js | 112 + .../lib/esm/services/jsonLinks.js | 73 + .../lib/esm/services/jsonSchemaService.js | 525 + .../lib/esm/services/jsonSelectionRanges.js | 61 + .../lib/esm/services/jsonValidation.js | 146 + .../lib/esm/utils/colors.js | 69 + .../lib/esm/utils/json.js | 42 + .../lib/esm/utils/objects.js | 65 + .../lib/esm/utils/strings.js | 44 + .../lib/umd/jsonContributions.d.ts | 17 + .../lib/umd/jsonContributions.js | 12 + .../lib/umd/jsonLanguageService.d.ts | 30 + .../lib/umd/jsonLanguageService.js | 90 + .../lib/umd/jsonLanguageTypes.d.ts | 274 + .../lib/umd/jsonLanguageTypes.js | 81 + .../lib/umd/jsonSchema.d.ts | 70 + .../lib/umd/jsonSchema.js | 12 + .../lib/umd/parser/jsonParser.js | 1228 + .../lib/umd/services/configuration.js | 543 + .../lib/umd/services/jsonCompletion.js | 947 + .../lib/umd/services/jsonDocumentSymbols.js | 291 + .../lib/umd/services/jsonFolding.js | 135 + .../lib/umd/services/jsonHover.js | 125 + .../lib/umd/services/jsonLinks.js | 87 + .../lib/umd/services/jsonSchemaService.js | 538 + .../lib/umd/services/jsonSelectionRanges.js | 75 + .../lib/umd/services/jsonValidation.js | 159 + .../lib/umd/utils/colors.js | 85 + .../lib/umd/utils/json.js | 56 + .../lib/umd/utils/objects.js | 83 + .../lib/umd/utils/strings.js | 61 + .../node_modules/jsonc-parser/CHANGELOG.md | 62 + .../node_modules/jsonc-parser/LICENSE.md | 21 + .../node_modules/jsonc-parser/README.md | 309 + .../jsonc-parser/lib/esm/impl/edit.js | 186 + .../jsonc-parser/lib/esm/impl/format.js | 205 + .../jsonc-parser/lib/esm/impl/parser.js | 621 + .../jsonc-parser/lib/esm/impl/scanner.js | 363 + .../jsonc-parser/lib/esm/main.d.ts | 316 + .../node_modules/jsonc-parser/lib/esm/main.js | 116 + .../jsonc-parser/lib/umd/impl/edit.js | 202 + .../jsonc-parser/lib/umd/impl/format.js | 219 + .../jsonc-parser/lib/umd/impl/parser.js | 644 + .../jsonc-parser/lib/umd/impl/scanner.js | 376 + .../jsonc-parser/lib/umd/main.d.ts | 316 + .../node_modules/jsonc-parser/lib/umd/main.js | 132 + .../node_modules/jsonc-parser/package.json | 40 + .../vscode-languageserver-types/.eslintignore | 1 + .../vscode-languageserver-types/License.txt | 11 + .../vscode-languageserver-types/README.md | 17 + .../lib/esm/main.d.ts | 2077 + .../lib/esm/main.js | 1570 + .../lib/tsconfig.esm.tsbuildInfo | 145 + .../lib/umd/main.d.ts | 2077 + .../lib/umd/main.js | 1582 + .../vscode-languageserver-types/package.json | 28 + .../tsconfig-watch.json | 9 + .../tsconfig.esm.json | 18 + .../node_modules/vscode-nls/License.txt | 17 + .../node_modules/vscode-nls/README.md | 75 + .../node_modules/vscode-nls/browser.d.ts | 6 + .../node_modules/vscode-nls/browser.js | 7 + .../vscode-nls/lib/browser/main.d.ts | 5 + .../vscode-nls/lib/browser/main.d.ts.map | 1 + .../vscode-nls/lib/browser/main.js | 44 + .../vscode-nls/lib/browser/main.js.map | 1 + .../vscode-nls/lib/common/common.d.ts | 70 + .../vscode-nls/lib/common/common.d.ts.map | 1 + .../vscode-nls/lib/common/common.js | 80 + .../vscode-nls/lib/common/common.js.map | 1 + .../vscode-nls/lib/common/ral.d.ts | 11 + .../vscode-nls/lib/common/ral.d.ts.map | 1 + .../node_modules/vscode-nls/lib/common/ral.js | 20 + .../vscode-nls/lib/common/ral.js.map | 1 + .../vscode-nls/lib/node/main.d.ts | 5 + .../vscode-nls/lib/node/main.d.ts.map | 1 + .../node_modules/vscode-nls/lib/node/main.js | 449 + .../vscode-nls/lib/node/main.js.map | 1 + .../node_modules/vscode-nls/node.d.ts | 6 + .../node_modules/vscode-nls/node.js | 7 + .../node_modules/vscode-nls/package.json | 47 + .../vscode-json-languageservice/package.json | 52 + .../node_modules/vscode-jsonrpc/License.txt | 11 + .../node_modules/vscode-jsonrpc/README.md | 64 + .../vscode-jsonrpc/lib/cancellation.d.ts | 27 + .../vscode-jsonrpc/lib/cancellation.js | 81 + .../vscode-jsonrpc/lib/events.d.ts | 47 + .../node_modules/vscode-jsonrpc/lib/events.js | 131 + .../node_modules/vscode-jsonrpc/lib/is.d.ts | 7 + .../node_modules/vscode-jsonrpc/lib/is.js | 34 + .../vscode-jsonrpc/lib/linkedMap.d.ts | 29 + .../vscode-jsonrpc/lib/linkedMap.js | 279 + .../node_modules/vscode-jsonrpc/lib/main.d.ts | 223 + .../node_modules/vscode-jsonrpc/lib/main.js | 923 + .../vscode-jsonrpc/lib/messageReader.d.ts | 59 + .../vscode-jsonrpc/lib/messageReader.js | 225 + .../vscode-jsonrpc/lib/messageWriter.d.ts | 52 + .../vscode-jsonrpc/lib/messageWriter.js | 190 + .../vscode-jsonrpc/lib/messages.d.ts | 231 + .../vscode-jsonrpc/lib/messages.js | 245 + .../vscode-jsonrpc/lib/pipeSupport.d.ts | 8 + .../vscode-jsonrpc/lib/pipeSupport.js | 54 + .../vscode-jsonrpc/lib/socketSupport.d.ts | 7 + .../vscode-jsonrpc/lib/socketSupport.js | 40 + .../vscode-jsonrpc/lib/thenable.d.ts | 2 + .../vscode-jsonrpc/lib/thenable.js | 0 .../node_modules/vscode-jsonrpc/package.json | 28 + .../vscode-jsonrpc/thirdpartynotices.txt | 31 + .../License.txt | 11 + .../vscode-languageserver-protocol/README.md | 16 + .../lib/main.d.ts | 146 + .../lib/main.js | 43 + .../lib/protocol.colorProvider.d.ts | 73 + .../lib/protocol.colorProvider.js | 27 + .../lib/protocol.configuration.d.ts | 42 + .../lib/protocol.configuration.js | 20 + .../lib/protocol.d.ts | 1646 + .../lib/protocol.declaration.d.ts | 42 + .../lib/protocol.declaration.js | 20 + .../lib/protocol.foldingRange.d.ts | 101 + .../lib/protocol.foldingRange.js | 35 + .../lib/protocol.implementation.d.ts | 41 + .../lib/protocol.implementation.js | 19 + .../lib/protocol.js | 543 + .../lib/protocol.typeDefinition.d.ts | 41 + .../lib/protocol.typeDefinition.js | 19 + .../lib/protocol.workspaceFolders.d.ts | 91 + .../lib/protocol.workspaceFolders.js | 22 + .../lib/utils/is.d.ts | 9 + .../lib/utils/is.js | 42 + .../vscode-languageserver-types/License.txt | 11 + .../vscode-languageserver-types/README.md | 17 + .../lib/esm/main.d.ts | 1827 + .../lib/esm/main.js | 1483 + .../lib/umd/main.d.ts | 1827 + .../lib/umd/main.js | 1496 + .../vscode-languageserver-types/package.json | 27 + .../tsconfig.esm.json | 16 + .../package.json | 29 + .../thirdpartynotices.txt | 31 + .../.eslintignore | 1 + .../License.txt | 11 + .../README.md | 18 + .../lib/esm/main.d.ts | 180 + .../lib/esm/main.js | 269 + .../lib/tsconfig.esm.tsbuildInfo | 403 + .../lib/umd/main.d.ts | 180 + .../lib/umd/main.js | 280 + .../package.json | 28 + .../tsconfig.esm.json | 18 + .../vscode-languageserver-types/License.txt | 11 + .../vscode-languageserver-types/README.md | 17 + .../lib/esm/main.d.ts | 2323 + .../lib/esm/main.js | 1908 + .../lib/umd/main.d.ts | 2323 + .../lib/umd/main.js | 1921 + .../vscode-languageserver-types/package.json | 28 + .../vscode-languageserver/License.txt | 11 + .../vscode-languageserver/README.md | 17 + .../bin/installServerIntoExtension | 70 + .../lib/configuration.d.ts | 9 + .../lib/configuration.js | 31 + .../vscode-languageserver/lib/files.d.ts | 19 + .../vscode-languageserver/lib/files.js | 322 + .../vscode-languageserver/lib/main.d.ts | 767 + .../vscode-languageserver/lib/main.js | 891 + .../vscode-languageserver/lib/resolve.d.ts | 6 + .../vscode-languageserver/lib/resolve.js | 19 + .../vscode-languageserver/lib/thenable.d.ts | 2 + .../vscode-languageserver/lib/thenable.js | 0 .../vscode-languageserver/lib/utils/is.d.ts | 9 + .../vscode-languageserver/lib/utils/is.js | 42 + .../vscode-languageserver/lib/utils/uuid.d.ts | 22 + .../vscode-languageserver/lib/utils/uuid.js | 96 + .../lib/workspaceFolders.d.ts | 7 + .../lib/workspaceFolders.js | 32 + .../node_modules/vscode-uri/.travis.yml | 8 + .../vscode-uri/.vscode/settings.json | 4 + .../node_modules/vscode-uri/LICENSE.md | 9 + .../node_modules/vscode-uri/README.md | 54 + .../vscode-uri/lib/esm/index.d.ts | 143 + .../node_modules/vscode-uri/lib/esm/index.js | 592 + .../vscode-uri/lib/umd/index.d.ts | 143 + .../node_modules/vscode-uri/lib/umd/index.js | 604 + .../node_modules/vscode-uri/package.json | 25 + .../vscode-languageserver/package.json | 32 + .../thirdpartynotices.txt | 35 + .../node_modules/vscode-nls/.eslintignore | 2 + .../node_modules/vscode-nls/.eslintrc.json | 18 + .../node_modules/vscode-nls/.mocharc.json | 5 + .../node_modules/vscode-nls/License.txt | 17 + .../node_modules/vscode-nls/README.md | 69 + .../vscode-nls/ThirdPartyNotices.txt | 31 + .../node_modules/vscode-nls/lib/main.d.ts | 29 + .../node_modules/vscode-nls/lib/main.js | 499 + .../node_modules/vscode-nls/package.json | 33 + .../node_modules/vscode-uri/.travis.yml | 8 + .../vscode-uri/.vscode/settings.json | 4 + .../node_modules/vscode-uri/LICENSE.md | 9 + .../node_modules/vscode-uri/README.md | 54 + .../vscode-uri/lib/esm/index.d.ts | 145 + .../node_modules/vscode-uri/lib/esm/index.js | 643 + .../vscode-uri/lib/umd/index.d.ts | 145 + .../node_modules/vscode-uri/lib/umd/index.js | 655 + .../node_modules/vscode-uri/package.json | 25 + .../yaml-language-server-parser/README.md | 45 + .../dist/src/common.d.ts | 6 + .../dist/src/common.js | 45 + .../dist/src/common.js.map | 1 + .../dist/src/dumper.d.ts | 2 + .../dist/src/dumper.js | 644 + .../dist/src/dumper.js.map | 1 + .../dist/src/exception.d.ts | 14 + .../dist/src/exception.js | 35 + .../dist/src/exception.js.map | 1 + .../dist/src/index.d.ts | 6 + .../dist/src/index.js | 22 + .../dist/src/index.js.map | 1 + .../dist/src/loader.d.ts | 13 + .../dist/src/loader.js | 1406 + .../dist/src/loader.js.map | 1 + .../dist/src/mark.d.ts | 13 + .../dist/src/mark.js | 58 + .../dist/src/mark.js.map | 1 + .../dist/src/scalarInference.d.ts | 12 + .../dist/src/scalarInference.js | 82 + .../dist/src/scalarInference.js.map | 1 + .../dist/src/schema.d.ts | 17 + .../dist/src/schema.js | 77 + .../dist/src/schema.js.map | 1 + .../dist/src/schema/core.d.ts | 3 + .../dist/src/schema/core.js | 8 + .../dist/src/schema/core.js.map | 1 + .../dist/src/schema/default_full.d.ts | 3 + .../dist/src/schema/default_full.js | 14 + .../dist/src/schema/default_full.js.map | 1 + .../dist/src/schema/default_safe.d.ts | 3 + .../dist/src/schema/default_safe.js | 19 + .../dist/src/schema/default_safe.js.map | 1 + .../dist/src/schema/failsafe.d.ts | 3 + .../dist/src/schema/failsafe.js | 10 + .../dist/src/schema/failsafe.js.map | 1 + .../dist/src/schema/json.d.ts | 3 + .../dist/src/schema/json.js | 14 + .../dist/src/schema/json.js.map | 1 + .../dist/src/type.d.ts | 14 + .../dist/src/type.js | 53 + .../dist/src/type.js.map | 1 + .../dist/src/type/binary.d.ts | 3 + .../dist/src/type/binary.js | 92 + .../dist/src/type/binary.js.map | 1 + .../dist/src/type/bool.d.ts | 3 + .../dist/src/type/bool.js | 37 + .../dist/src/type/bool.js.map | 1 + .../dist/src/type/float.d.ts | 3 + .../dist/src/type/float.js | 98 + .../dist/src/type/float.js.map | 1 + .../dist/src/type/int.d.ts | 3 + .../dist/src/type/int.js | 160 + .../dist/src/type/int.js.map | 1 + .../dist/src/type/js/function.d.ts | 3 + .../dist/src/type/js/function.js | 49 + .../dist/src/type/js/function.js.map | 1 + .../dist/src/type/js/regexp.d.ts | 3 + .../dist/src/type/js/regexp.js | 64 + .../dist/src/type/js/regexp.js.map | 1 + .../dist/src/type/js/undefined.d.ts | 3 + .../dist/src/type/js/undefined.js | 22 + .../dist/src/type/js/undefined.js.map | 1 + .../dist/src/type/map.d.ts | 3 + .../dist/src/type/map.js | 7 + .../dist/src/type/map.js.map | 1 + .../dist/src/type/merge.d.ts | 3 + .../dist/src/type/merge.js | 10 + .../dist/src/type/merge.js.map | 1 + .../dist/src/type/null.d.ts | 3 + .../dist/src/type/null.js | 35 + .../dist/src/type/null.js.map | 1 + .../dist/src/type/omap.d.ts | 3 + .../dist/src/type/omap.js | 46 + .../dist/src/type/omap.js.map | 1 + .../dist/src/type/pairs.d.ts | 3 + .../dist/src/type/pairs.js | 55 + .../dist/src/type/pairs.js.map | 1 + .../dist/src/type/seq.d.ts | 3 + .../dist/src/type/seq.js | 7 + .../dist/src/type/seq.js.map | 1 + .../dist/src/type/set.d.ts | 3 + .../dist/src/type/set.js | 22 + .../dist/src/type/set.js.map | 1 + .../dist/src/type/str.d.ts | 3 + .../dist/src/type/str.js | 7 + .../dist/src/type/str.js.map | 1 + .../dist/src/type/timestamp.d.ts | 3 + .../dist/src/type/timestamp.js | 70 + .../dist/src/type/timestamp.js.map | 1 + .../dist/src/yamlAST.d.ts | 55 + .../dist/src/yamlAST.js | 140 + .../dist/src/yamlAST.js.map | 1 + .../dist/test/characterSet.test.d.ts | 1 + .../dist/test/characterSet.test.js | 64 + .../dist/test/characterSet.test.js.map | 1 + .../dist/test/loader.test.d.ts | 1 + .../dist/test/loader.test.js | 82 + .../dist/test/loader.test.js.map | 1 + .../dist/test/mappings.test.d.ts | 1 + .../dist/test/mappings.test.js | 72 + .../dist/test/mappings.test.js.map | 1 + .../dist/test/multipleKinds.test.d.ts | 1 + .../dist/test/multipleKinds.test.js | 75 + .../dist/test/multipleKinds.test.js.map | 1 + .../dist/test/scalarInference.test.d.ts | 1 + .../dist/test/scalarInference.test.js | 134 + .../dist/test/scalarInference.test.js.map | 1 + .../dist/test/stability.test.d.ts | 1 + .../dist/test/stability.test.js | 55 + .../dist/test/stability.test.js.map | 1 + .../dist/test/tags.test.d.ts | 1 + .../dist/test/tags.test.js | 165 + .../dist/test/tags.test.js.map | 1 + .../dist/test/testUtil.d.ts | 9 + .../dist/test/testUtil.js | 59 + .../dist/test/testUtil.js.map | 1 + .../dist/test/visitor.d.ts | 18 + .../dist/test/visitor.js | 30 + .../dist/test/visitor.js.map | 1 + .../dist/test/yamlAST.test.d.ts | 1 + .../dist/test/yamlAST.test.js | 89 + .../dist/test/yamlAST.test.js.map | 1 + .../dist/test/yamlSyntax.test.d.ts | 1 + .../dist/test/yamlSyntax.test.js | 35 + .../dist/test/yamlSyntax.test.js.map | 1 + .../yaml-language-server-parser/license.txt | 13 + .../yaml-language-server-parser/package.json | 35 + .../yaml-language-server-parser/src/common.ts | 57 + .../yaml-language-server-parser/src/dumper.ts | 835 + .../src/exception.ts | 53 + .../yaml-language-server-parser/src/index.ts | 22 + .../yaml-language-server-parser/src/loader.ts | 1857 + .../yaml-language-server-parser/src/mark.ts | 77 + .../src/scalarInference.ts | 98 + .../yaml-language-server-parser/src/schema.ts | 115 + .../src/schema/core.ts | 21 + .../src/schema/default_full.ts | 28 + .../src/schema/default_safe.ts | 31 + .../src/schema/failsafe.ts | 21 + .../src/schema/json.ts | 28 + .../yaml-language-server-parser/src/type.ts | 74 + .../src/type/binary.ts | 137 + .../src/type/bool.ts | 47 + .../src/type/float.ts | 112 + .../src/type/int.ts | 190 + .../src/type/js/function.ts | 82 + .../src/type/js/regexp.ts | 86 + .../src/type/js/undefined.ts | 30 + .../src/type/map.ts | 10 + .../src/type/merge.ts | 14 + .../src/type/null.ts | 43 + .../src/type/omap.ts | 58 + .../src/type/pairs.ts | 76 + .../src/type/seq.ts | 10 + .../src/type/set.ts | 30 + .../src/type/str.ts | 10 + .../src/type/timestamp.ts | 100 + .../src/yamlAST.ts | 207 + .../yaml-language-server-parser/tsconfig.json | 19 + .../yaml-language-server/CHANGELOG.md | 251 + .../yaml-language-server/Dockerfile | 11 + .../node_modules/yaml-language-server/LICENSE | 21 + .../yaml-language-server/README.md | 282 + .../bin/yaml-language-server | 3 + .../yaml-language-server/lib/esm/index.d.ts | 3 + .../yaml-language-server/lib/esm/index.js | 4 + .../yaml-language-server/lib/esm/index.js.map | 1 + .../lib/esm/languageservice/jsonASTTypes.d.ts | 45 + .../lib/esm/languageservice/jsonASTTypes.js | 5 + .../esm/languageservice/jsonASTTypes.js.map | 1 + .../lib/esm/languageservice/jsonSchema.d.ts | 70 + .../lib/esm/languageservice/jsonSchema.js | 1 + .../lib/esm/languageservice/jsonSchema.js.map | 1 + .../languageservice/parser/isKubernetes.d.ts | 2 + .../languageservice/parser/isKubernetes.js | 6 + .../parser/isKubernetes.js.map | 1 + .../languageservice/parser/jsonParser07.d.ts | 120 + .../languageservice/parser/jsonParser07.js | 1099 + .../parser/jsonParser07.js.map | 1 + .../parser/recursivelyBuildAst.d.ts | 3 + .../parser/recursivelyBuildAst.js | 114 + .../parser/recursivelyBuildAst.js.map | 1 + .../languageservice/parser/scalar-type.d.ts | 8 + .../esm/languageservice/parser/scalar-type.js | 17 + .../languageservice/parser/scalar-type.js.map | 1 + .../languageservice/parser/yamlParser07.d.ts | 34 + .../languageservice/parser/yamlParser07.js | 102 + .../parser/yamlParser07.js.map | 1 + .../services/documentSymbols.d.ts | 8 + .../services/documentSymbols.js | 51 + .../services/documentSymbols.js.map | 1 + .../services/schemaRequestHandler.d.ts | 7 + .../services/schemaRequestHandler.js | 57 + .../services/schemaRequestHandler.js.map | 1 + .../services/yamlCompletion.d.ts | 39 + .../services/yamlCompletion.js | 843 + .../services/yamlCompletion.js.map | 1 + .../services/yamlFormatter.d.ts | 7 + .../languageservice/services/yamlFormatter.js | 45 + .../services/yamlFormatter.js.map | 1 + .../languageservice/services/yamlHover.d.ts | 10 + .../esm/languageservice/services/yamlHover.js | 37 + .../languageservice/services/yamlHover.js.map | 1 + .../languageservice/services/yamlLinks.d.ts | 3 + .../esm/languageservice/services/yamlLinks.js | 13 + .../languageservice/services/yamlLinks.js.map | 1 + .../services/yamlSchemaService.d.ts | 91 + .../services/yamlSchemaService.js | 475 + .../services/yamlSchemaService.js.map | 1 + .../services/yamlValidation.d.ts | 20 + .../services/yamlValidation.js | 94 + .../services/yamlValidation.js.map | 1 + .../esm/languageservice/utils/arrUtils.d.ts | 5 + .../lib/esm/languageservice/utils/arrUtils.js | 63 + .../esm/languageservice/utils/arrUtils.js.map | 1 + .../esm/languageservice/utils/charCode.d.ts | 415 + .../lib/esm/languageservice/utils/charCode.js | 5 + .../esm/languageservice/utils/charCode.js.map | 1 + .../utils/documentPositionCalculator.d.ts | 5 + .../utils/documentPositionCalculator.js | 57 + .../utils/documentPositionCalculator.js.map | 1 + .../utils/indentationGuesser.d.ts | 15 + .../utils/indentationGuesser.js | 177 + .../utils/indentationGuesser.js.map | 1 + .../lib/esm/languageservice/utils/json.d.ts | 6 + .../lib/esm/languageservice/utils/json.js | 70 + .../lib/esm/languageservice/utils/json.js.map | 1 + .../esm/languageservice/utils/objects.d.ts | 5 + .../lib/esm/languageservice/utils/objects.js | 69 + .../esm/languageservice/utils/objects.js.map | 1 + .../esm/languageservice/utils/parseUtils.d.ts | 24 + .../esm/languageservice/utils/parseUtils.js | 73 + .../languageservice/utils/parseUtils.js.map | 1 + .../lib/esm/languageservice/utils/paths.d.ts | 5 + .../lib/esm/languageservice/utils/paths.js | 42 + .../esm/languageservice/utils/paths.js.map | 1 + .../esm/languageservice/utils/schemaUrls.d.ts | 2 + .../esm/languageservice/utils/schemaUrls.js | 3 + .../languageservice/utils/schemaUrls.js.map | 1 + .../esm/languageservice/utils/strings.d.ts | 7 + .../lib/esm/languageservice/utils/strings.js | 45 + .../esm/languageservice/utils/strings.js.map | 1 + .../esm/languageservice/utils/textBuffer.d.ts | 9 + .../esm/languageservice/utils/textBuffer.js | 39 + .../languageservice/utils/textBuffer.js.map | 1 + .../languageservice/yamlLanguageService.d.ts | 67 + .../languageservice/yamlLanguageService.js | 62 + .../yamlLanguageService.js.map | 1 + .../lib/esm/requestTypes.d.ts | 28 + .../lib/esm/requestTypes.js | 37 + .../lib/esm/requestTypes.js.map | 1 + .../yaml-language-server/lib/esm/server.d.ts | 1 + .../yaml-language-server/lib/esm/server.js | 529 + .../lib/esm/server.js.map | 1 + .../yaml-language-server/lib/umd/index.d.ts | 3 + .../yaml-language-server/lib/umd/index.js | 20 + .../yaml-language-server/lib/umd/index.js.map | 1 + .../lib/umd/languageservice/jsonASTTypes.d.ts | 45 + .../lib/umd/languageservice/jsonASTTypes.js | 17 + .../umd/languageservice/jsonASTTypes.js.map | 1 + .../lib/umd/languageservice/jsonSchema.d.ts | 70 + .../lib/umd/languageservice/jsonSchema.js | 13 + .../lib/umd/languageservice/jsonSchema.js.map | 1 + .../languageservice/parser/isKubernetes.d.ts | 2 + .../languageservice/parser/isKubernetes.js | 19 + .../parser/isKubernetes.js.map | 1 + .../languageservice/parser/jsonParser07.d.ts | 120 + .../languageservice/parser/jsonParser07.js | 1126 + .../parser/jsonParser07.js.map | 1 + .../parser/recursivelyBuildAst.d.ts | 3 + .../parser/recursivelyBuildAst.js | 127 + .../parser/recursivelyBuildAst.js.map | 1 + .../languageservice/parser/scalar-type.d.ts | 8 + .../umd/languageservice/parser/scalar-type.js | 30 + .../languageservice/parser/scalar-type.js.map | 1 + .../languageservice/parser/yamlParser07.d.ts | 34 + .../languageservice/parser/yamlParser07.js | 116 + .../parser/yamlParser07.js.map | 1 + .../services/documentSymbols.d.ts | 8 + .../services/documentSymbols.js | 63 + .../services/documentSymbols.js.map | 1 + .../services/schemaRequestHandler.d.ts | 7 + .../services/schemaRequestHandler.js | 69 + .../services/schemaRequestHandler.js.map | 1 + .../services/yamlCompletion.d.ts | 39 + .../services/yamlCompletion.js | 855 + .../services/yamlCompletion.js.map | 1 + .../services/yamlFormatter.d.ts | 7 + .../languageservice/services/yamlFormatter.js | 57 + .../services/yamlFormatter.js.map | 1 + .../languageservice/services/yamlHover.d.ts | 10 + .../umd/languageservice/services/yamlHover.js | 49 + .../languageservice/services/yamlHover.js.map | 1 + .../languageservice/services/yamlLinks.d.ts | 3 + .../umd/languageservice/services/yamlLinks.js | 26 + .../languageservice/services/yamlLinks.js.map | 1 + .../services/yamlSchemaService.d.ts | 91 + .../services/yamlSchemaService.js | 488 + .../services/yamlSchemaService.js.map | 1 + .../services/yamlValidation.d.ts | 20 + .../services/yamlValidation.js | 106 + .../services/yamlValidation.js.map | 1 + .../umd/languageservice/utils/arrUtils.d.ts | 5 + .../lib/umd/languageservice/utils/arrUtils.js | 79 + .../umd/languageservice/utils/arrUtils.js.map | 1 + .../umd/languageservice/utils/charCode.d.ts | 415 + .../lib/umd/languageservice/utils/charCode.js | 17 + .../umd/languageservice/utils/charCode.js.map | 1 + .../utils/documentPositionCalculator.d.ts | 5 + .../utils/documentPositionCalculator.js | 72 + .../utils/documentPositionCalculator.js.map | 1 + .../utils/indentationGuesser.d.ts | 15 + .../utils/indentationGuesser.js | 190 + .../utils/indentationGuesser.js.map | 1 + .../lib/umd/languageservice/utils/json.d.ts | 6 + .../lib/umd/languageservice/utils/json.js | 83 + .../lib/umd/languageservice/utils/json.js.map | 1 + .../umd/languageservice/utils/objects.d.ts | 5 + .../lib/umd/languageservice/utils/objects.js | 85 + .../umd/languageservice/utils/objects.js.map | 1 + .../umd/languageservice/utils/parseUtils.d.ts | 24 + .../umd/languageservice/utils/parseUtils.js | 89 + .../languageservice/utils/parseUtils.js.map | 1 + .../lib/umd/languageservice/utils/paths.d.ts | 5 + .../lib/umd/languageservice/utils/paths.js | 54 + .../umd/languageservice/utils/paths.js.map | 1 + .../umd/languageservice/utils/schemaUrls.d.ts | 2 + .../umd/languageservice/utils/schemaUrls.js | 15 + .../languageservice/utils/schemaUrls.js.map | 1 + .../umd/languageservice/utils/strings.d.ts | 7 + .../lib/umd/languageservice/utils/strings.js | 60 + .../umd/languageservice/utils/strings.js.map | 1 + .../umd/languageservice/utils/textBuffer.d.ts | 9 + .../umd/languageservice/utils/textBuffer.js | 52 + .../languageservice/utils/textBuffer.js.map | 1 + .../languageservice/yamlLanguageService.d.ts | 67 + .../languageservice/yamlLanguageService.js | 75 + .../yamlLanguageService.js.map | 1 + .../lib/umd/requestTypes.d.ts | 28 + .../lib/umd/requestTypes.js | 49 + .../lib/umd/requestTypes.js.map | 1 + .../yaml-language-server/lib/umd/server.d.ts | 1 + .../yaml-language-server/lib/umd/server.js | 540 + .../lib/umd/server.js.map | 1 + .../out/server/src/index.d.ts | 3 + .../out/server/src/index.js | 10 + .../out/server/src/index.js.map | 1 + .../src/languageservice/jsonASTTypes.d.ts | 45 + .../src/languageservice/jsonASTTypes.js | 7 + .../src/languageservice/jsonASTTypes.js.map | 1 + .../src/languageservice/jsonSchema.d.ts | 70 + .../server/src/languageservice/jsonSchema.js | 3 + .../src/languageservice/jsonSchema.js.map | 1 + .../languageservice/parser/isKubernetes.d.ts | 2 + .../languageservice/parser/isKubernetes.js | 9 + .../parser/isKubernetes.js.map | 1 + .../languageservice/parser/jsonParser07.d.ts | 120 + .../languageservice/parser/jsonParser07.js | 1116 + .../parser/jsonParser07.js.map | 1 + .../parser/recursivelyBuildAst.d.ts | 3 + .../parser/recursivelyBuildAst.js | 117 + .../parser/recursivelyBuildAst.js.map | 1 + .../languageservice/parser/scalar-type.d.ts | 8 + .../src/languageservice/parser/scalar-type.js | 20 + .../languageservice/parser/scalar-type.js.map | 1 + .../languageservice/parser/yamlParser07.d.ts | 34 + .../languageservice/parser/yamlParser07.js | 106 + .../parser/yamlParser07.js.map | 1 + .../services/documentSymbols.d.ts | 8 + .../services/documentSymbols.js | 53 + .../services/documentSymbols.js.map | 1 + .../services/schemaRequestHandler.d.ts | 7 + .../services/schemaRequestHandler.js | 59 + .../services/schemaRequestHandler.js.map | 1 + .../services/yamlCompletion.d.ts | 39 + .../services/yamlCompletion.js | 845 + .../services/yamlCompletion.js.map | 1 + .../services/yamlFormatter.d.ts | 7 + .../languageservice/services/yamlFormatter.js | 47 + .../services/yamlFormatter.js.map | 1 + .../languageservice/services/yamlHover.d.ts | 10 + .../src/languageservice/services/yamlHover.js | 39 + .../languageservice/services/yamlHover.js.map | 1 + .../languageservice/services/yamlLinks.d.ts | 3 + .../src/languageservice/services/yamlLinks.js | 16 + .../languageservice/services/yamlLinks.js.map | 1 + .../services/yamlSchemaService.d.ts | 91 + .../services/yamlSchemaService.js | 478 + .../services/yamlSchemaService.js.map | 1 + .../services/yamlValidation.d.ts | 20 + .../services/yamlValidation.js | 96 + .../services/yamlValidation.js.map | 1 + .../src/languageservice/utils/arrUtils.d.ts | 5 + .../src/languageservice/utils/arrUtils.js | 69 + .../src/languageservice/utils/arrUtils.js.map | 1 + .../src/languageservice/utils/charCode.d.ts | 415 + .../src/languageservice/utils/charCode.js | 7 + .../src/languageservice/utils/charCode.js.map | 1 + .../utils/documentPositionCalculator.d.ts | 5 + .../utils/documentPositionCalculator.js | 62 + .../utils/documentPositionCalculator.js.map | 1 + .../utils/indentationGuesser.d.ts | 15 + .../utils/indentationGuesser.js | 180 + .../utils/indentationGuesser.js.map | 1 + .../src/languageservice/utils/json.d.ts | 6 + .../server/src/languageservice/utils/json.js | 73 + .../src/languageservice/utils/json.js.map | 1 + .../src/languageservice/utils/objects.d.ts | 5 + .../src/languageservice/utils/objects.js | 75 + .../src/languageservice/utils/objects.js.map | 1 + .../src/languageservice/utils/parseUtils.d.ts | 24 + .../src/languageservice/utils/parseUtils.js | 79 + .../languageservice/utils/parseUtils.js.map | 1 + .../src/languageservice/utils/paths.d.ts | 5 + .../server/src/languageservice/utils/paths.js | 44 + .../src/languageservice/utils/paths.js.map | 1 + .../src/languageservice/utils/schemaUrls.d.ts | 2 + .../src/languageservice/utils/schemaUrls.js | 5 + .../languageservice/utils/schemaUrls.js.map | 1 + .../src/languageservice/utils/strings.d.ts | 7 + .../src/languageservice/utils/strings.js | 50 + .../src/languageservice/utils/strings.js.map | 1 + .../src/languageservice/utils/textBuffer.d.ts | 9 + .../src/languageservice/utils/textBuffer.js | 42 + .../languageservice/utils/textBuffer.js.map | 1 + .../languageservice/yamlLanguageService.d.ts | 67 + .../languageservice/yamlLanguageService.js | 65 + .../yamlLanguageService.js.map | 1 + .../out/server/src/requestTypes.d.ts | 28 + .../out/server/src/requestTypes.js | 39 + .../out/server/src/requestTypes.js.map | 1 + .../out/server/src/server.d.ts | 1 + .../out/server/src/server.js | 530 + .../out/server/src/server.js.map | 1 + .../out/server/test/arrUtils.test.d.ts | 1 + .../out/server/test/arrUtils.test.js | 60 + .../out/server/test/arrUtils.test.js.map | 1 + .../out/server/test/autoCompletion.test.d.ts | 1 + .../out/server/test/autoCompletion.test.js | 1295 + .../server/test/autoCompletion.test.js.map | 1 + .../out/server/test/customTags.test.d.ts | 1 + .../out/server/test/customTags.test.js | 81 + .../out/server/test/customTags.test.js.map | 1 + .../out/server/test/defaultSnippets.test.d.ts | 1 + .../out/server/test/defaultSnippets.test.js | 237 + .../server/test/defaultSnippets.test.js.map | 1 + .../test/documentPositionCalculator.test.d.ts | 1 + .../test/documentPositionCalculator.test.js | 69 + .../documentPositionCalculator.test.js.map | 1 + .../out/server/test/documentSymbols.test.d.ts | 1 + .../out/server/test/documentSymbols.test.js | 205 + .../server/test/documentSymbols.test.js.map | 1 + .../out/server/test/findLinks.test.d.ts | 1 + .../out/server/test/findLinks.test.js | 39 + .../out/server/test/findLinks.test.js.map | 1 + .../out/server/test/formatter.test.d.ts | 1 + .../out/server/test/formatter.test.js | 106 + .../out/server/test/formatter.test.js.map | 1 + .../out/server/test/hover.test.d.ts | 1 + .../out/server/test/hover.test.js | 283 + .../out/server/test/hover.test.js.map | 1 + .../out/server/test/integration.test.d.ts | 1 + .../out/server/test/integration.test.js | 271 + .../out/server/test/integration.test.js.map | 1 + .../out/server/test/jsonParser.test.d.ts | 1 + .../out/server/test/jsonParser.test.js | 1664 + .../out/server/test/jsonParser.test.js.map | 1 + .../server/test/mulipleDocuments.test.d.ts | 1 + .../out/server/test/mulipleDocuments.test.js | 98 + .../server/test/mulipleDocuments.test.js.map | 1 + .../out/server/test/objects.test.d.ts | 1 + .../out/server/test/objects.test.js | 94 + .../out/server/test/objects.test.js.map | 1 + .../out/server/test/paths.test.d.ts | 1 + .../out/server/test/paths.test.js | 223 + .../out/server/test/paths.test.js.map | 1 + .../out/server/test/schema.test.d.ts | 1 + .../out/server/test/schema.test.js | 514 + .../out/server/test/schema.test.js.map | 1 + .../test/schemaRequestHandler.test.d.ts | 1 + .../server/test/schemaRequestHandler.test.js | 48 + .../test/schemaRequestHandler.test.js.map | 1 + .../server/test/schemaValidation.test.d.ts | 1 + .../out/server/test/schemaValidation.test.js | 917 + .../server/test/schemaValidation.test.js.map | 1 + .../out/server/test/strings.test.d.ts | 1 + .../out/server/test/strings.test.js | 63 + .../out/server/test/strings.test.js.map | 1 + .../out/server/test/textBuffer.test.d.ts | 1 + .../out/server/test/textBuffer.test.js | 41 + .../out/server/test/textBuffer.test.js.map | 1 + .../out/server/test/utils/errorMessages.d.ts | 25 + .../out/server/test/utils/errorMessages.js | 35 + .../server/test/utils/errorMessages.js.map | 1 + .../out/server/test/utils/serviceSetup.d.ts | 15 + .../out/server/test/utils/serviceSetup.js | 54 + .../out/server/test/utils/serviceSetup.js.map | 1 + .../out/server/test/utils/testHelper.d.ts | 14 + .../out/server/test/utils/testHelper.js | 93 + .../out/server/test/utils/testHelper.js.map | 1 + .../out/server/test/utils/verifyError.d.ts | 6 + .../out/server/test/utils/verifyError.js | 84 + .../out/server/test/utils/verifyError.js.map | 1 + .../out/server/test/yamlParser.test.d.ts | 1 + .../out/server/test/yamlParser.test.js | 124 + .../out/server/test/yamlParser.test.js.map | 1 + .../out/server/test/yamlSchema.test.d.ts | 1 + .../out/server/test/yamlSchema.test.js | 70 + .../out/server/test/yamlSchema.test.js.map | 1 + .../yaml-language-server/package.json | 98 + .../scripts/check-dependencies.js | 21 + .../yaml-language-server/tsconfig.esm.json | 15 + .../yaml-language-server/tsconfig.umd.json | 14 + .../node_modules/coc-yaml/package-lock.json | 559 + .../node_modules/coc-yaml/package.json | 116 + coc/extensions/package.json | 8 + coc/list-commands-history.json | 1 + coc/list-extensions-history.json | 1 + coc/memos.json | 1 + coc/mru | 0 1061 files changed, 319951 insertions(+) create mode 100644 coc/commands create mode 100644 coc/extensions/node_modules/coc-clangd/LICENSE create mode 100644 coc/extensions/node_modules/coc-clangd/README.md create mode 100644 coc/extensions/node_modules/coc-clangd/esbuild.js create mode 100644 coc/extensions/node_modules/coc-clangd/lib/index.js create mode 100644 coc/extensions/node_modules/coc-clangd/package.json create mode 100644 coc/extensions/node_modules/coc-go/.editorconfig create mode 100644 coc/extensions/node_modules/coc-go/.eslintignore create mode 100644 coc/extensions/node_modules/coc-go/.eslintrc create mode 100644 coc/extensions/node_modules/coc-go/.github/workflows/main.yml create mode 100644 coc/extensions/node_modules/coc-go/.github/workflows/update-settings.yml create mode 100644 coc/extensions/node_modules/coc-go/.vim/coc-settings.json create mode 100644 coc/extensions/node_modules/coc-go/LICENSE create mode 100644 coc/extensions/node_modules/coc-go/README.md create mode 100644 coc/extensions/node_modules/coc-go/debug/Dockerfile create mode 100644 coc/extensions/node_modules/coc-go/debug/init.vim create mode 100644 coc/extensions/node_modules/coc-go/lib/binaries.js create mode 100644 coc/extensions/node_modules/coc-go/lib/commands.js create mode 100644 coc/extensions/node_modules/coc-go/lib/editor.js create mode 100644 coc/extensions/node_modules/coc-go/lib/extension.js create mode 100644 coc/extensions/node_modules/coc-go/lib/utils/checktag.js create mode 100644 coc/extensions/node_modules/coc-go/lib/utils/config.js create mode 100644 coc/extensions/node_modules/coc-go/lib/utils/fs.js create mode 100644 coc/extensions/node_modules/coc-go/lib/utils/fs.test.js create mode 100644 coc/extensions/node_modules/coc-go/lib/utils/impl.js create mode 100644 coc/extensions/node_modules/coc-go/lib/utils/modify-tags.js create mode 100644 coc/extensions/node_modules/coc-go/lib/utils/playground.js create mode 100644 coc/extensions/node_modules/coc-go/lib/utils/tests.js create mode 100644 coc/extensions/node_modules/coc-go/lib/utils/tests.test.js create mode 100644 coc/extensions/node_modules/coc-go/lib/utils/tools.js create mode 100644 coc/extensions/node_modules/coc-go/lib/utils/versions.js create mode 100644 coc/extensions/node_modules/coc-go/lib/utils/versions.test.js create mode 120000 coc/extensions/node_modules/coc-go/node_modules/.bin/node-which create mode 100644 coc/extensions/node_modules/coc-go/node_modules/.package-lock.json create mode 100644 coc/extensions/node_modules/coc-go/node_modules/isexe/.npmignore create mode 100644 coc/extensions/node_modules/coc-go/node_modules/isexe/LICENSE create mode 100644 coc/extensions/node_modules/coc-go/node_modules/isexe/README.md create mode 100644 coc/extensions/node_modules/coc-go/node_modules/isexe/index.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/isexe/mode.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/isexe/package.json create mode 100644 coc/extensions/node_modules/coc-go/node_modules/isexe/test/basic.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/isexe/windows.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/node-fetch/CHANGELOG.md create mode 100644 coc/extensions/node_modules/coc-go/node_modules/node-fetch/LICENSE.md create mode 100644 coc/extensions/node_modules/coc-go/node_modules/node-fetch/README.md create mode 100644 coc/extensions/node_modules/coc-go/node_modules/node-fetch/browser.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/node-fetch/lib/index.es.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/node-fetch/lib/index.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/node-fetch/lib/index.mjs create mode 100644 coc/extensions/node_modules/coc-go/node_modules/node-fetch/package.json create mode 100644 coc/extensions/node_modules/coc-go/node_modules/tslib/CopyrightNotice.txt create mode 100644 coc/extensions/node_modules/coc-go/node_modules/tslib/LICENSE.txt create mode 100644 coc/extensions/node_modules/coc-go/node_modules/tslib/README.md create mode 100644 coc/extensions/node_modules/coc-go/node_modules/tslib/modules/index.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/tslib/modules/package.json create mode 100644 coc/extensions/node_modules/coc-go/node_modules/tslib/package.json create mode 100644 coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.d.ts create mode 100644 coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.es6.html create mode 100644 coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.es6.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.html create mode 100644 coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/.eslintignore create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/License.txt create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/README.md create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/esm/main.d.ts create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/esm/main.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/tsconfig.esm.tsbuildInfo create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/umd/main.d.ts create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/umd/main.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/package.json create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/tsconfig.esm.json create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-uri/LICENSE.md create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-uri/README.md create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/esm/index.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/esm/index.js.map create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/charCode.d.ts create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/index.d.ts create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/index.js create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/index.js.map create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/platform.d.ts create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/uri.d.ts create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/utils.d.ts create mode 100644 coc/extensions/node_modules/coc-go/node_modules/vscode-uri/package.json create mode 100644 coc/extensions/node_modules/coc-go/node_modules/which/CHANGELOG.md create mode 100644 coc/extensions/node_modules/coc-go/node_modules/which/LICENSE create mode 100644 coc/extensions/node_modules/coc-go/node_modules/which/README.md create mode 100755 coc/extensions/node_modules/coc-go/node_modules/which/bin/node-which create mode 100644 coc/extensions/node_modules/coc-go/node_modules/which/package.json create mode 100644 coc/extensions/node_modules/coc-go/node_modules/which/which.js create mode 100644 coc/extensions/node_modules/coc-go/package-lock.json create mode 100644 coc/extensions/node_modules/coc-go/package.json create mode 100644 coc/extensions/node_modules/coc-go/snippets/go.json create mode 100644 coc/extensions/node_modules/coc-go/snippets/gomod.json create mode 100644 coc/extensions/node_modules/coc-json/Readme.md create mode 100644 coc/extensions/node_modules/coc-json/esbuild.js create mode 100644 coc/extensions/node_modules/coc-json/lib/index.js create mode 100644 coc/extensions/node_modules/coc-json/lib/server.js create mode 100644 coc/extensions/node_modules/coc-json/package.json create mode 100755 coc/extensions/node_modules/coc-json/sync.sh create mode 100644 coc/extensions/node_modules/coc-yaml/.github/FUNDING.yml create mode 100644 coc/extensions/node_modules/coc-yaml/Readme.md create mode 100644 coc/extensions/node_modules/coc-yaml/esbuild.js create mode 100644 coc/extensions/node_modules/coc-yaml/lib/index.js create mode 120000 coc/extensions/node_modules/coc-yaml/node_modules/.bin/esparse create mode 120000 coc/extensions/node_modules/coc-yaml/node_modules/.bin/esvalidate create mode 120000 coc/extensions/node_modules/coc-yaml/node_modules/.bin/installServerIntoExtension create mode 120000 coc/extensions/node_modules/coc-yaml/node_modules/.bin/js-yaml create mode 120000 coc/extensions/node_modules/coc-yaml/node_modules/.bin/prettier create mode 120000 coc/extensions/node_modules/coc-yaml/node_modules/.bin/yaml-language-server create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/.package-lock.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/agent-base/.travis.yml create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/agent-base/History.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/agent-base/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/agent-base/index.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/agent-base/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/agent-base/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/agent-base/patch-core.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/agent-base/test/ssl-cert-snakeoil.key create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/agent-base/test/ssl-cert-snakeoil.pem create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/agent-base/test/test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/CHANGELOG.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/LICENSE create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/append.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/append/constant.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/count.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/help.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store/constant.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store/false.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store/true.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/subparsers.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/version.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action_container.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argparse.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument/error.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument/exclusive.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument/group.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument_parser.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/const.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/help/added_formatters.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/help/formatter.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/namespace.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/utils.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/argparse/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/.coveralls.yml create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/.eslintrc create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/.npmignore create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/.travis.yml create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/CHANGELOG.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/LICENSE create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/Makefile create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/karma.conf.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/node.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/src/browser.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/src/debug.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/src/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/debug/src/node.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/CHANGELOG.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/LICENSE create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/auto.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.min.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.min.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.min.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.min.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/es6-promise.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise.auto.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/-internal.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/asap.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/enumerator.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/polyfill.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/all.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/race.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/reject.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/resolve.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/then.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/utils.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/dist/promise.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/dist/promisify.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/esprima/ChangeLog create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/esprima/LICENSE.BSD create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/esprima/README.md create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/esprima/bin/esparse.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/esprima/bin/esvalidate.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/esprima/dist/esprima.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/esprima/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/http-proxy-agent/.travis.yml create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/http-proxy-agent/History.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/http-proxy-agent/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/http-proxy-agent/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/http-proxy-agent/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/http-proxy-agent/test/ssl-cert-snakeoil.key create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/http-proxy-agent/test/ssl-cert-snakeoil.pem create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/http-proxy-agent/test/test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/https-proxy-agent/.editorconfig create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/https-proxy-agent/.eslintrc.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/https-proxy-agent/History.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/https-proxy-agent/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/https-proxy-agent/index.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/https-proxy-agent/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/https-proxy-agent/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/CHANGELOG.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/LICENSE create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/README.md create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/bin/js-yaml.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/dist/js-yaml.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/dist/js-yaml.min.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/common.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/dumper.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/exception.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/loader.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/mark.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/core.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/default_full.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/json.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/binary.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/bool.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/float.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/int.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/js/function.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/map.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/merge.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/null.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/omap.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/pairs.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/seq.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/set.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/str.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/timestamp.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/.eslintrc.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/.mocharc.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/CHANGELOG.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/LICENSE.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/edit.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/format.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/parser.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/scanner.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/edit.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/format.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/parser.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/scanner.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/ms/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/ms/license.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/ms/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/ms/readme.md create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/LICENSE create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/README.md create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/bin-prettier.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/doc.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/index.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/package.json create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/parser-angular.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/parser-babel.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/parser-flow.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/parser-glimmer.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/parser-graphql.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/parser-html.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/parser-markdown.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/parser-postcss.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/parser-typescript.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/parser-yaml.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/standalone.js create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/prettier/third-party.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/request-light/.github/assignment.yml create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/request-light/CHANGELOG.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/request-light/LICENSE.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/request-light/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/request-light/build/post-publish.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/request-light/build/remove-sourcemap-refs.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/request-light/lib/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/request-light/lib/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/request-light/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/request-light/thirdpartynotices.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/.npmignore create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/LICENSE create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/bower.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/demo/angular.html create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/dist/angular-sprintf.min.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/dist/angular-sprintf.min.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/dist/angular-sprintf.min.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/dist/sprintf.min.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/dist/sprintf.min.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/dist/sprintf.min.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/gruntfile.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/src/angular-sprintf.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/src/sprintf.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/sprintf-js/test/test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/CHANGELOG.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/LICENSE.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/jsonContributions.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/jsonContributions.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/jsonLanguageService.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/jsonLanguageService.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/jsonLanguageTypes.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/jsonLanguageTypes.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/jsonSchema.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/jsonSchema.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/parser/jsonParser.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/services/configuration.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/services/jsonCompletion.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/services/jsonDocumentSymbols.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/services/jsonFolding.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/services/jsonHover.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/services/jsonLinks.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/services/jsonSchemaService.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/services/jsonSelectionRanges.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/services/jsonValidation.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/utils/colors.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/utils/json.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/utils/objects.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/esm/utils/strings.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/jsonContributions.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/jsonContributions.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/jsonLanguageService.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/jsonLanguageService.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/jsonLanguageTypes.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/jsonLanguageTypes.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/jsonSchema.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/jsonSchema.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/parser/jsonParser.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/services/configuration.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/services/jsonCompletion.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/services/jsonDocumentSymbols.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/services/jsonFolding.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/services/jsonHover.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/services/jsonLinks.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/services/jsonSchemaService.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/services/jsonSelectionRanges.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/services/jsonValidation.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/utils/colors.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/utils/json.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/utils/objects.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/lib/umd/utils/strings.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/CHANGELOG.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/LICENSE.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib/esm/impl/edit.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib/esm/impl/format.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib/esm/impl/parser.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib/esm/impl/scanner.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib/esm/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib/esm/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib/umd/impl/edit.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib/umd/impl/format.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib/umd/impl/parser.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib/umd/impl/scanner.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib/umd/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib/umd/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-languageserver-types/.eslintignore create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-languageserver-types/License.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-languageserver-types/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-languageserver-types/lib/esm/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-languageserver-types/lib/esm/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-languageserver-types/lib/tsconfig.esm.tsbuildInfo create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-languageserver-types/lib/umd/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-languageserver-types/lib/umd/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-languageserver-types/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-languageserver-types/tsconfig-watch.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-languageserver-types/tsconfig.esm.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/License.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/browser.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/browser.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/browser/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/browser/main.d.ts.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/browser/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/browser/main.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/common/common.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/common/common.d.ts.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/common/common.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/common/common.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/common/ral.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/common/ral.d.ts.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/common/ral.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/common/ral.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/node/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/node/main.d.ts.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/node/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/lib/node/main.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/node.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/node.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/node_modules/vscode-nls/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-json-languageservice/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/License.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/cancellation.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/cancellation.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/events.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/events.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/is.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/is.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/linkedMap.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/linkedMap.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/messageReader.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/messageReader.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/messageWriter.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/messageWriter.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/messages.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/messages.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/pipeSupport.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/pipeSupport.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/socketSupport.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/socketSupport.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/thenable.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/lib/thenable.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-jsonrpc/thirdpartynotices.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/License.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.colorProvider.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.colorProvider.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.configuration.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.configuration.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.declaration.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.declaration.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.foldingRange.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.foldingRange.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.implementation.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.implementation.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.typeDefinition.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.typeDefinition.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.workspaceFolders.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/protocol.workspaceFolders.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/utils/is.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/lib/utils/is.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/node_modules/vscode-languageserver-types/License.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/node_modules/vscode-languageserver-types/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/node_modules/vscode-languageserver-types/lib/esm/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/node_modules/vscode-languageserver-types/lib/esm/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/node_modules/vscode-languageserver-types/lib/umd/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/node_modules/vscode-languageserver-types/lib/umd/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/node_modules/vscode-languageserver-types/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/node_modules/vscode-languageserver-types/tsconfig.esm.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-protocol/thirdpartynotices.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-textdocument/.eslintignore create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-textdocument/License.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-textdocument/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-textdocument/lib/esm/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-textdocument/lib/esm/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-textdocument/lib/tsconfig.esm.tsbuildInfo create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-textdocument/lib/umd/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-textdocument/lib/umd/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-textdocument/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-textdocument/tsconfig.esm.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-types/License.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-types/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-types/lib/esm/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-types/lib/esm/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-types/lib/umd/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-types/lib/umd/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver-types/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/License.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/README.md create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/bin/installServerIntoExtension create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/configuration.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/configuration.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/files.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/files.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/resolve.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/resolve.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/thenable.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/thenable.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/utils/is.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/utils/is.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/utils/uuid.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/utils/uuid.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/workspaceFolders.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/lib/workspaceFolders.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/node_modules/vscode-uri/.travis.yml create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/node_modules/vscode-uri/.vscode/settings.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/node_modules/vscode-uri/LICENSE.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/node_modules/vscode-uri/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/node_modules/vscode-uri/lib/esm/index.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/node_modules/vscode-uri/lib/esm/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/node_modules/vscode-uri/lib/umd/index.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/node_modules/vscode-uri/lib/umd/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/node_modules/vscode-uri/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-languageserver/thirdpartynotices.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-nls/.eslintignore create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-nls/.eslintrc.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-nls/.mocharc.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-nls/License.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-nls/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-nls/ThirdPartyNotices.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-nls/lib/main.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-nls/lib/main.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-nls/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-uri/.travis.yml create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-uri/.vscode/settings.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-uri/LICENSE.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-uri/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-uri/lib/esm/index.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-uri/lib/esm/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-uri/lib/umd/index.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-uri/lib/umd/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/vscode-uri/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/README.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/common.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/common.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/common.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/dumper.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/dumper.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/dumper.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/exception.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/exception.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/exception.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/index.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/index.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/loader.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/loader.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/loader.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/mark.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/mark.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/mark.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/scalarInference.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/scalarInference.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/scalarInference.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/core.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/core.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/core.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/default_full.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/default_full.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/default_full.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/default_safe.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/default_safe.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/default_safe.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/failsafe.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/failsafe.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/failsafe.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/json.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/json.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/schema/json.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/binary.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/binary.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/binary.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/bool.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/bool.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/bool.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/float.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/float.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/float.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/int.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/int.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/int.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/js/function.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/js/function.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/js/function.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/js/regexp.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/js/regexp.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/js/regexp.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/js/undefined.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/js/undefined.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/js/undefined.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/map.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/map.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/map.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/merge.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/merge.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/merge.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/null.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/null.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/null.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/omap.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/omap.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/omap.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/pairs.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/pairs.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/pairs.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/seq.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/seq.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/seq.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/set.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/set.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/set.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/str.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/str.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/str.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/timestamp.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/timestamp.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/type/timestamp.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/yamlAST.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/yamlAST.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/src/yamlAST.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/characterSet.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/characterSet.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/characterSet.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/loader.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/loader.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/loader.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/mappings.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/mappings.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/mappings.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/multipleKinds.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/multipleKinds.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/multipleKinds.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/scalarInference.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/scalarInference.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/scalarInference.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/stability.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/stability.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/stability.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/tags.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/tags.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/tags.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/testUtil.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/testUtil.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/testUtil.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/visitor.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/visitor.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/visitor.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/yamlAST.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/yamlAST.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/yamlAST.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/yamlSyntax.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/yamlSyntax.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/dist/test/yamlSyntax.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/license.txt create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/common.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/dumper.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/exception.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/index.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/loader.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/mark.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/scalarInference.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/schema.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/schema/core.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/schema/default_full.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/schema/default_safe.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/schema/failsafe.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/schema/json.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/binary.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/bool.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/float.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/int.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/js/function.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/js/regexp.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/js/undefined.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/map.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/merge.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/null.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/omap.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/pairs.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/seq.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/set.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/str.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/type/timestamp.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/src/yamlAST.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server-parser/tsconfig.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/CHANGELOG.md create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/Dockerfile create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/LICENSE create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/README.md create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/bin/yaml-language-server create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/index.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/index.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/jsonASTTypes.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/jsonASTTypes.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/jsonASTTypes.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/jsonSchema.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/jsonSchema.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/jsonSchema.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/isKubernetes.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/isKubernetes.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/isKubernetes.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/jsonParser07.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/jsonParser07.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/jsonParser07.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/recursivelyBuildAst.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/recursivelyBuildAst.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/recursivelyBuildAst.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/scalar-type.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/scalar-type.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/scalar-type.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/yamlParser07.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/yamlParser07.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/parser/yamlParser07.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/documentSymbols.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/documentSymbols.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/documentSymbols.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/schemaRequestHandler.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/schemaRequestHandler.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/schemaRequestHandler.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCompletion.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCompletion.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCompletion.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlFormatter.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlFormatter.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlFormatter.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlHover.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlHover.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlHover.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlLinks.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlLinks.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlLinks.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlSchemaService.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlSchemaService.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlSchemaService.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlValidation.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlValidation.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/services/yamlValidation.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/arrUtils.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/arrUtils.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/arrUtils.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/charCode.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/charCode.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/charCode.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/documentPositionCalculator.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/documentPositionCalculator.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/documentPositionCalculator.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/indentationGuesser.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/indentationGuesser.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/indentationGuesser.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/json.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/json.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/json.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/objects.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/objects.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/objects.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/parseUtils.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/parseUtils.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/parseUtils.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/paths.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/paths.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/paths.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/schemaUrls.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/schemaUrls.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/schemaUrls.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/strings.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/strings.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/strings.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/textBuffer.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/textBuffer.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/utils/textBuffer.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/yamlLanguageService.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/yamlLanguageService.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/languageservice/yamlLanguageService.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/requestTypes.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/requestTypes.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/requestTypes.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/server.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/server.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/esm/server.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/index.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/index.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/jsonASTTypes.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/jsonASTTypes.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/jsonASTTypes.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/jsonSchema.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/jsonSchema.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/jsonSchema.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/isKubernetes.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/isKubernetes.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/isKubernetes.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/jsonParser07.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/jsonParser07.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/jsonParser07.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/recursivelyBuildAst.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/recursivelyBuildAst.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/recursivelyBuildAst.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/scalar-type.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/scalar-type.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/scalar-type.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/yamlParser07.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/yamlParser07.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/parser/yamlParser07.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/documentSymbols.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/documentSymbols.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/documentSymbols.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/schemaRequestHandler.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/schemaRequestHandler.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/schemaRequestHandler.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlCompletion.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlCompletion.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlCompletion.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlFormatter.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlFormatter.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlFormatter.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlHover.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlHover.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlHover.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlLinks.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlLinks.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlLinks.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlSchemaService.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlSchemaService.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlSchemaService.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlValidation.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlValidation.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/services/yamlValidation.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/arrUtils.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/arrUtils.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/arrUtils.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/charCode.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/charCode.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/charCode.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/documentPositionCalculator.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/documentPositionCalculator.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/documentPositionCalculator.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/indentationGuesser.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/indentationGuesser.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/indentationGuesser.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/json.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/json.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/json.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/objects.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/objects.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/objects.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/parseUtils.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/parseUtils.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/parseUtils.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/paths.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/paths.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/paths.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/schemaUrls.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/schemaUrls.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/schemaUrls.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/strings.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/strings.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/strings.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/textBuffer.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/textBuffer.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/utils/textBuffer.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/yamlLanguageService.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/yamlLanguageService.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/languageservice/yamlLanguageService.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/requestTypes.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/requestTypes.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/requestTypes.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/server.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/server.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/lib/umd/server.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/index.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/index.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/index.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/jsonASTTypes.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/jsonASTTypes.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/jsonASTTypes.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/jsonSchema.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/jsonSchema.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/jsonSchema.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/isKubernetes.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/isKubernetes.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/isKubernetes.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/jsonParser07.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/jsonParser07.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/jsonParser07.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/recursivelyBuildAst.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/recursivelyBuildAst.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/recursivelyBuildAst.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/scalar-type.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/scalar-type.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/scalar-type.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/yamlParser07.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/yamlParser07.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/parser/yamlParser07.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/documentSymbols.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/documentSymbols.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/documentSymbols.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/schemaRequestHandler.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/schemaRequestHandler.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/schemaRequestHandler.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlCompletion.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlCompletion.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlCompletion.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlFormatter.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlFormatter.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlFormatter.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlHover.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlHover.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlHover.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlLinks.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlLinks.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlLinks.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlSchemaService.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlSchemaService.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlSchemaService.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlValidation.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlValidation.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/services/yamlValidation.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/arrUtils.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/arrUtils.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/arrUtils.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/charCode.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/charCode.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/charCode.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/documentPositionCalculator.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/documentPositionCalculator.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/documentPositionCalculator.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/indentationGuesser.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/indentationGuesser.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/indentationGuesser.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/json.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/json.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/json.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/objects.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/objects.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/objects.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/parseUtils.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/parseUtils.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/parseUtils.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/paths.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/paths.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/paths.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/schemaUrls.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/schemaUrls.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/schemaUrls.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/strings.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/strings.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/strings.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/textBuffer.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/textBuffer.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/utils/textBuffer.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/yamlLanguageService.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/yamlLanguageService.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/languageservice/yamlLanguageService.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/requestTypes.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/requestTypes.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/requestTypes.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/server.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/server.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/src/server.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/arrUtils.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/arrUtils.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/arrUtils.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/autoCompletion.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/autoCompletion.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/autoCompletion.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/customTags.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/customTags.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/customTags.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/defaultSnippets.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/defaultSnippets.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/defaultSnippets.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/documentPositionCalculator.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/documentPositionCalculator.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/documentPositionCalculator.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/documentSymbols.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/documentSymbols.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/documentSymbols.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/findLinks.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/findLinks.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/findLinks.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/formatter.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/formatter.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/formatter.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/hover.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/hover.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/hover.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/integration.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/integration.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/integration.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/jsonParser.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/jsonParser.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/jsonParser.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/mulipleDocuments.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/mulipleDocuments.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/mulipleDocuments.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/objects.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/objects.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/objects.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/paths.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/paths.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/paths.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/schema.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/schema.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/schema.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/schemaRequestHandler.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/schemaRequestHandler.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/schemaRequestHandler.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/schemaValidation.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/schemaValidation.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/schemaValidation.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/strings.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/strings.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/strings.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/textBuffer.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/textBuffer.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/textBuffer.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/utils/errorMessages.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/utils/errorMessages.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/utils/errorMessages.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/utils/serviceSetup.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/utils/serviceSetup.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/utils/serviceSetup.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/utils/testHelper.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/utils/testHelper.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/utils/testHelper.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/utils/verifyError.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/utils/verifyError.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/utils/verifyError.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/yamlParser.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/yamlParser.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/yamlParser.test.js.map create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/yamlSchema.test.d.ts create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/yamlSchema.test.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/out/server/test/yamlSchema.test.js.map create mode 100755 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/package.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/scripts/check-dependencies.js create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/tsconfig.esm.json create mode 100644 coc/extensions/node_modules/coc-yaml/node_modules/yaml-language-server/tsconfig.umd.json create mode 100644 coc/extensions/node_modules/coc-yaml/package-lock.json create mode 100644 coc/extensions/node_modules/coc-yaml/package.json create mode 100644 coc/extensions/package.json create mode 100644 coc/list-commands-history.json create mode 100644 coc/list-extensions-history.json create mode 100644 coc/memos.json create mode 100644 coc/mru diff --git a/coc/commands b/coc/commands new file mode 100644 index 0000000..812dad3 --- /dev/null +++ b/coc/commands @@ -0,0 +1 @@ +extensions.forceUpdateAll \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-clangd/LICENSE b/coc/extensions/node_modules/coc-clangd/LICENSE new file mode 100644 index 0000000..f9dc506 --- /dev/null +++ b/coc/extensions/node_modules/coc-clangd/LICENSE @@ -0,0 +1,219 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + + +--- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. + diff --git a/coc/extensions/node_modules/coc-clangd/README.md b/coc/extensions/node_modules/coc-clangd/README.md new file mode 100644 index 0000000..58bdbc1 --- /dev/null +++ b/coc/extensions/node_modules/coc-clangd/README.md @@ -0,0 +1,70 @@ +# coc-clangd + +This extension connects [coc.nvim][] to the [clangd][] language server. + +## Quick Start + +1. install [Node.js][]. `coc.nvim` and `coc-clangd` run on Node.js. +1. install `coc.nvim`. Instructions using `vim-plug` (check out [coc.nvim Wiki][] other options): + - add to `.vimrc`: `vim Plug 'neoclide/coc.nvim', {'branch': 'release'}` + - in vim, run `:PlugInstall` +1. in vim, run `:CocInstall coc-clangd` +1. `coc-clangd` will try to find `clangd` from your `$PATH`, if not found, you can run `:CocCommand clangd.install` to install the [latest release][] from GitHub +1. follow [Project setup][] to generate `compile_commands.json` for your project + +> **Note**: If you've configured `clangd` as a languageServer in `coc-settings.json`, you should remove it to avoid running clangd twice! + +## Protocol extensions + +`clangd` supports some [extensions][] that are not in the official [Language Server Protocol specification][lsp]. + +`coc-clangd` adds support for: + +- Switching between header and implementation file: `:CocCommand clangd.switchSourceHeader` +- File status monitor, shows on NeoVim statusline +- Describe symbol under the cursor: `:CocCommand clangd.symbolInfo` +- Completions that adjust text near the cursor (e.g. correcting `.` to `->`) + +## Configurations + +`:CocConfig` opens your global `coc-settings.json`, or `:CocLocalConfig` opens local configuration in your project `.vim/coc-settings.json`. + +| Configurations | Description | Default | +| -- | -- | -- | +| clangd.enabled | enable `coc-clangd` | `true` | +| clangd.arguments | arguments for `clangd` server | `[]` | +| clangd.checkUpdates | check for clangd language server updates on startup | `false` | +| clangd.disableCompletion | disable completion source from clangd | `false` | +| clangd.disableDiagnostics | disable diagnostics from clangd | `false` | +| clangd.disableSnippetCompletion | disable completion snippet from clangd | `false` | +| clangd.compilationDatabasePath | specifies the directory containing the compilation database | `''` | +| clangd.fallbackFlags | extra clang flags used to parse files when no compilation database is found | `[]` | +| clangd.path | path to `clangd` executable | `clangd` | +| clangd.semanticHighlighting | enable semantic highlighting, requires [jackguo380/vim-lsp-cxx-highlight](https://github.com/jackguo380/vim-lsp-cxx-highlight) to work | `false` | +| clangd.serverCompletionRanking | always rank compilation items on the server as you type | `true` | + +## Commands + +- `clangd.switchSourceHeader`: switch between source/header files +- `clangd.symbolInfo`: resolve symbol info under the cursor +- `clangd.install`: install latest clangd release from GitHub +- `clangd.update`: check for updates to clangd from GitHub + +## License + +Apache 2.0 with LLVM Exception + +This is the [standard LLVM license](https://llvm.org/foundation/relicensing/). + +--- + +> This extension is created by [create-coc-extension](https://github.com/fannheyward/create-coc-extension) + +[node.js]: https://nodejs.org/en/ +[clangd]: https://clangd.llvm.org/installation.html +[coc.nvim]: https://github.com/neoclide/coc.nvim +[coc.nvim wiki]: https://github.com/neoclide/coc.nvim/wiki/Install-coc.nvim +[lsp]: https://microsoft.github.io/language-server-protocol/specification +[extensions]: https://clangd.llvm.org/extensions.html +[latest release]: https://github.com/clangd/clangd/releases +[project setup]: https://clangd.llvm.org/installation.html#project-setup diff --git a/coc/extensions/node_modules/coc-clangd/esbuild.js b/coc/extensions/node_modules/coc-clangd/esbuild.js new file mode 100644 index 0000000..e3cd5d0 --- /dev/null +++ b/coc/extensions/node_modules/coc-clangd/esbuild.js @@ -0,0 +1,33 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +async function start(watch) { + await require('esbuild').build({ + entryPoints: ['src/index.ts'], + bundle: true, + watch, + minify: process.env.NODE_ENV === 'production', + sourcemap: process.env.NODE_ENV === 'development', + mainFields: ['module', 'main'], + external: ['coc.nvim'], + platform: 'node', + target: 'node10.12', + outfile: 'lib/index.js', + }); +} + +let watch = false; +if (process.argv.length > 2 && process.argv[2] === '--watch') { + console.log('watching...'); + watch = { + onRebuild(error) { + if (error) { + console.error('watch build failed:', error); + } else { + console.log('watch build succeeded'); + } + }, + }; +} + +start(watch).catch((e) => { + console.error(e); +}); diff --git a/coc/extensions/node_modules/coc-clangd/lib/index.js b/coc/extensions/node_modules/coc-clangd/lib/index.js new file mode 100644 index 0000000..273df2e --- /dev/null +++ b/coc/extensions/node_modules/coc-clangd/lib/index.js @@ -0,0 +1,26957 @@ +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __markAsModule = (target) => __defProp(target, "__esModule", {value: true}); +var __commonJS = (callback, module2) => () => { + if (!module2) { + module2 = {exports: {}}; + callback(module2.exports, module2); + } + return module2.exports; +}; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, {get: all[name], enumerable: true}); +}; +var __exportStar = (target, module2, desc) => { + if (module2 && typeof module2 === "object" || typeof module2 === "function") { + for (let key of __getOwnPropNames(module2)) + if (!__hasOwnProp.call(target, key) && key !== "default") + __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable}); + } + return target; +}; +var __toModule = (module2) => { + if (module2 && module2.__esModule) + return module2; + return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", {value: module2, enumerable: true})), module2); +}; + +// node_modules/vscode-jsonrpc/lib/common/ral.js +var require_ral = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + var _ral; + function RAL() { + if (_ral === void 0) { + throw new Error(`No runtime abstraction layer installed`); + } + return _ral; + } + (function(RAL2) { + function install2(ral) { + if (ral === void 0) { + throw new Error(`No runtime abstraction layer provided`); + } + _ral = ral; + } + RAL2.install = install2; + })(RAL || (RAL = {})); + exports2.default = RAL; +}); + +// node_modules/vscode-jsonrpc/lib/common/disposable.js +var require_disposable = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.Disposable = void 0; + var Disposable3; + (function(Disposable4) { + function create(func) { + return { + dispose: func + }; + } + Disposable4.create = create; + })(Disposable3 = exports2.Disposable || (exports2.Disposable = {})); +}); + +// node_modules/vscode-jsonrpc/lib/common/messageBuffer.js +var require_messageBuffer = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.AbstractMessageBuffer = void 0; + var CR = 13; + var LF = 10; + var CRLF = "\r\n"; + var AbstractMessageBuffer = class { + constructor(encoding = "utf-8") { + this._encoding = encoding; + this._chunks = []; + this._totalLength = 0; + } + get encoding() { + return this._encoding; + } + append(chunk) { + const toAppend = typeof chunk === "string" ? this.fromString(chunk, this._encoding) : chunk; + this._chunks.push(toAppend); + this._totalLength += toAppend.byteLength; + } + tryReadHeaders() { + if (this._chunks.length === 0) { + return void 0; + } + let state = 0; + let chunkIndex = 0; + let offset = 0; + let chunkBytesRead = 0; + row: + while (chunkIndex < this._chunks.length) { + const chunk = this._chunks[chunkIndex]; + offset = 0; + column: + while (offset < chunk.length) { + const value = chunk[offset]; + switch (value) { + case CR: + switch (state) { + case 0: + state = 1; + break; + case 2: + state = 3; + break; + default: + state = 0; + } + break; + case LF: + switch (state) { + case 1: + state = 2; + break; + case 3: + state = 4; + offset++; + break row; + default: + state = 0; + } + break; + default: + state = 0; + } + offset++; + } + chunkBytesRead += chunk.byteLength; + chunkIndex++; + } + if (state !== 4) { + return void 0; + } + const buffer = this._read(chunkBytesRead + offset); + const result = new Map(); + const headers = this.toString(buffer, "ascii").split(CRLF); + if (headers.length < 2) { + return result; + } + for (let i = 0; i < headers.length - 2; i++) { + const header = headers[i]; + const index = header.indexOf(":"); + if (index === -1) { + throw new Error("Message header must separate key and value using :"); + } + const key = header.substr(0, index); + const value = header.substr(index + 1).trim(); + result.set(key, value); + } + return result; + } + tryReadBody(length) { + if (this._totalLength < length) { + return void 0; + } + return this._read(length); + } + get numberOfBytes() { + return this._totalLength; + } + _read(byteCount) { + if (byteCount === 0) { + return this.emptyBuffer(); + } + if (byteCount > this._totalLength) { + throw new Error(`Cannot read so many bytes!`); + } + if (this._chunks[0].byteLength === byteCount) { + const chunk = this._chunks[0]; + this._chunks.shift(); + this._totalLength -= byteCount; + return this.asNative(chunk); + } + if (this._chunks[0].byteLength > byteCount) { + const chunk = this._chunks[0]; + const result2 = this.asNative(chunk, byteCount); + this._chunks[0] = chunk.slice(byteCount); + this._totalLength -= byteCount; + return result2; + } + const result = this.allocNative(byteCount); + let resultOffset = 0; + let chunkIndex = 0; + while (byteCount > 0) { + const chunk = this._chunks[chunkIndex]; + if (chunk.byteLength > byteCount) { + const chunkPart = chunk.slice(0, byteCount); + result.set(chunkPart, resultOffset); + resultOffset += byteCount; + this._chunks[chunkIndex] = chunk.slice(byteCount); + this._totalLength -= byteCount; + byteCount -= byteCount; + } else { + result.set(chunk, resultOffset); + resultOffset += chunk.byteLength; + this._chunks.shift(); + this._totalLength -= chunk.byteLength; + byteCount -= chunk.byteLength; + } + } + return result; + } + }; + exports2.AbstractMessageBuffer = AbstractMessageBuffer; +}); + +// node_modules/vscode-jsonrpc/lib/node/ril.js +var require_ril = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + var ral_1 = require_ral(); + var util_1 = require("util"); + var disposable_1 = require_disposable(); + var messageBuffer_1 = require_messageBuffer(); + var MessageBuffer = class extends messageBuffer_1.AbstractMessageBuffer { + constructor(encoding = "utf-8") { + super(encoding); + } + emptyBuffer() { + return MessageBuffer.emptyBuffer; + } + fromString(value, encoding) { + return Buffer.from(value, encoding); + } + toString(value, encoding) { + if (value instanceof Buffer) { + return value.toString(encoding); + } else { + return new util_1.TextDecoder(encoding).decode(value); + } + } + asNative(buffer, length) { + if (length === void 0) { + return buffer instanceof Buffer ? buffer : Buffer.from(buffer); + } else { + return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length); + } + } + allocNative(length) { + return Buffer.allocUnsafe(length); + } + }; + MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0); + var ReadableStreamWrapper = class { + constructor(stream) { + this.stream = stream; + } + onClose(listener) { + this.stream.on("close", listener); + return disposable_1.Disposable.create(() => this.stream.off("close", listener)); + } + onError(listener) { + this.stream.on("error", listener); + return disposable_1.Disposable.create(() => this.stream.off("error", listener)); + } + onEnd(listener) { + this.stream.on("end", listener); + return disposable_1.Disposable.create(() => this.stream.off("end", listener)); + } + onData(listener) { + this.stream.on("data", listener); + return disposable_1.Disposable.create(() => this.stream.off("data", listener)); + } + }; + var WritableStreamWrapper = class { + constructor(stream) { + this.stream = stream; + } + onClose(listener) { + this.stream.on("close", listener); + return disposable_1.Disposable.create(() => this.stream.off("close", listener)); + } + onError(listener) { + this.stream.on("error", listener); + return disposable_1.Disposable.create(() => this.stream.off("error", listener)); + } + onEnd(listener) { + this.stream.on("end", listener); + return disposable_1.Disposable.create(() => this.stream.off("end", listener)); + } + write(data, encoding) { + return new Promise((resolve, reject) => { + const callback = (error) => { + if (error === void 0 || error === null) { + resolve(); + } else { + reject(error); + } + }; + if (typeof data === "string") { + this.stream.write(data, encoding, callback); + } else { + this.stream.write(data, callback); + } + }); + } + end() { + this.stream.end(); + } + }; + var _ril = Object.freeze({ + messageBuffer: Object.freeze({ + create: (encoding) => new MessageBuffer(encoding) + }), + applicationJson: Object.freeze({ + encoder: Object.freeze({ + name: "application/json", + encode: (msg, options) => { + try { + return Promise.resolve(Buffer.from(JSON.stringify(msg, void 0, 0), options.charset)); + } catch (err) { + return Promise.reject(err); + } + } + }), + decoder: Object.freeze({ + name: "application/json", + decode: (buffer, options) => { + try { + if (buffer instanceof Buffer) { + return Promise.resolve(JSON.parse(buffer.toString(options.charset))); + } else { + return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer))); + } + } catch (err) { + return Promise.reject(err); + } + } + }) + }), + stream: Object.freeze({ + asReadableStream: (stream) => new ReadableStreamWrapper(stream), + asWritableStream: (stream) => new WritableStreamWrapper(stream) + }), + console, + timer: Object.freeze({ + setTimeout(callback, ms, ...args) { + return setTimeout(callback, ms, ...args); + }, + clearTimeout(handle) { + clearTimeout(handle); + }, + setImmediate(callback, ...args) { + return setImmediate(callback, ...args); + }, + clearImmediate(handle) { + clearImmediate(handle); + } + }) + }); + function RIL() { + return _ril; + } + (function(RIL2) { + function install2() { + ral_1.default.install(_ril); + } + RIL2.install = install2; + })(RIL || (RIL = {})); + exports2.default = RIL; +}); + +// node_modules/vscode-jsonrpc/lib/common/is.js +var require_is = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0; + function boolean(value) { + return value === true || value === false; + } + exports2.boolean = boolean; + function string(value) { + return typeof value === "string" || value instanceof String; + } + exports2.string = string; + function number(value) { + return typeof value === "number" || value instanceof Number; + } + exports2.number = number; + function error(value) { + return value instanceof Error; + } + exports2.error = error; + function func(value) { + return typeof value === "function"; + } + exports2.func = func; + function array(value) { + return Array.isArray(value); + } + exports2.array = array; + function stringArray(value) { + return array(value) && value.every((elem) => string(elem)); + } + exports2.stringArray = stringArray; +}); + +// node_modules/vscode-jsonrpc/lib/common/messages.js +var require_messages = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.isResponseMessage = exports2.isNotificationMessage = exports2.isRequestMessage = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType = exports2.RequestType0 = exports2.AbstractMessageSignature = exports2.ParameterStructures = exports2.ResponseError = exports2.ErrorCodes = void 0; + var is = require_is(); + var ErrorCodes; + (function(ErrorCodes2) { + ErrorCodes2.ParseError = -32700; + ErrorCodes2.InvalidRequest = -32600; + ErrorCodes2.MethodNotFound = -32601; + ErrorCodes2.InvalidParams = -32602; + ErrorCodes2.InternalError = -32603; + ErrorCodes2.jsonrpcReservedErrorRangeStart = -32099; + ErrorCodes2.serverErrorStart = ErrorCodes2.jsonrpcReservedErrorRangeStart; + ErrorCodes2.MessageWriteError = -32099; + ErrorCodes2.MessageReadError = -32098; + ErrorCodes2.ServerNotInitialized = -32002; + ErrorCodes2.UnknownErrorCode = -32001; + ErrorCodes2.jsonrpcReservedErrorRangeEnd = -32e3; + ErrorCodes2.serverErrorEnd = ErrorCodes2.jsonrpcReservedErrorRangeEnd; + })(ErrorCodes = exports2.ErrorCodes || (exports2.ErrorCodes = {})); + var ResponseError = class extends Error { + constructor(code, message, data) { + super(message); + this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode; + this.data = data; + Object.setPrototypeOf(this, ResponseError.prototype); + } + toJson() { + return { + code: this.code, + message: this.message, + data: this.data + }; + } + }; + exports2.ResponseError = ResponseError; + var ParameterStructures = class { + constructor(kind) { + this.kind = kind; + } + static is(value) { + return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition; + } + toString() { + return this.kind; + } + }; + exports2.ParameterStructures = ParameterStructures; + ParameterStructures.auto = new ParameterStructures("auto"); + ParameterStructures.byPosition = new ParameterStructures("byPosition"); + ParameterStructures.byName = new ParameterStructures("byName"); + var AbstractMessageSignature = class { + constructor(method, numberOfParams) { + this.method = method; + this.numberOfParams = numberOfParams; + } + get parameterStructures() { + return ParameterStructures.auto; + } + }; + exports2.AbstractMessageSignature = AbstractMessageSignature; + var RequestType0 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 0); + } + }; + exports2.RequestType0 = RequestType0; + var RequestType2 = class extends AbstractMessageSignature { + constructor(method, _parameterStructures = ParameterStructures.auto) { + super(method, 1); + this._parameterStructures = _parameterStructures; + } + get parameterStructures() { + return this._parameterStructures; + } + }; + exports2.RequestType = RequestType2; + var RequestType1 = class extends AbstractMessageSignature { + constructor(method, _parameterStructures = ParameterStructures.auto) { + super(method, 1); + this._parameterStructures = _parameterStructures; + } + get parameterStructures() { + return this._parameterStructures; + } + }; + exports2.RequestType1 = RequestType1; + var RequestType22 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 2); + } + }; + exports2.RequestType2 = RequestType22; + var RequestType3 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 3); + } + }; + exports2.RequestType3 = RequestType3; + var RequestType4 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 4); + } + }; + exports2.RequestType4 = RequestType4; + var RequestType5 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 5); + } + }; + exports2.RequestType5 = RequestType5; + var RequestType6 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 6); + } + }; + exports2.RequestType6 = RequestType6; + var RequestType7 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 7); + } + }; + exports2.RequestType7 = RequestType7; + var RequestType8 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 8); + } + }; + exports2.RequestType8 = RequestType8; + var RequestType9 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 9); + } + }; + exports2.RequestType9 = RequestType9; + var NotificationType2 = class extends AbstractMessageSignature { + constructor(method, _parameterStructures = ParameterStructures.auto) { + super(method, 1); + this._parameterStructures = _parameterStructures; + } + get parameterStructures() { + return this._parameterStructures; + } + }; + exports2.NotificationType = NotificationType2; + var NotificationType0 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 0); + } + }; + exports2.NotificationType0 = NotificationType0; + var NotificationType1 = class extends AbstractMessageSignature { + constructor(method, _parameterStructures = ParameterStructures.auto) { + super(method, 1); + this._parameterStructures = _parameterStructures; + } + get parameterStructures() { + return this._parameterStructures; + } + }; + exports2.NotificationType1 = NotificationType1; + var NotificationType22 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 2); + } + }; + exports2.NotificationType2 = NotificationType22; + var NotificationType3 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 3); + } + }; + exports2.NotificationType3 = NotificationType3; + var NotificationType4 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 4); + } + }; + exports2.NotificationType4 = NotificationType4; + var NotificationType5 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 5); + } + }; + exports2.NotificationType5 = NotificationType5; + var NotificationType6 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 6); + } + }; + exports2.NotificationType6 = NotificationType6; + var NotificationType7 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 7); + } + }; + exports2.NotificationType7 = NotificationType7; + var NotificationType8 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 8); + } + }; + exports2.NotificationType8 = NotificationType8; + var NotificationType9 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 9); + } + }; + exports2.NotificationType9 = NotificationType9; + function isRequestMessage(message) { + const candidate = message; + return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id)); + } + exports2.isRequestMessage = isRequestMessage; + function isNotificationMessage(message) { + const candidate = message; + return candidate && is.string(candidate.method) && message.id === void 0; + } + exports2.isNotificationMessage = isNotificationMessage; + function isResponseMessage(message) { + const candidate = message; + return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null); + } + exports2.isResponseMessage = isResponseMessage; +}); + +// node_modules/vscode-jsonrpc/lib/common/events.js +var require_events = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.Emitter = exports2.Event = void 0; + var ral_1 = require_ral(); + var Event3; + (function(Event4) { + const _disposable = {dispose() { + }}; + Event4.None = function() { + return _disposable; + }; + })(Event3 = exports2.Event || (exports2.Event = {})); + var CallbackList = class { + add(callback, context = null, bucket) { + if (!this._callbacks) { + this._callbacks = []; + this._contexts = []; + } + this._callbacks.push(callback); + this._contexts.push(context); + if (Array.isArray(bucket)) { + bucket.push({dispose: () => this.remove(callback, context)}); + } + } + remove(callback, context = null) { + if (!this._callbacks) { + return; + } + let foundCallbackWithDifferentContext = false; + for (let i = 0, len = this._callbacks.length; i < len; i++) { + if (this._callbacks[i] === callback) { + if (this._contexts[i] === context) { + this._callbacks.splice(i, 1); + this._contexts.splice(i, 1); + return; + } else { + foundCallbackWithDifferentContext = true; + } + } + } + if (foundCallbackWithDifferentContext) { + throw new Error("When adding a listener with a context, you should remove it with the same context"); + } + } + invoke(...args) { + if (!this._callbacks) { + return []; + } + const ret2 = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0); + for (let i = 0, len = callbacks.length; i < len; i++) { + try { + ret2.push(callbacks[i].apply(contexts[i], args)); + } catch (e) { + ral_1.default().console.error(e); + } + } + return ret2; + } + isEmpty() { + return !this._callbacks || this._callbacks.length === 0; + } + dispose() { + this._callbacks = void 0; + this._contexts = void 0; + } + }; + var Emitter = class { + constructor(_options) { + this._options = _options; + } + get event() { + if (!this._event) { + this._event = (listener, thisArgs, disposables) => { + if (!this._callbacks) { + this._callbacks = new CallbackList(); + } + if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) { + this._options.onFirstListenerAdd(this); + } + this._callbacks.add(listener, thisArgs); + const result = { + dispose: () => { + if (!this._callbacks) { + return; + } + this._callbacks.remove(listener, thisArgs); + result.dispose = Emitter._noop; + if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) { + this._options.onLastListenerRemove(this); + } + } + }; + if (Array.isArray(disposables)) { + disposables.push(result); + } + return result; + }; + } + return this._event; + } + fire(event) { + if (this._callbacks) { + this._callbacks.invoke.call(this._callbacks, event); + } + } + dispose() { + if (this._callbacks) { + this._callbacks.dispose(); + this._callbacks = void 0; + } + } + }; + exports2.Emitter = Emitter; + Emitter._noop = function() { + }; +}); + +// node_modules/vscode-jsonrpc/lib/common/cancellation.js +var require_cancellation = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.CancellationTokenSource = exports2.CancellationToken = void 0; + var ral_1 = require_ral(); + var Is = require_is(); + var events_1 = require_events(); + var CancellationToken; + (function(CancellationToken2) { + CancellationToken2.None = Object.freeze({ + isCancellationRequested: false, + onCancellationRequested: events_1.Event.None + }); + CancellationToken2.Cancelled = Object.freeze({ + isCancellationRequested: true, + onCancellationRequested: events_1.Event.None + }); + function is(value) { + const candidate = value; + return candidate && (candidate === CancellationToken2.None || candidate === CancellationToken2.Cancelled || Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested); + } + CancellationToken2.is = is; + })(CancellationToken = exports2.CancellationToken || (exports2.CancellationToken = {})); + var shortcutEvent = Object.freeze(function(callback, context) { + const handle = ral_1.default().timer.setTimeout(callback.bind(context), 0); + return {dispose() { + ral_1.default().timer.clearTimeout(handle); + }}; + }); + var MutableToken = class { + constructor() { + this._isCancelled = false; + } + cancel() { + if (!this._isCancelled) { + this._isCancelled = true; + if (this._emitter) { + this._emitter.fire(void 0); + this.dispose(); + } + } + } + get isCancellationRequested() { + return this._isCancelled; + } + get onCancellationRequested() { + if (this._isCancelled) { + return shortcutEvent; + } + if (!this._emitter) { + this._emitter = new events_1.Emitter(); + } + return this._emitter.event; + } + dispose() { + if (this._emitter) { + this._emitter.dispose(); + this._emitter = void 0; + } + } + }; + var CancellationTokenSource = class { + get token() { + if (!this._token) { + this._token = new MutableToken(); + } + return this._token; + } + cancel() { + if (!this._token) { + this._token = CancellationToken.Cancelled; + } else { + this._token.cancel(); + } + } + dispose() { + if (!this._token) { + this._token = CancellationToken.None; + } else if (this._token instanceof MutableToken) { + this._token.dispose(); + } + } + }; + exports2.CancellationTokenSource = CancellationTokenSource; +}); + +// node_modules/vscode-jsonrpc/lib/common/messageReader.js +var require_messageReader = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = void 0; + var ral_1 = require_ral(); + var Is = require_is(); + var events_1 = require_events(); + var MessageReader; + (function(MessageReader2) { + function is(value) { + let candidate = value; + return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) && Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage); + } + MessageReader2.is = is; + })(MessageReader = exports2.MessageReader || (exports2.MessageReader = {})); + var AbstractMessageReader = class { + constructor() { + this.errorEmitter = new events_1.Emitter(); + this.closeEmitter = new events_1.Emitter(); + this.partialMessageEmitter = new events_1.Emitter(); + } + dispose() { + this.errorEmitter.dispose(); + this.closeEmitter.dispose(); + } + get onError() { + return this.errorEmitter.event; + } + fireError(error) { + this.errorEmitter.fire(this.asError(error)); + } + get onClose() { + return this.closeEmitter.event; + } + fireClose() { + this.closeEmitter.fire(void 0); + } + get onPartialMessage() { + return this.partialMessageEmitter.event; + } + firePartialMessage(info) { + this.partialMessageEmitter.fire(info); + } + asError(error) { + if (error instanceof Error) { + return error; + } else { + return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : "unknown"}`); + } + } + }; + exports2.AbstractMessageReader = AbstractMessageReader; + var ResolvedMessageReaderOptions; + (function(ResolvedMessageReaderOptions2) { + function fromOptions(options) { + var _a; + let charset; + let result; + let contentDecoder; + const contentDecoders = new Map(); + let contentTypeDecoder; + const contentTypeDecoders = new Map(); + if (options === void 0 || typeof options === "string") { + charset = options !== null && options !== void 0 ? options : "utf-8"; + } else { + charset = (_a = options.charset) !== null && _a !== void 0 ? _a : "utf-8"; + if (options.contentDecoder !== void 0) { + contentDecoder = options.contentDecoder; + contentDecoders.set(contentDecoder.name, contentDecoder); + } + if (options.contentDecoders !== void 0) { + for (const decoder of options.contentDecoders) { + contentDecoders.set(decoder.name, decoder); + } + } + if (options.contentTypeDecoder !== void 0) { + contentTypeDecoder = options.contentTypeDecoder; + contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); + } + if (options.contentTypeDecoders !== void 0) { + for (const decoder of options.contentTypeDecoders) { + contentTypeDecoders.set(decoder.name, decoder); + } + } + } + if (contentTypeDecoder === void 0) { + contentTypeDecoder = ral_1.default().applicationJson.decoder; + contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); + } + return {charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders}; + } + ResolvedMessageReaderOptions2.fromOptions = fromOptions; + })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {})); + var ReadableStreamMessageReader = class extends AbstractMessageReader { + constructor(readable, options) { + super(); + this.readable = readable; + this.options = ResolvedMessageReaderOptions.fromOptions(options); + this.buffer = ral_1.default().messageBuffer.create(this.options.charset); + this._partialMessageTimeout = 1e4; + this.nextMessageLength = -1; + this.messageToken = 0; + } + set partialMessageTimeout(timeout) { + this._partialMessageTimeout = timeout; + } + get partialMessageTimeout() { + return this._partialMessageTimeout; + } + listen(callback) { + this.nextMessageLength = -1; + this.messageToken = 0; + this.partialMessageTimer = void 0; + this.callback = callback; + const result = this.readable.onData((data) => { + this.onData(data); + }); + this.readable.onError((error) => this.fireError(error)); + this.readable.onClose(() => this.fireClose()); + return result; + } + onData(data) { + this.buffer.append(data); + while (true) { + if (this.nextMessageLength === -1) { + const headers = this.buffer.tryReadHeaders(); + if (!headers) { + return; + } + const contentLength = headers.get("Content-Length"); + if (!contentLength) { + throw new Error("Header must provide a Content-Length property."); + } + const length = parseInt(contentLength); + if (isNaN(length)) { + throw new Error("Content-Length value must be a number."); + } + this.nextMessageLength = length; + } + const body = this.buffer.tryReadBody(this.nextMessageLength); + if (body === void 0) { + this.setPartialMessageTimer(); + return; + } + this.clearPartialMessageTimer(); + this.nextMessageLength = -1; + let p; + if (this.options.contentDecoder !== void 0) { + p = this.options.contentDecoder.decode(body); + } else { + p = Promise.resolve(body); + } + p.then((value) => { + this.options.contentTypeDecoder.decode(value, this.options).then((msg) => { + this.callback(msg); + }, (error) => { + this.fireError(error); + }); + }, (error) => { + this.fireError(error); + }); + } + } + clearPartialMessageTimer() { + if (this.partialMessageTimer) { + ral_1.default().timer.clearTimeout(this.partialMessageTimer); + this.partialMessageTimer = void 0; + } + } + setPartialMessageTimer() { + this.clearPartialMessageTimer(); + if (this._partialMessageTimeout <= 0) { + return; + } + this.partialMessageTimer = ral_1.default().timer.setTimeout((token, timeout) => { + this.partialMessageTimer = void 0; + if (token === this.messageToken) { + this.firePartialMessage({messageToken: token, waitingTime: timeout}); + this.setPartialMessageTimer(); + } + }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout); + } + }; + exports2.ReadableStreamMessageReader = ReadableStreamMessageReader; +}); + +// node_modules/vscode-jsonrpc/lib/common/semaphore.js +var require_semaphore = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.Semaphore = void 0; + var ral_1 = require_ral(); + var Semaphore = class { + constructor(capacity = 1) { + if (capacity <= 0) { + throw new Error("Capacity must be greater than 0"); + } + this._capacity = capacity; + this._active = 0; + this._waiting = []; + } + lock(thunk) { + return new Promise((resolve, reject) => { + this._waiting.push({thunk, resolve, reject}); + this.runNext(); + }); + } + get active() { + return this._active; + } + runNext() { + if (this._waiting.length === 0 || this._active === this._capacity) { + return; + } + ral_1.default().timer.setImmediate(() => this.doRunNext()); + } + doRunNext() { + if (this._waiting.length === 0 || this._active === this._capacity) { + return; + } + const next = this._waiting.shift(); + this._active++; + if (this._active > this._capacity) { + throw new Error(`To many thunks active`); + } + try { + const result = next.thunk(); + if (result instanceof Promise) { + result.then((value) => { + this._active--; + next.resolve(value); + this.runNext(); + }, (err) => { + this._active--; + next.reject(err); + this.runNext(); + }); + } else { + this._active--; + next.resolve(result); + this.runNext(); + } + } catch (err) { + this._active--; + next.reject(err); + this.runNext(); + } + } + }; + exports2.Semaphore = Semaphore; +}); + +// node_modules/vscode-jsonrpc/lib/common/messageWriter.js +var require_messageWriter = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = void 0; + var ral_1 = require_ral(); + var Is = require_is(); + var semaphore_1 = require_semaphore(); + var events_1 = require_events(); + var ContentLength = "Content-Length: "; + var CRLF = "\r\n"; + var MessageWriter; + (function(MessageWriter2) { + function is(value) { + let candidate = value; + return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) && Is.func(candidate.onError) && Is.func(candidate.write); + } + MessageWriter2.is = is; + })(MessageWriter = exports2.MessageWriter || (exports2.MessageWriter = {})); + var AbstractMessageWriter = class { + constructor() { + this.errorEmitter = new events_1.Emitter(); + this.closeEmitter = new events_1.Emitter(); + } + dispose() { + this.errorEmitter.dispose(); + this.closeEmitter.dispose(); + } + get onError() { + return this.errorEmitter.event; + } + fireError(error, message, count) { + this.errorEmitter.fire([this.asError(error), message, count]); + } + get onClose() { + return this.closeEmitter.event; + } + fireClose() { + this.closeEmitter.fire(void 0); + } + asError(error) { + if (error instanceof Error) { + return error; + } else { + return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : "unknown"}`); + } + } + }; + exports2.AbstractMessageWriter = AbstractMessageWriter; + var ResolvedMessageWriterOptions; + (function(ResolvedMessageWriterOptions2) { + function fromOptions(options) { + var _a, _b; + if (options === void 0 || typeof options === "string") { + return {charset: options !== null && options !== void 0 ? options : "utf-8", contentTypeEncoder: ral_1.default().applicationJson.encoder}; + } else { + return {charset: (_a = options.charset) !== null && _a !== void 0 ? _a : "utf-8", contentEncoder: options.contentEncoder, contentTypeEncoder: (_b = options.contentTypeEncoder) !== null && _b !== void 0 ? _b : ral_1.default().applicationJson.encoder}; + } + } + ResolvedMessageWriterOptions2.fromOptions = fromOptions; + })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {})); + var WriteableStreamMessageWriter = class extends AbstractMessageWriter { + constructor(writable, options) { + super(); + this.writable = writable; + this.options = ResolvedMessageWriterOptions.fromOptions(options); + this.errorCount = 0; + this.writeSemaphore = new semaphore_1.Semaphore(1); + this.writable.onError((error) => this.fireError(error)); + this.writable.onClose(() => this.fireClose()); + } + async write(msg) { + return this.writeSemaphore.lock(async () => { + const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => { + if (this.options.contentEncoder !== void 0) { + return this.options.contentEncoder.encode(buffer); + } else { + return buffer; + } + }); + return payload.then((buffer) => { + const headers = []; + headers.push(ContentLength, buffer.byteLength.toString(), CRLF); + headers.push(CRLF); + return this.doWrite(msg, headers, buffer); + }, (error) => { + this.fireError(error); + throw error; + }); + }); + } + async doWrite(msg, headers, data) { + try { + await this.writable.write(headers.join(""), "ascii"); + return this.writable.write(data); + } catch (error) { + this.handleError(error, msg); + return Promise.reject(error); + } + } + handleError(error, msg) { + this.errorCount++; + this.fireError(error, msg, this.errorCount); + } + end() { + this.writable.end(); + } + }; + exports2.WriteableStreamMessageWriter = WriteableStreamMessageWriter; +}); + +// node_modules/vscode-jsonrpc/lib/common/linkedMap.js +var require_linkedMap = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.LRUCache = exports2.LinkedMap = exports2.Touch = void 0; + var Touch; + (function(Touch2) { + Touch2.None = 0; + Touch2.First = 1; + Touch2.AsOld = Touch2.First; + Touch2.Last = 2; + Touch2.AsNew = Touch2.Last; + })(Touch = exports2.Touch || (exports2.Touch = {})); + var LinkedMap = class { + constructor() { + this[Symbol.toStringTag] = "LinkedMap"; + this._map = new Map(); + this._head = void 0; + this._tail = void 0; + this._size = 0; + this._state = 0; + } + clear() { + this._map.clear(); + this._head = void 0; + this._tail = void 0; + this._size = 0; + this._state++; + } + isEmpty() { + return !this._head && !this._tail; + } + get size() { + return this._size; + } + get first() { + var _a; + return (_a = this._head) === null || _a === void 0 ? void 0 : _a.value; + } + get last() { + var _a; + return (_a = this._tail) === null || _a === void 0 ? void 0 : _a.value; + } + has(key) { + return this._map.has(key); + } + get(key, touch = Touch.None) { + const item = this._map.get(key); + if (!item) { + return void 0; + } + if (touch !== Touch.None) { + this.touch(item, touch); + } + return item.value; + } + set(key, value, touch = Touch.None) { + let item = this._map.get(key); + if (item) { + item.value = value; + if (touch !== Touch.None) { + this.touch(item, touch); + } + } else { + item = {key, value, next: void 0, previous: void 0}; + switch (touch) { + case Touch.None: + this.addItemLast(item); + break; + case Touch.First: + this.addItemFirst(item); + break; + case Touch.Last: + this.addItemLast(item); + break; + default: + this.addItemLast(item); + break; + } + this._map.set(key, item); + this._size++; + } + return this; + } + delete(key) { + return !!this.remove(key); + } + remove(key) { + const item = this._map.get(key); + if (!item) { + return void 0; + } + this._map.delete(key); + this.removeItem(item); + this._size--; + return item.value; + } + shift() { + if (!this._head && !this._tail) { + return void 0; + } + if (!this._head || !this._tail) { + throw new Error("Invalid list"); + } + const item = this._head; + this._map.delete(item.key); + this.removeItem(item); + this._size--; + return item.value; + } + forEach(callbackfn, thisArg) { + const state = this._state; + let current = this._head; + while (current) { + if (thisArg) { + callbackfn.bind(thisArg)(current.value, current.key, this); + } else { + callbackfn(current.value, current.key, this); + } + if (this._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + current = current.next; + } + } + keys() { + const map = this; + const state = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]() { + return iterator; + }, + next() { + if (map._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = {value: current.key, done: false}; + current = current.next; + return result; + } else { + return {value: void 0, done: true}; + } + } + }; + return iterator; + } + values() { + const map = this; + const state = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]() { + return iterator; + }, + next() { + if (map._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = {value: current.value, done: false}; + current = current.next; + return result; + } else { + return {value: void 0, done: true}; + } + } + }; + return iterator; + } + entries() { + const map = this; + const state = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]() { + return iterator; + }, + next() { + if (map._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = {value: [current.key, current.value], done: false}; + current = current.next; + return result; + } else { + return {value: void 0, done: true}; + } + } + }; + return iterator; + } + [Symbol.iterator]() { + return this.entries(); + } + trimOld(newSize) { + if (newSize >= this.size) { + return; + } + if (newSize === 0) { + this.clear(); + return; + } + let current = this._head; + let currentSize = this.size; + while (current && currentSize > newSize) { + this._map.delete(current.key); + current = current.next; + currentSize--; + } + this._head = current; + this._size = currentSize; + if (current) { + current.previous = void 0; + } + this._state++; + } + addItemFirst(item) { + if (!this._head && !this._tail) { + this._tail = item; + } else if (!this._head) { + throw new Error("Invalid list"); + } else { + item.next = this._head; + this._head.previous = item; + } + this._head = item; + this._state++; + } + addItemLast(item) { + if (!this._head && !this._tail) { + this._head = item; + } else if (!this._tail) { + throw new Error("Invalid list"); + } else { + item.previous = this._tail; + this._tail.next = item; + } + this._tail = item; + this._state++; + } + removeItem(item) { + if (item === this._head && item === this._tail) { + this._head = void 0; + this._tail = void 0; + } else if (item === this._head) { + if (!item.next) { + throw new Error("Invalid list"); + } + item.next.previous = void 0; + this._head = item.next; + } else if (item === this._tail) { + if (!item.previous) { + throw new Error("Invalid list"); + } + item.previous.next = void 0; + this._tail = item.previous; + } else { + const next = item.next; + const previous = item.previous; + if (!next || !previous) { + throw new Error("Invalid list"); + } + next.previous = previous; + previous.next = next; + } + item.next = void 0; + item.previous = void 0; + this._state++; + } + touch(item, touch) { + if (!this._head || !this._tail) { + throw new Error("Invalid list"); + } + if (touch !== Touch.First && touch !== Touch.Last) { + return; + } + if (touch === Touch.First) { + if (item === this._head) { + return; + } + const next = item.next; + const previous = item.previous; + if (item === this._tail) { + previous.next = void 0; + this._tail = previous; + } else { + next.previous = previous; + previous.next = next; + } + item.previous = void 0; + item.next = this._head; + this._head.previous = item; + this._head = item; + this._state++; + } else if (touch === Touch.Last) { + if (item === this._tail) { + return; + } + const next = item.next; + const previous = item.previous; + if (item === this._head) { + next.previous = void 0; + this._head = next; + } else { + next.previous = previous; + previous.next = next; + } + item.next = void 0; + item.previous = this._tail; + this._tail.next = item; + this._tail = item; + this._state++; + } + } + toJSON() { + const data = []; + this.forEach((value, key) => { + data.push([key, value]); + }); + return data; + } + fromJSON(data) { + this.clear(); + for (const [key, value] of data) { + this.set(key, value); + } + } + }; + exports2.LinkedMap = LinkedMap; + var LRUCache = class extends LinkedMap { + constructor(limit, ratio = 1) { + super(); + this._limit = limit; + this._ratio = Math.min(Math.max(0, ratio), 1); + } + get limit() { + return this._limit; + } + set limit(limit) { + this._limit = limit; + this.checkTrim(); + } + get ratio() { + return this._ratio; + } + set ratio(ratio) { + this._ratio = Math.min(Math.max(0, ratio), 1); + this.checkTrim(); + } + get(key, touch = Touch.AsNew) { + return super.get(key, touch); + } + peek(key) { + return super.get(key, Touch.None); + } + set(key, value) { + super.set(key, value, Touch.Last); + this.checkTrim(); + return this; + } + checkTrim() { + if (this.size > this._limit) { + this.trimOld(Math.round(this._limit * this._ratio)); + } + } + }; + exports2.LRUCache = LRUCache; +}); + +// node_modules/vscode-jsonrpc/lib/common/connection.js +var require_connection = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.createMessageConnection = exports2.ConnectionOptions = exports2.CancellationStrategy = exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.ConnectionStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.Trace = exports2.NullLogger = exports2.ProgressType = void 0; + var ral_1 = require_ral(); + var Is = require_is(); + var messages_1 = require_messages(); + var linkedMap_1 = require_linkedMap(); + var events_1 = require_events(); + var cancellation_1 = require_cancellation(); + var CancelNotification; + (function(CancelNotification2) { + CancelNotification2.type = new messages_1.NotificationType("$/cancelRequest"); + })(CancelNotification || (CancelNotification = {})); + var ProgressNotification; + (function(ProgressNotification2) { + ProgressNotification2.type = new messages_1.NotificationType("$/progress"); + })(ProgressNotification || (ProgressNotification = {})); + var ProgressType = class { + constructor() { + } + }; + exports2.ProgressType = ProgressType; + var StarRequestHandler; + (function(StarRequestHandler2) { + function is(value) { + return Is.func(value); + } + StarRequestHandler2.is = is; + })(StarRequestHandler || (StarRequestHandler = {})); + exports2.NullLogger = Object.freeze({ + error: () => { + }, + warn: () => { + }, + info: () => { + }, + log: () => { + } + }); + var Trace; + (function(Trace2) { + Trace2[Trace2["Off"] = 0] = "Off"; + Trace2[Trace2["Messages"] = 1] = "Messages"; + Trace2[Trace2["Verbose"] = 2] = "Verbose"; + })(Trace = exports2.Trace || (exports2.Trace = {})); + (function(Trace2) { + function fromString(value) { + if (!Is.string(value)) { + return Trace2.Off; + } + value = value.toLowerCase(); + switch (value) { + case "off": + return Trace2.Off; + case "messages": + return Trace2.Messages; + case "verbose": + return Trace2.Verbose; + default: + return Trace2.Off; + } + } + Trace2.fromString = fromString; + function toString(value) { + switch (value) { + case Trace2.Off: + return "off"; + case Trace2.Messages: + return "messages"; + case Trace2.Verbose: + return "verbose"; + default: + return "off"; + } + } + Trace2.toString = toString; + })(Trace = exports2.Trace || (exports2.Trace = {})); + var TraceFormat; + (function(TraceFormat2) { + TraceFormat2["Text"] = "text"; + TraceFormat2["JSON"] = "json"; + })(TraceFormat = exports2.TraceFormat || (exports2.TraceFormat = {})); + (function(TraceFormat2) { + function fromString(value) { + value = value.toLowerCase(); + if (value === "json") { + return TraceFormat2.JSON; + } else { + return TraceFormat2.Text; + } + } + TraceFormat2.fromString = fromString; + })(TraceFormat = exports2.TraceFormat || (exports2.TraceFormat = {})); + var SetTraceNotification; + (function(SetTraceNotification2) { + SetTraceNotification2.type = new messages_1.NotificationType("$/setTrace"); + })(SetTraceNotification = exports2.SetTraceNotification || (exports2.SetTraceNotification = {})); + var LogTraceNotification; + (function(LogTraceNotification2) { + LogTraceNotification2.type = new messages_1.NotificationType("$/logTrace"); + })(LogTraceNotification = exports2.LogTraceNotification || (exports2.LogTraceNotification = {})); + var ConnectionErrors; + (function(ConnectionErrors2) { + ConnectionErrors2[ConnectionErrors2["Closed"] = 1] = "Closed"; + ConnectionErrors2[ConnectionErrors2["Disposed"] = 2] = "Disposed"; + ConnectionErrors2[ConnectionErrors2["AlreadyListening"] = 3] = "AlreadyListening"; + })(ConnectionErrors = exports2.ConnectionErrors || (exports2.ConnectionErrors = {})); + var ConnectionError = class extends Error { + constructor(code, message) { + super(message); + this.code = code; + Object.setPrototypeOf(this, ConnectionError.prototype); + } + }; + exports2.ConnectionError = ConnectionError; + var ConnectionStrategy; + (function(ConnectionStrategy2) { + function is(value) { + const candidate = value; + return candidate && Is.func(candidate.cancelUndispatched); + } + ConnectionStrategy2.is = is; + })(ConnectionStrategy = exports2.ConnectionStrategy || (exports2.ConnectionStrategy = {})); + var CancellationReceiverStrategy; + (function(CancellationReceiverStrategy2) { + CancellationReceiverStrategy2.Message = Object.freeze({ + createCancellationTokenSource(_) { + return new cancellation_1.CancellationTokenSource(); + } + }); + function is(value) { + const candidate = value; + return candidate && Is.func(candidate.createCancellationTokenSource); + } + CancellationReceiverStrategy2.is = is; + })(CancellationReceiverStrategy = exports2.CancellationReceiverStrategy || (exports2.CancellationReceiverStrategy = {})); + var CancellationSenderStrategy; + (function(CancellationSenderStrategy2) { + CancellationSenderStrategy2.Message = Object.freeze({ + sendCancellation(conn, id) { + conn.sendNotification(CancelNotification.type, {id}); + }, + cleanup(_) { + } + }); + function is(value) { + const candidate = value; + return candidate && Is.func(candidate.sendCancellation) && Is.func(candidate.cleanup); + } + CancellationSenderStrategy2.is = is; + })(CancellationSenderStrategy = exports2.CancellationSenderStrategy || (exports2.CancellationSenderStrategy = {})); + var CancellationStrategy; + (function(CancellationStrategy2) { + CancellationStrategy2.Message = Object.freeze({ + receiver: CancellationReceiverStrategy.Message, + sender: CancellationSenderStrategy.Message + }); + function is(value) { + const candidate = value; + return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender); + } + CancellationStrategy2.is = is; + })(CancellationStrategy = exports2.CancellationStrategy || (exports2.CancellationStrategy = {})); + var ConnectionOptions; + (function(ConnectionOptions2) { + function is(value) { + const candidate = value; + return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy)); + } + ConnectionOptions2.is = is; + })(ConnectionOptions = exports2.ConnectionOptions || (exports2.ConnectionOptions = {})); + var ConnectionState; + (function(ConnectionState2) { + ConnectionState2[ConnectionState2["New"] = 1] = "New"; + ConnectionState2[ConnectionState2["Listening"] = 2] = "Listening"; + ConnectionState2[ConnectionState2["Closed"] = 3] = "Closed"; + ConnectionState2[ConnectionState2["Disposed"] = 4] = "Disposed"; + })(ConnectionState || (ConnectionState = {})); + function createMessageConnection(messageReader, messageWriter, _logger, options) { + const logger = _logger !== void 0 ? _logger : exports2.NullLogger; + let sequenceNumber = 0; + let notificationSquenceNumber = 0; + let unknownResponseSquenceNumber = 0; + const version = "2.0"; + let starRequestHandler = void 0; + const requestHandlers = Object.create(null); + let starNotificationHandler = void 0; + const notificationHandlers = Object.create(null); + const progressHandlers = new Map(); + let timer; + let messageQueue = new linkedMap_1.LinkedMap(); + let responsePromises = Object.create(null); + let requestTokens = Object.create(null); + let trace = Trace.Off; + let traceFormat = TraceFormat.Text; + let tracer; + let state = ConnectionState.New; + const errorEmitter = new events_1.Emitter(); + const closeEmitter = new events_1.Emitter(); + const unhandledNotificationEmitter = new events_1.Emitter(); + const unhandledProgressEmitter = new events_1.Emitter(); + const disposeEmitter = new events_1.Emitter(); + const cancellationStrategy = options && options.cancellationStrategy ? options.cancellationStrategy : CancellationStrategy.Message; + function createRequestQueueKey(id) { + if (id === null) { + throw new Error(`Can't send requests with id null since the response can't be correlated.`); + } + return "req-" + id.toString(); + } + function createResponseQueueKey(id) { + if (id === null) { + return "res-unknown-" + (++unknownResponseSquenceNumber).toString(); + } else { + return "res-" + id.toString(); + } + } + function createNotificationQueueKey() { + return "not-" + (++notificationSquenceNumber).toString(); + } + function addMessageToQueue(queue, message) { + if (messages_1.isRequestMessage(message)) { + queue.set(createRequestQueueKey(message.id), message); + } else if (messages_1.isResponseMessage(message)) { + queue.set(createResponseQueueKey(message.id), message); + } else { + queue.set(createNotificationQueueKey(), message); + } + } + function cancelUndispatched(_message) { + return void 0; + } + function isListening() { + return state === ConnectionState.Listening; + } + function isClosed() { + return state === ConnectionState.Closed; + } + function isDisposed() { + return state === ConnectionState.Disposed; + } + function closeHandler() { + if (state === ConnectionState.New || state === ConnectionState.Listening) { + state = ConnectionState.Closed; + closeEmitter.fire(void 0); + } + } + function readErrorHandler(error) { + errorEmitter.fire([error, void 0, void 0]); + } + function writeErrorHandler(data) { + errorEmitter.fire(data); + } + messageReader.onClose(closeHandler); + messageReader.onError(readErrorHandler); + messageWriter.onClose(closeHandler); + messageWriter.onError(writeErrorHandler); + function triggerMessageQueue() { + if (timer || messageQueue.size === 0) { + return; + } + timer = ral_1.default().timer.setImmediate(() => { + timer = void 0; + processMessageQueue(); + }); + } + function processMessageQueue() { + if (messageQueue.size === 0) { + return; + } + const message = messageQueue.shift(); + try { + if (messages_1.isRequestMessage(message)) { + handleRequest(message); + } else if (messages_1.isNotificationMessage(message)) { + handleNotification(message); + } else if (messages_1.isResponseMessage(message)) { + handleResponse(message); + } else { + handleInvalidMessage(message); + } + } finally { + triggerMessageQueue(); + } + } + const callback = (message) => { + try { + if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) { + const key = createRequestQueueKey(message.params.id); + const toCancel = messageQueue.get(key); + if (messages_1.isRequestMessage(toCancel)) { + const strategy = options === null || options === void 0 ? void 0 : options.connectionStrategy; + const response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel); + if (response && (response.error !== void 0 || response.result !== void 0)) { + messageQueue.delete(key); + response.id = toCancel.id; + traceSendingResponse(response, message.method, Date.now()); + messageWriter.write(response); + return; + } + } + } + addMessageToQueue(messageQueue, message); + } finally { + triggerMessageQueue(); + } + }; + function handleRequest(requestMessage) { + if (isDisposed()) { + return; + } + function reply(resultOrError, method, startTime2) { + const message = { + jsonrpc: version, + id: requestMessage.id + }; + if (resultOrError instanceof messages_1.ResponseError) { + message.error = resultOrError.toJson(); + } else { + message.result = resultOrError === void 0 ? null : resultOrError; + } + traceSendingResponse(message, method, startTime2); + messageWriter.write(message); + } + function replyError(error, method, startTime2) { + const message = { + jsonrpc: version, + id: requestMessage.id, + error: error.toJson() + }; + traceSendingResponse(message, method, startTime2); + messageWriter.write(message); + } + function replySuccess(result, method, startTime2) { + if (result === void 0) { + result = null; + } + const message = { + jsonrpc: version, + id: requestMessage.id, + result + }; + traceSendingResponse(message, method, startTime2); + messageWriter.write(message); + } + traceReceivedRequest(requestMessage); + const element = requestHandlers[requestMessage.method]; + let type; + let requestHandler; + if (element) { + type = element.type; + requestHandler = element.handler; + } + const startTime = Date.now(); + if (requestHandler || starRequestHandler) { + const tokenKey = String(requestMessage.id); + const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey); + requestTokens[tokenKey] = cancellationSource; + try { + let handlerResult; + if (requestHandler) { + if (requestMessage.params === void 0) { + if (type !== void 0 && type.numberOfParams !== 0) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but recevied none.`), requestMessage.method, startTime); + return; + } + handlerResult = requestHandler(cancellationSource.token); + } else if (Array.isArray(requestMessage.params)) { + if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byName) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime); + return; + } + handlerResult = requestHandler(...requestMessage.params, cancellationSource.token); + } else { + if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime); + return; + } + handlerResult = requestHandler(requestMessage.params, cancellationSource.token); + } + } else if (starRequestHandler) { + handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token); + } + const promise = handlerResult; + if (!handlerResult) { + delete requestTokens[tokenKey]; + replySuccess(handlerResult, requestMessage.method, startTime); + } else if (promise.then) { + promise.then((resultOrError) => { + delete requestTokens[tokenKey]; + reply(resultOrError, requestMessage.method, startTime); + }, (error) => { + delete requestTokens[tokenKey]; + if (error instanceof messages_1.ResponseError) { + replyError(error, requestMessage.method, startTime); + } else if (error && Is.string(error.message)) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); + } else { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); + } + }); + } else { + delete requestTokens[tokenKey]; + reply(handlerResult, requestMessage.method, startTime); + } + } catch (error) { + delete requestTokens[tokenKey]; + if (error instanceof messages_1.ResponseError) { + reply(error, requestMessage.method, startTime); + } else if (error && Is.string(error.message)) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); + } else { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); + } + } + } else { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime); + } + } + function handleResponse(responseMessage) { + if (isDisposed()) { + return; + } + if (responseMessage.id === null) { + if (responseMessage.error) { + logger.error(`Received response message without id: Error is: +${JSON.stringify(responseMessage.error, void 0, 4)}`); + } else { + logger.error(`Received response message without id. No further error information provided.`); + } + } else { + const key = String(responseMessage.id); + const responsePromise = responsePromises[key]; + traceReceivedResponse(responseMessage, responsePromise); + if (responsePromise) { + delete responsePromises[key]; + try { + if (responseMessage.error) { + const error = responseMessage.error; + responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data)); + } else if (responseMessage.result !== void 0) { + responsePromise.resolve(responseMessage.result); + } else { + throw new Error("Should never happen."); + } + } catch (error) { + if (error.message) { + logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`); + } else { + logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`); + } + } + } + } + } + function handleNotification(message) { + if (isDisposed()) { + return; + } + let type = void 0; + let notificationHandler; + if (message.method === CancelNotification.type.method) { + notificationHandler = (params) => { + const id = params.id; + const source = requestTokens[String(id)]; + if (source) { + source.cancel(); + } + }; + } else { + const element = notificationHandlers[message.method]; + if (element) { + notificationHandler = element.handler; + type = element.type; + } + } + if (notificationHandler || starNotificationHandler) { + try { + traceReceivedNotification(message); + if (notificationHandler) { + if (message.params === void 0) { + if (type !== void 0) { + if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) { + logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but recevied none.`); + } + } + notificationHandler(); + } else if (Array.isArray(message.params)) { + if (type !== void 0) { + if (type.parameterStructures === messages_1.ParameterStructures.byName) { + logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`); + } + if (type.numberOfParams !== message.params.length) { + logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${message.params.length} argumennts`); + } + } + notificationHandler(...message.params); + } else { + if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) { + logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`); + } + notificationHandler(message.params); + } + } else if (starNotificationHandler) { + starNotificationHandler(message.method, message.params); + } + } catch (error) { + if (error.message) { + logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`); + } else { + logger.error(`Notification handler '${message.method}' failed unexpectedly.`); + } + } + } else { + unhandledNotificationEmitter.fire(message); + } + } + function handleInvalidMessage(message) { + if (!message) { + logger.error("Received empty message."); + return; + } + logger.error(`Received message which is neither a response nor a notification message: +${JSON.stringify(message, null, 4)}`); + const responseMessage = message; + if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) { + const key = String(responseMessage.id); + const responseHandler = responsePromises[key]; + if (responseHandler) { + responseHandler.reject(new Error("The received response has neither a result nor an error property.")); + } + } + } + function traceSendingRequest(message) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data = void 0; + if (trace === Trace.Verbose && message.params) { + data = `Params: ${JSON.stringify(message.params, null, 4)} + +`; + } + tracer.log(`Sending request '${message.method} - (${message.id})'.`, data); + } else { + logLSPMessage("send-request", message); + } + } + function traceSendingNotification(message) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data = void 0; + if (trace === Trace.Verbose) { + if (message.params) { + data = `Params: ${JSON.stringify(message.params, null, 4)} + +`; + } else { + data = "No parameters provided.\n\n"; + } + } + tracer.log(`Sending notification '${message.method}'.`, data); + } else { + logLSPMessage("send-notification", message); + } + } + function traceSendingResponse(message, method, startTime) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data = void 0; + if (trace === Trace.Verbose) { + if (message.error && message.error.data) { + data = `Error data: ${JSON.stringify(message.error.data, null, 4)} + +`; + } else { + if (message.result) { + data = `Result: ${JSON.stringify(message.result, null, 4)} + +`; + } else if (message.error === void 0) { + data = "No result returned.\n\n"; + } + } + } + tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data); + } else { + logLSPMessage("send-response", message); + } + } + function traceReceivedRequest(message) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data = void 0; + if (trace === Trace.Verbose && message.params) { + data = `Params: ${JSON.stringify(message.params, null, 4)} + +`; + } + tracer.log(`Received request '${message.method} - (${message.id})'.`, data); + } else { + logLSPMessage("receive-request", message); + } + } + function traceReceivedNotification(message) { + if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data = void 0; + if (trace === Trace.Verbose) { + if (message.params) { + data = `Params: ${JSON.stringify(message.params, null, 4)} + +`; + } else { + data = "No parameters provided.\n\n"; + } + } + tracer.log(`Received notification '${message.method}'.`, data); + } else { + logLSPMessage("receive-notification", message); + } + } + function traceReceivedResponse(message, responsePromise) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data = void 0; + if (trace === Trace.Verbose) { + if (message.error && message.error.data) { + data = `Error data: ${JSON.stringify(message.error.data, null, 4)} + +`; + } else { + if (message.result) { + data = `Result: ${JSON.stringify(message.result, null, 4)} + +`; + } else if (message.error === void 0) { + data = "No result returned.\n\n"; + } + } + } + if (responsePromise) { + const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : ""; + tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data); + } else { + tracer.log(`Received response ${message.id} without active response promise.`, data); + } + } else { + logLSPMessage("receive-response", message); + } + } + function logLSPMessage(type, message) { + if (!tracer || trace === Trace.Off) { + return; + } + const lspMessage = { + isLSPMessage: true, + type, + message, + timestamp: Date.now() + }; + tracer.log(lspMessage); + } + function throwIfClosedOrDisposed() { + if (isClosed()) { + throw new ConnectionError(ConnectionErrors.Closed, "Connection is closed."); + } + if (isDisposed()) { + throw new ConnectionError(ConnectionErrors.Disposed, "Connection is disposed."); + } + } + function throwIfListening() { + if (isListening()) { + throw new ConnectionError(ConnectionErrors.AlreadyListening, "Connection is already listening"); + } + } + function throwIfNotListening() { + if (!isListening()) { + throw new Error("Call listen() first."); + } + } + function undefinedToNull(param) { + if (param === void 0) { + return null; + } else { + return param; + } + } + function nullToUndefined(param) { + if (param === null) { + return void 0; + } else { + return param; + } + } + function isNamedParam(param) { + return param !== void 0 && param !== null && !Array.isArray(param) && typeof param === "object"; + } + function computeSingleParam(parameterStructures, param) { + switch (parameterStructures) { + case messages_1.ParameterStructures.auto: + if (isNamedParam(param)) { + return nullToUndefined(param); + } else { + return [undefinedToNull(param)]; + } + break; + case messages_1.ParameterStructures.byName: + if (!isNamedParam(param)) { + throw new Error(`Recevied parameters by name but param is not an object literal.`); + } + return nullToUndefined(param); + case messages_1.ParameterStructures.byPosition: + return [undefinedToNull(param)]; + default: + throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`); + } + } + function computeMessageParams(type, params) { + let result; + const numberOfParams = type.numberOfParams; + switch (numberOfParams) { + case 0: + result = void 0; + break; + case 1: + result = computeSingleParam(type.parameterStructures, params[0]); + break; + default: + result = []; + for (let i = 0; i < params.length && i < numberOfParams; i++) { + result.push(undefinedToNull(params[i])); + } + if (params.length < numberOfParams) { + for (let i = params.length; i < numberOfParams; i++) { + result.push(null); + } + } + break; + } + return result; + } + const connection = { + sendNotification: (type, ...args) => { + throwIfClosedOrDisposed(); + let method; + let messageParams; + if (Is.string(type)) { + method = type; + const first = args[0]; + let paramStart = 0; + let parameterStructures = messages_1.ParameterStructures.auto; + if (messages_1.ParameterStructures.is(first)) { + paramStart = 1; + parameterStructures = first; + } + let paramEnd = args.length; + const numberOfParams = paramEnd - paramStart; + switch (numberOfParams) { + case 0: + messageParams = void 0; + break; + case 1: + messageParams = computeSingleParam(parameterStructures, args[paramStart]); + break; + default: + if (parameterStructures === messages_1.ParameterStructures.byName) { + throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' notification parameter structure.`); + } + messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value)); + break; + } + } else { + const params = args; + method = type.method; + messageParams = computeMessageParams(type, params); + } + const notificationMessage = { + jsonrpc: version, + method, + params: messageParams + }; + traceSendingNotification(notificationMessage); + messageWriter.write(notificationMessage); + }, + onNotification: (type, handler) => { + throwIfClosedOrDisposed(); + let method; + if (Is.func(type)) { + starNotificationHandler = type; + } else if (handler) { + if (Is.string(type)) { + method = type; + notificationHandlers[type] = {type: void 0, handler}; + } else { + method = type.method; + notificationHandlers[type.method] = {type, handler}; + } + } + return { + dispose: () => { + if (method !== void 0) { + delete notificationHandlers[method]; + } else { + starNotificationHandler = void 0; + } + } + }; + }, + onProgress: (_type, token, handler) => { + if (progressHandlers.has(token)) { + throw new Error(`Progress handler for token ${token} already registered`); + } + progressHandlers.set(token, handler); + return { + dispose: () => { + progressHandlers.delete(token); + } + }; + }, + sendProgress: (_type, token, value) => { + connection.sendNotification(ProgressNotification.type, {token, value}); + }, + onUnhandledProgress: unhandledProgressEmitter.event, + sendRequest: (type, ...args) => { + throwIfClosedOrDisposed(); + throwIfNotListening(); + let method; + let messageParams; + let token = void 0; + if (Is.string(type)) { + method = type; + const first = args[0]; + const last = args[args.length - 1]; + let paramStart = 0; + let parameterStructures = messages_1.ParameterStructures.auto; + if (messages_1.ParameterStructures.is(first)) { + paramStart = 1; + parameterStructures = first; + } + let paramEnd = args.length; + if (cancellation_1.CancellationToken.is(last)) { + paramEnd = paramEnd - 1; + token = last; + } + const numberOfParams = paramEnd - paramStart; + switch (numberOfParams) { + case 0: + messageParams = void 0; + break; + case 1: + messageParams = computeSingleParam(parameterStructures, args[paramStart]); + break; + default: + if (parameterStructures === messages_1.ParameterStructures.byName) { + throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' request parameter structure.`); + } + messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value)); + break; + } + } else { + const params = args; + method = type.method; + messageParams = computeMessageParams(type, params); + const numberOfParams = type.numberOfParams; + token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : void 0; + } + const id = sequenceNumber++; + let disposable; + if (token) { + disposable = token.onCancellationRequested(() => { + cancellationStrategy.sender.sendCancellation(connection, id); + }); + } + const result = new Promise((resolve, reject) => { + const requestMessage = { + jsonrpc: version, + id, + method, + params: messageParams + }; + const resolveWithCleanup = (r) => { + resolve(r); + cancellationStrategy.sender.cleanup(id); + disposable === null || disposable === void 0 ? void 0 : disposable.dispose(); + }; + const rejectWithCleanup = (r) => { + reject(r); + cancellationStrategy.sender.cleanup(id); + disposable === null || disposable === void 0 ? void 0 : disposable.dispose(); + }; + let responsePromise = {method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup}; + traceSendingRequest(requestMessage); + try { + messageWriter.write(requestMessage); + } catch (e) { + responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : "Unknown reason")); + responsePromise = null; + } + if (responsePromise) { + responsePromises[String(id)] = responsePromise; + } + }); + return result; + }, + onRequest: (type, handler) => { + throwIfClosedOrDisposed(); + let method = null; + if (StarRequestHandler.is(type)) { + method = void 0; + starRequestHandler = type; + } else if (Is.string(type)) { + method = null; + if (handler !== void 0) { + method = type; + requestHandlers[type] = {handler, type: void 0}; + } + } else { + if (handler !== void 0) { + method = type.method; + requestHandlers[type.method] = {type, handler}; + } + } + return { + dispose: () => { + if (method === null) { + return; + } + if (method !== void 0) { + delete requestHandlers[method]; + } else { + starRequestHandler = void 0; + } + } + }; + }, + trace: (_value, _tracer, sendNotificationOrTraceOptions) => { + let _sendNotification = false; + let _traceFormat = TraceFormat.Text; + if (sendNotificationOrTraceOptions !== void 0) { + if (Is.boolean(sendNotificationOrTraceOptions)) { + _sendNotification = sendNotificationOrTraceOptions; + } else { + _sendNotification = sendNotificationOrTraceOptions.sendNotification || false; + _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text; + } + } + trace = _value; + traceFormat = _traceFormat; + if (trace === Trace.Off) { + tracer = void 0; + } else { + tracer = _tracer; + } + if (_sendNotification && !isClosed() && !isDisposed()) { + connection.sendNotification(SetTraceNotification.type, {value: Trace.toString(_value)}); + } + }, + onError: errorEmitter.event, + onClose: closeEmitter.event, + onUnhandledNotification: unhandledNotificationEmitter.event, + onDispose: disposeEmitter.event, + end: () => { + messageWriter.end(); + }, + dispose: () => { + if (isDisposed()) { + return; + } + state = ConnectionState.Disposed; + disposeEmitter.fire(void 0); + const error = new Error("Connection got disposed."); + Object.keys(responsePromises).forEach((key) => { + responsePromises[key].reject(error); + }); + responsePromises = Object.create(null); + requestTokens = Object.create(null); + messageQueue = new linkedMap_1.LinkedMap(); + if (Is.func(messageWriter.dispose)) { + messageWriter.dispose(); + } + if (Is.func(messageReader.dispose)) { + messageReader.dispose(); + } + }, + listen: () => { + throwIfClosedOrDisposed(); + throwIfListening(); + state = ConnectionState.Listening; + messageReader.listen(callback); + }, + inspect: () => { + ral_1.default().console.log("inspect"); + } + }; + connection.onNotification(LogTraceNotification.type, (params) => { + if (trace === Trace.Off || !tracer) { + return; + } + tracer.log(params.message, trace === Trace.Verbose ? params.verbose : void 0); + }); + connection.onNotification(ProgressNotification.type, (params) => { + const handler = progressHandlers.get(params.token); + if (handler) { + handler(params.value); + } else { + unhandledProgressEmitter.fire(params); + } + }); + return connection; + } + exports2.createMessageConnection = createMessageConnection; +}); + +// node_modules/vscode-jsonrpc/lib/common/api.js +var require_api = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.Trace = exports2.ProgressType = exports2.createMessageConnection = exports2.NullLogger = exports2.ConnectionOptions = exports2.ConnectionStrategy = exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = exports2.CancellationToken = exports2.CancellationTokenSource = exports2.Emitter = exports2.Event = exports2.Disposable = exports2.ParameterStructures = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.ErrorCodes = exports2.ResponseError = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType0 = exports2.RequestType = exports2.RAL = void 0; + exports2.CancellationStrategy = void 0; + var messages_1 = require_messages(); + Object.defineProperty(exports2, "RequestType", {enumerable: true, get: function() { + return messages_1.RequestType; + }}); + Object.defineProperty(exports2, "RequestType0", {enumerable: true, get: function() { + return messages_1.RequestType0; + }}); + Object.defineProperty(exports2, "RequestType1", {enumerable: true, get: function() { + return messages_1.RequestType1; + }}); + Object.defineProperty(exports2, "RequestType2", {enumerable: true, get: function() { + return messages_1.RequestType2; + }}); + Object.defineProperty(exports2, "RequestType3", {enumerable: true, get: function() { + return messages_1.RequestType3; + }}); + Object.defineProperty(exports2, "RequestType4", {enumerable: true, get: function() { + return messages_1.RequestType4; + }}); + Object.defineProperty(exports2, "RequestType5", {enumerable: true, get: function() { + return messages_1.RequestType5; + }}); + Object.defineProperty(exports2, "RequestType6", {enumerable: true, get: function() { + return messages_1.RequestType6; + }}); + Object.defineProperty(exports2, "RequestType7", {enumerable: true, get: function() { + return messages_1.RequestType7; + }}); + Object.defineProperty(exports2, "RequestType8", {enumerable: true, get: function() { + return messages_1.RequestType8; + }}); + Object.defineProperty(exports2, "RequestType9", {enumerable: true, get: function() { + return messages_1.RequestType9; + }}); + Object.defineProperty(exports2, "ResponseError", {enumerable: true, get: function() { + return messages_1.ResponseError; + }}); + Object.defineProperty(exports2, "ErrorCodes", {enumerable: true, get: function() { + return messages_1.ErrorCodes; + }}); + Object.defineProperty(exports2, "NotificationType", {enumerable: true, get: function() { + return messages_1.NotificationType; + }}); + Object.defineProperty(exports2, "NotificationType0", {enumerable: true, get: function() { + return messages_1.NotificationType0; + }}); + Object.defineProperty(exports2, "NotificationType1", {enumerable: true, get: function() { + return messages_1.NotificationType1; + }}); + Object.defineProperty(exports2, "NotificationType2", {enumerable: true, get: function() { + return messages_1.NotificationType2; + }}); + Object.defineProperty(exports2, "NotificationType3", {enumerable: true, get: function() { + return messages_1.NotificationType3; + }}); + Object.defineProperty(exports2, "NotificationType4", {enumerable: true, get: function() { + return messages_1.NotificationType4; + }}); + Object.defineProperty(exports2, "NotificationType5", {enumerable: true, get: function() { + return messages_1.NotificationType5; + }}); + Object.defineProperty(exports2, "NotificationType6", {enumerable: true, get: function() { + return messages_1.NotificationType6; + }}); + Object.defineProperty(exports2, "NotificationType7", {enumerable: true, get: function() { + return messages_1.NotificationType7; + }}); + Object.defineProperty(exports2, "NotificationType8", {enumerable: true, get: function() { + return messages_1.NotificationType8; + }}); + Object.defineProperty(exports2, "NotificationType9", {enumerable: true, get: function() { + return messages_1.NotificationType9; + }}); + Object.defineProperty(exports2, "ParameterStructures", {enumerable: true, get: function() { + return messages_1.ParameterStructures; + }}); + var disposable_1 = require_disposable(); + Object.defineProperty(exports2, "Disposable", {enumerable: true, get: function() { + return disposable_1.Disposable; + }}); + var events_1 = require_events(); + Object.defineProperty(exports2, "Event", {enumerable: true, get: function() { + return events_1.Event; + }}); + Object.defineProperty(exports2, "Emitter", {enumerable: true, get: function() { + return events_1.Emitter; + }}); + var cancellation_1 = require_cancellation(); + Object.defineProperty(exports2, "CancellationTokenSource", {enumerable: true, get: function() { + return cancellation_1.CancellationTokenSource; + }}); + Object.defineProperty(exports2, "CancellationToken", {enumerable: true, get: function() { + return cancellation_1.CancellationToken; + }}); + var messageReader_1 = require_messageReader(); + Object.defineProperty(exports2, "MessageReader", {enumerable: true, get: function() { + return messageReader_1.MessageReader; + }}); + Object.defineProperty(exports2, "AbstractMessageReader", {enumerable: true, get: function() { + return messageReader_1.AbstractMessageReader; + }}); + Object.defineProperty(exports2, "ReadableStreamMessageReader", {enumerable: true, get: function() { + return messageReader_1.ReadableStreamMessageReader; + }}); + var messageWriter_1 = require_messageWriter(); + Object.defineProperty(exports2, "MessageWriter", {enumerable: true, get: function() { + return messageWriter_1.MessageWriter; + }}); + Object.defineProperty(exports2, "AbstractMessageWriter", {enumerable: true, get: function() { + return messageWriter_1.AbstractMessageWriter; + }}); + Object.defineProperty(exports2, "WriteableStreamMessageWriter", {enumerable: true, get: function() { + return messageWriter_1.WriteableStreamMessageWriter; + }}); + var connection_1 = require_connection(); + Object.defineProperty(exports2, "ConnectionStrategy", {enumerable: true, get: function() { + return connection_1.ConnectionStrategy; + }}); + Object.defineProperty(exports2, "ConnectionOptions", {enumerable: true, get: function() { + return connection_1.ConnectionOptions; + }}); + Object.defineProperty(exports2, "NullLogger", {enumerable: true, get: function() { + return connection_1.NullLogger; + }}); + Object.defineProperty(exports2, "createMessageConnection", {enumerable: true, get: function() { + return connection_1.createMessageConnection; + }}); + Object.defineProperty(exports2, "ProgressType", {enumerable: true, get: function() { + return connection_1.ProgressType; + }}); + Object.defineProperty(exports2, "Trace", {enumerable: true, get: function() { + return connection_1.Trace; + }}); + Object.defineProperty(exports2, "TraceFormat", {enumerable: true, get: function() { + return connection_1.TraceFormat; + }}); + Object.defineProperty(exports2, "SetTraceNotification", {enumerable: true, get: function() { + return connection_1.SetTraceNotification; + }}); + Object.defineProperty(exports2, "LogTraceNotification", {enumerable: true, get: function() { + return connection_1.LogTraceNotification; + }}); + Object.defineProperty(exports2, "ConnectionErrors", {enumerable: true, get: function() { + return connection_1.ConnectionErrors; + }}); + Object.defineProperty(exports2, "ConnectionError", {enumerable: true, get: function() { + return connection_1.ConnectionError; + }}); + Object.defineProperty(exports2, "CancellationReceiverStrategy", {enumerable: true, get: function() { + return connection_1.CancellationReceiverStrategy; + }}); + Object.defineProperty(exports2, "CancellationSenderStrategy", {enumerable: true, get: function() { + return connection_1.CancellationSenderStrategy; + }}); + Object.defineProperty(exports2, "CancellationStrategy", {enumerable: true, get: function() { + return connection_1.CancellationStrategy; + }}); + var ral_1 = require_ral(); + exports2.RAL = ral_1.default; +}); + +// node_modules/vscode-jsonrpc/lib/node/main.js +var require_main = __commonJS((exports2) => { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, {enumerable: true, get: function() { + return m[k]; + }}); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) + if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) + __createBinding(exports3, m, p); + }; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.createMessageConnection = exports2.createServerSocketTransport = exports2.createClientSocketTransport = exports2.createServerPipeTransport = exports2.createClientPipeTransport = exports2.generateRandomPipeName = exports2.StreamMessageWriter = exports2.StreamMessageReader = exports2.SocketMessageWriter = exports2.SocketMessageReader = exports2.IPCMessageWriter = exports2.IPCMessageReader = void 0; + var ril_1 = require_ril(); + ril_1.default.install(); + var api_1 = require_api(); + var path = require("path"); + var os = require("os"); + var crypto_1 = require("crypto"); + var net_1 = require("net"); + __exportStar2(require_api(), exports2); + var IPCMessageReader = class extends api_1.AbstractMessageReader { + constructor(process2) { + super(); + this.process = process2; + let eventEmitter = this.process; + eventEmitter.on("error", (error) => this.fireError(error)); + eventEmitter.on("close", () => this.fireClose()); + } + listen(callback) { + this.process.on("message", callback); + return api_1.Disposable.create(() => this.process.off("message", callback)); + } + }; + exports2.IPCMessageReader = IPCMessageReader; + var IPCMessageWriter = class extends api_1.AbstractMessageWriter { + constructor(process2) { + super(); + this.process = process2; + this.errorCount = 0; + let eventEmitter = this.process; + eventEmitter.on("error", (error) => this.fireError(error)); + eventEmitter.on("close", () => this.fireClose); + } + write(msg) { + try { + if (typeof this.process.send === "function") { + this.process.send(msg, void 0, void 0, (error) => { + if (error) { + this.errorCount++; + this.handleError(error, msg); + } else { + this.errorCount = 0; + } + }); + } + return Promise.resolve(); + } catch (error) { + this.handleError(error, msg); + return Promise.reject(error); + } + } + handleError(error, msg) { + this.errorCount++; + this.fireError(error, msg, this.errorCount); + } + end() { + } + }; + exports2.IPCMessageWriter = IPCMessageWriter; + var SocketMessageReader = class extends api_1.ReadableStreamMessageReader { + constructor(socket, encoding = "utf-8") { + super(ril_1.default().stream.asReadableStream(socket), encoding); + } + }; + exports2.SocketMessageReader = SocketMessageReader; + var SocketMessageWriter = class extends api_1.WriteableStreamMessageWriter { + constructor(socket, options) { + super(ril_1.default().stream.asWritableStream(socket), options); + this.socket = socket; + } + dispose() { + super.dispose(); + this.socket.destroy(); + } + }; + exports2.SocketMessageWriter = SocketMessageWriter; + var StreamMessageReader = class extends api_1.ReadableStreamMessageReader { + constructor(readble, encoding) { + super(ril_1.default().stream.asReadableStream(readble), encoding); + } + }; + exports2.StreamMessageReader = StreamMessageReader; + var StreamMessageWriter = class extends api_1.WriteableStreamMessageWriter { + constructor(writable, options) { + super(ril_1.default().stream.asWritableStream(writable), options); + } + }; + exports2.StreamMessageWriter = StreamMessageWriter; + var XDG_RUNTIME_DIR = process.env["XDG_RUNTIME_DIR"]; + var safeIpcPathLengths = new Map([ + ["linux", 107], + ["darwin", 103] + ]); + function generateRandomPipeName() { + const randomSuffix = crypto_1.randomBytes(21).toString("hex"); + if (process.platform === "win32") { + return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`; + } + let result; + if (XDG_RUNTIME_DIR) { + result = path.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`); + } else { + result = path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`); + } + const limit = safeIpcPathLengths.get(process.platform); + if (limit !== void 0 && result.length >= limit) { + ril_1.default().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`); + } + return result; + } + exports2.generateRandomPipeName = generateRandomPipeName; + function createClientPipeTransport(pipeName, encoding = "utf-8") { + let connectResolve; + const connected = new Promise((resolve, _reject) => { + connectResolve = resolve; + }); + return new Promise((resolve, reject) => { + let server = net_1.createServer((socket) => { + server.close(); + connectResolve([ + new SocketMessageReader(socket, encoding), + new SocketMessageWriter(socket, encoding) + ]); + }); + server.on("error", reject); + server.listen(pipeName, () => { + server.removeListener("error", reject); + resolve({ + onConnected: () => { + return connected; + } + }); + }); + }); + } + exports2.createClientPipeTransport = createClientPipeTransport; + function createServerPipeTransport(pipeName, encoding = "utf-8") { + const socket = net_1.createConnection(pipeName); + return [ + new SocketMessageReader(socket, encoding), + new SocketMessageWriter(socket, encoding) + ]; + } + exports2.createServerPipeTransport = createServerPipeTransport; + function createClientSocketTransport(port, encoding = "utf-8") { + let connectResolve; + const connected = new Promise((resolve, _reject) => { + connectResolve = resolve; + }); + return new Promise((resolve, reject) => { + const server = net_1.createServer((socket) => { + server.close(); + connectResolve([ + new SocketMessageReader(socket, encoding), + new SocketMessageWriter(socket, encoding) + ]); + }); + server.on("error", reject); + server.listen(port, "127.0.0.1", () => { + server.removeListener("error", reject); + resolve({ + onConnected: () => { + return connected; + } + }); + }); + }); + } + exports2.createClientSocketTransport = createClientSocketTransport; + function createServerSocketTransport(port, encoding = "utf-8") { + const socket = net_1.createConnection(port, "127.0.0.1"); + return [ + new SocketMessageReader(socket, encoding), + new SocketMessageWriter(socket, encoding) + ]; + } + exports2.createServerSocketTransport = createServerSocketTransport; + function isReadableStream(value) { + const candidate = value; + return candidate.read !== void 0 && candidate.addListener !== void 0; + } + function isWritableStream(value) { + const candidate = value; + return candidate.write !== void 0 && candidate.addListener !== void 0; + } + function createMessageConnection(input, output, logger, options) { + if (!logger) { + logger = api_1.NullLogger; + } + const reader = isReadableStream(input) ? new StreamMessageReader(input) : input; + const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output; + if (api_1.ConnectionStrategy.is(options)) { + options = {connectionStrategy: options}; + } + return api_1.createMessageConnection(reader, writer, logger, options); + } + exports2.createMessageConnection = createMessageConnection; +}); + +// node_modules/vscode-jsonrpc/node.js +var require_node = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = require_main(); +}); + +// node_modules/vscode-languageserver-types/lib/esm/main.js +var require_main2 = __commonJS((exports2) => { + __markAsModule(exports2); + __export(exports2, { + AnnotatedTextEdit: () => AnnotatedTextEdit, + ChangeAnnotation: () => ChangeAnnotation, + ChangeAnnotationIdentifier: () => ChangeAnnotationIdentifier, + CodeAction: () => CodeAction, + CodeActionContext: () => CodeActionContext, + CodeActionKind: () => CodeActionKind, + CodeDescription: () => CodeDescription, + CodeLens: () => CodeLens, + Color: () => Color, + ColorInformation: () => ColorInformation, + ColorPresentation: () => ColorPresentation, + Command: () => Command, + CompletionItem: () => CompletionItem, + CompletionItemKind: () => CompletionItemKind, + CompletionItemTag: () => CompletionItemTag, + CompletionList: () => CompletionList, + CreateFile: () => CreateFile, + DeleteFile: () => DeleteFile, + Diagnostic: () => Diagnostic, + DiagnosticRelatedInformation: () => DiagnosticRelatedInformation, + DiagnosticSeverity: () => DiagnosticSeverity, + DiagnosticTag: () => DiagnosticTag, + DocumentHighlight: () => DocumentHighlight, + DocumentHighlightKind: () => DocumentHighlightKind, + DocumentLink: () => DocumentLink, + DocumentSymbol: () => DocumentSymbol, + EOL: () => EOL, + FoldingRange: () => FoldingRange, + FoldingRangeKind: () => FoldingRangeKind, + FormattingOptions: () => FormattingOptions, + Hover: () => Hover, + InsertReplaceEdit: () => InsertReplaceEdit, + InsertTextFormat: () => InsertTextFormat, + InsertTextMode: () => InsertTextMode, + Location: () => Location, + LocationLink: () => LocationLink, + MarkedString: () => MarkedString, + MarkupContent: () => MarkupContent, + MarkupKind: () => MarkupKind, + OptionalVersionedTextDocumentIdentifier: () => OptionalVersionedTextDocumentIdentifier, + ParameterInformation: () => ParameterInformation, + Position: () => Position, + Range: () => Range3, + RenameFile: () => RenameFile, + SelectionRange: () => SelectionRange, + SignatureInformation: () => SignatureInformation, + SymbolInformation: () => SymbolInformation, + SymbolKind: () => SymbolKind, + SymbolTag: () => SymbolTag, + TextDocument: () => TextDocument, + TextDocumentEdit: () => TextDocumentEdit, + TextDocumentIdentifier: () => TextDocumentIdentifier2, + TextDocumentItem: () => TextDocumentItem, + TextEdit: () => TextEdit, + VersionedTextDocumentIdentifier: () => VersionedTextDocumentIdentifier2, + WorkspaceChange: () => WorkspaceChange, + WorkspaceEdit: () => WorkspaceEdit, + integer: () => integer, + uinteger: () => uinteger + }); + "use strict"; + var integer; + (function(integer2) { + integer2.MIN_VALUE = -2147483648; + integer2.MAX_VALUE = 2147483647; + })(integer || (integer = {})); + var uinteger; + (function(uinteger2) { + uinteger2.MIN_VALUE = 0; + uinteger2.MAX_VALUE = 2147483647; + })(uinteger || (uinteger = {})); + var Position; + (function(Position2) { + function create(line, character) { + if (line === Number.MAX_VALUE) { + line = uinteger.MAX_VALUE; + } + if (character === Number.MAX_VALUE) { + character = uinteger.MAX_VALUE; + } + return {line, character}; + } + Position2.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character); + } + Position2.is = is; + })(Position || (Position = {})); + var Range3; + (function(Range4) { + function create(one, two, three, four) { + if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) { + return {start: Position.create(one, two), end: Position.create(three, four)}; + } else if (Position.is(one) && Position.is(two)) { + return {start: one, end: two}; + } else { + throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]"); + } + } + Range4.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end); + } + Range4.is = is; + })(Range3 || (Range3 = {})); + var Location; + (function(Location2) { + function create(uri, range) { + return {uri, range}; + } + Location2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Range3.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri)); + } + Location2.is = is; + })(Location || (Location = {})); + var LocationLink; + (function(LocationLink2) { + function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) { + return {targetUri, targetRange, targetSelectionRange, originSelectionRange}; + } + LocationLink2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Range3.is(candidate.targetRange) && Is.string(candidate.targetUri) && (Range3.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange)) && (Range3.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange)); + } + LocationLink2.is = is; + })(LocationLink || (LocationLink = {})); + var Color; + (function(Color2) { + function create(red, green, blue, alpha) { + return { + red, + green, + blue, + alpha + }; + } + Color2.create = create; + function is(value) { + var candidate = value; + return Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1); + } + Color2.is = is; + })(Color || (Color = {})); + var ColorInformation; + (function(ColorInformation2) { + function create(range, color) { + return { + range, + color + }; + } + ColorInformation2.create = create; + function is(value) { + var candidate = value; + return Range3.is(candidate.range) && Color.is(candidate.color); + } + ColorInformation2.is = is; + })(ColorInformation || (ColorInformation = {})); + var ColorPresentation; + (function(ColorPresentation2) { + function create(label, textEdit, additionalTextEdits) { + return { + label, + textEdit, + additionalTextEdits + }; + } + ColorPresentation2.create = create; + function is(value) { + var candidate = value; + return Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); + } + ColorPresentation2.is = is; + })(ColorPresentation || (ColorPresentation = {})); + var FoldingRangeKind; + (function(FoldingRangeKind2) { + FoldingRangeKind2["Comment"] = "comment"; + FoldingRangeKind2["Imports"] = "imports"; + FoldingRangeKind2["Region"] = "region"; + })(FoldingRangeKind || (FoldingRangeKind = {})); + var FoldingRange; + (function(FoldingRange2) { + function create(startLine, endLine, startCharacter, endCharacter, kind) { + var result = { + startLine, + endLine + }; + if (Is.defined(startCharacter)) { + result.startCharacter = startCharacter; + } + if (Is.defined(endCharacter)) { + result.endCharacter = endCharacter; + } + if (Is.defined(kind)) { + result.kind = kind; + } + return result; + } + FoldingRange2.create = create; + function is(value) { + var candidate = value; + return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind)); + } + FoldingRange2.is = is; + })(FoldingRange || (FoldingRange = {})); + var DiagnosticRelatedInformation; + (function(DiagnosticRelatedInformation2) { + function create(location, message) { + return { + location, + message + }; + } + DiagnosticRelatedInformation2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); + } + DiagnosticRelatedInformation2.is = is; + })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {})); + var DiagnosticSeverity; + (function(DiagnosticSeverity2) { + DiagnosticSeverity2.Error = 1; + DiagnosticSeverity2.Warning = 2; + DiagnosticSeverity2.Information = 3; + DiagnosticSeverity2.Hint = 4; + })(DiagnosticSeverity || (DiagnosticSeverity = {})); + var DiagnosticTag; + (function(DiagnosticTag2) { + DiagnosticTag2.Unnecessary = 1; + DiagnosticTag2.Deprecated = 2; + })(DiagnosticTag || (DiagnosticTag = {})); + var CodeDescription; + (function(CodeDescription2) { + function is(value) { + var candidate = value; + return candidate !== void 0 && candidate !== null && Is.string(candidate.href); + } + CodeDescription2.is = is; + })(CodeDescription || (CodeDescription = {})); + var Diagnostic; + (function(Diagnostic2) { + function create(range, message, severity, code, source, relatedInformation) { + var result = {range, message}; + if (Is.defined(severity)) { + result.severity = severity; + } + if (Is.defined(code)) { + result.code = code; + } + if (Is.defined(source)) { + result.source = source; + } + if (Is.defined(relatedInformation)) { + result.relatedInformation = relatedInformation; + } + return result; + } + Diagnostic2.create = create; + function is(value) { + var _a; + var candidate = value; + return Is.defined(candidate) && Range3.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); + } + Diagnostic2.is = is; + })(Diagnostic || (Diagnostic = {})); + var Command; + (function(Command2) { + function create(title, command) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var result = {title, command}; + if (Is.defined(args) && args.length > 0) { + result.arguments = args; + } + return result; + } + Command2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); + } + Command2.is = is; + })(Command || (Command = {})); + var TextEdit; + (function(TextEdit2) { + function replace(range, newText) { + return {range, newText}; + } + TextEdit2.replace = replace; + function insert(position, newText) { + return {range: {start: position, end: position}, newText}; + } + TextEdit2.insert = insert; + function del(range) { + return {range, newText: ""}; + } + TextEdit2.del = del; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range3.is(candidate.range); + } + TextEdit2.is = is; + })(TextEdit || (TextEdit = {})); + var ChangeAnnotation; + (function(ChangeAnnotation2) { + function create(label, needsConfirmation, description) { + var result = {label}; + if (needsConfirmation !== void 0) { + result.needsConfirmation = needsConfirmation; + } + if (description !== void 0) { + result.description = description; + } + return result; + } + ChangeAnnotation2.create = create; + function is(value) { + var candidate = value; + return candidate !== void 0 && Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0); + } + ChangeAnnotation2.is = is; + })(ChangeAnnotation || (ChangeAnnotation = {})); + var ChangeAnnotationIdentifier; + (function(ChangeAnnotationIdentifier2) { + function is(value) { + var candidate = value; + return typeof candidate === "string"; + } + ChangeAnnotationIdentifier2.is = is; + })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {})); + var AnnotatedTextEdit; + (function(AnnotatedTextEdit2) { + function replace(range, newText, annotation) { + return {range, newText, annotationId: annotation}; + } + AnnotatedTextEdit2.replace = replace; + function insert(position, newText, annotation) { + return {range: {start: position, end: position}, newText, annotationId: annotation}; + } + AnnotatedTextEdit2.insert = insert; + function del(range, annotation) { + return {range, newText: "", annotationId: annotation}; + } + AnnotatedTextEdit2.del = del; + function is(value) { + var candidate = value; + return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)); + } + AnnotatedTextEdit2.is = is; + })(AnnotatedTextEdit || (AnnotatedTextEdit = {})); + var TextDocumentEdit; + (function(TextDocumentEdit2) { + function create(textDocument, edits) { + return {textDocument, edits}; + } + TextDocumentEdit2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits); + } + TextDocumentEdit2.is = is; + })(TextDocumentEdit || (TextDocumentEdit = {})); + var CreateFile; + (function(CreateFile2) { + function create(uri, options, annotation) { + var result = { + kind: "create", + uri + }; + if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { + result.options = options; + } + if (annotation !== void 0) { + result.annotationId = annotation; + } + return result; + } + CreateFile2.create = create; + function is(value) { + var candidate = value; + return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); + } + CreateFile2.is = is; + })(CreateFile || (CreateFile = {})); + var RenameFile; + (function(RenameFile2) { + function create(oldUri, newUri, options, annotation) { + var result = { + kind: "rename", + oldUri, + newUri + }; + if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { + result.options = options; + } + if (annotation !== void 0) { + result.annotationId = annotation; + } + return result; + } + RenameFile2.create = create; + function is(value) { + var candidate = value; + return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); + } + RenameFile2.is = is; + })(RenameFile || (RenameFile = {})); + var DeleteFile; + (function(DeleteFile2) { + function create(uri, options, annotation) { + var result = { + kind: "delete", + uri + }; + if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) { + result.options = options; + } + if (annotation !== void 0) { + result.annotationId = annotation; + } + return result; + } + DeleteFile2.create = create; + function is(value) { + var candidate = value; + return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); + } + DeleteFile2.is = is; + })(DeleteFile || (DeleteFile = {})); + var WorkspaceEdit; + (function(WorkspaceEdit2) { + function is(value) { + var candidate = value; + return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every(function(change) { + if (Is.string(change.kind)) { + return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change); + } else { + return TextDocumentEdit.is(change); + } + })); + } + WorkspaceEdit2.is = is; + })(WorkspaceEdit || (WorkspaceEdit = {})); + var TextEditChangeImpl = function() { + function TextEditChangeImpl2(edits, changeAnnotations) { + this.edits = edits; + this.changeAnnotations = changeAnnotations; + } + TextEditChangeImpl2.prototype.insert = function(position, newText, annotation) { + var edit; + var id; + if (annotation === void 0) { + edit = TextEdit.insert(position, newText); + } else if (ChangeAnnotationIdentifier.is(annotation)) { + id = annotation; + edit = AnnotatedTextEdit.insert(position, newText, annotation); + } else { + this.assertChangeAnnotations(this.changeAnnotations); + id = this.changeAnnotations.manage(annotation); + edit = AnnotatedTextEdit.insert(position, newText, id); + } + this.edits.push(edit); + if (id !== void 0) { + return id; + } + }; + TextEditChangeImpl2.prototype.replace = function(range, newText, annotation) { + var edit; + var id; + if (annotation === void 0) { + edit = TextEdit.replace(range, newText); + } else if (ChangeAnnotationIdentifier.is(annotation)) { + id = annotation; + edit = AnnotatedTextEdit.replace(range, newText, annotation); + } else { + this.assertChangeAnnotations(this.changeAnnotations); + id = this.changeAnnotations.manage(annotation); + edit = AnnotatedTextEdit.replace(range, newText, id); + } + this.edits.push(edit); + if (id !== void 0) { + return id; + } + }; + TextEditChangeImpl2.prototype.delete = function(range, annotation) { + var edit; + var id; + if (annotation === void 0) { + edit = TextEdit.del(range); + } else if (ChangeAnnotationIdentifier.is(annotation)) { + id = annotation; + edit = AnnotatedTextEdit.del(range, annotation); + } else { + this.assertChangeAnnotations(this.changeAnnotations); + id = this.changeAnnotations.manage(annotation); + edit = AnnotatedTextEdit.del(range, id); + } + this.edits.push(edit); + if (id !== void 0) { + return id; + } + }; + TextEditChangeImpl2.prototype.add = function(edit) { + this.edits.push(edit); + }; + TextEditChangeImpl2.prototype.all = function() { + return this.edits; + }; + TextEditChangeImpl2.prototype.clear = function() { + this.edits.splice(0, this.edits.length); + }; + TextEditChangeImpl2.prototype.assertChangeAnnotations = function(value) { + if (value === void 0) { + throw new Error("Text edit change is not configured to manage change annotations."); + } + }; + return TextEditChangeImpl2; + }(); + var ChangeAnnotations = function() { + function ChangeAnnotations2(annotations) { + this._annotations = annotations === void 0 ? Object.create(null) : annotations; + this._counter = 0; + this._size = 0; + } + ChangeAnnotations2.prototype.all = function() { + return this._annotations; + }; + Object.defineProperty(ChangeAnnotations2.prototype, "size", { + get: function() { + return this._size; + }, + enumerable: false, + configurable: true + }); + ChangeAnnotations2.prototype.manage = function(idOrAnnotation, annotation) { + var id; + if (ChangeAnnotationIdentifier.is(idOrAnnotation)) { + id = idOrAnnotation; + } else { + id = this.nextId(); + annotation = idOrAnnotation; + } + if (this._annotations[id] !== void 0) { + throw new Error("Id " + id + " is already in use."); + } + if (annotation === void 0) { + throw new Error("No annotation provided for id " + id); + } + this._annotations[id] = annotation; + this._size++; + return id; + }; + ChangeAnnotations2.prototype.nextId = function() { + this._counter++; + return this._counter.toString(); + }; + return ChangeAnnotations2; + }(); + var WorkspaceChange = function() { + function WorkspaceChange2(workspaceEdit) { + var _this = this; + this._textEditChanges = Object.create(null); + if (workspaceEdit !== void 0) { + this._workspaceEdit = workspaceEdit; + if (workspaceEdit.documentChanges) { + this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations); + workspaceEdit.changeAnnotations = this._changeAnnotations.all(); + workspaceEdit.documentChanges.forEach(function(change) { + if (TextDocumentEdit.is(change)) { + var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations); + _this._textEditChanges[change.textDocument.uri] = textEditChange; + } + }); + } else if (workspaceEdit.changes) { + Object.keys(workspaceEdit.changes).forEach(function(key) { + var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]); + _this._textEditChanges[key] = textEditChange; + }); + } + } else { + this._workspaceEdit = {}; + } + } + Object.defineProperty(WorkspaceChange2.prototype, "edit", { + get: function() { + this.initDocumentChanges(); + if (this._changeAnnotations !== void 0) { + if (this._changeAnnotations.size === 0) { + this._workspaceEdit.changeAnnotations = void 0; + } else { + this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); + } + } + return this._workspaceEdit; + }, + enumerable: false, + configurable: true + }); + WorkspaceChange2.prototype.getTextEditChange = function(key) { + if (OptionalVersionedTextDocumentIdentifier.is(key)) { + this.initDocumentChanges(); + if (this._workspaceEdit.documentChanges === void 0) { + throw new Error("Workspace edit is not configured for document changes."); + } + var textDocument = {uri: key.uri, version: key.version}; + var result = this._textEditChanges[textDocument.uri]; + if (!result) { + var edits = []; + var textDocumentEdit = { + textDocument, + edits + }; + this._workspaceEdit.documentChanges.push(textDocumentEdit); + result = new TextEditChangeImpl(edits, this._changeAnnotations); + this._textEditChanges[textDocument.uri] = result; + } + return result; + } else { + this.initChanges(); + if (this._workspaceEdit.changes === void 0) { + throw new Error("Workspace edit is not configured for normal text edit changes."); + } + var result = this._textEditChanges[key]; + if (!result) { + var edits = []; + this._workspaceEdit.changes[key] = edits; + result = new TextEditChangeImpl(edits); + this._textEditChanges[key] = result; + } + return result; + } + }; + WorkspaceChange2.prototype.initDocumentChanges = function() { + if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { + this._changeAnnotations = new ChangeAnnotations(); + this._workspaceEdit.documentChanges = []; + this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); + } + }; + WorkspaceChange2.prototype.initChanges = function() { + if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { + this._workspaceEdit.changes = Object.create(null); + } + }; + WorkspaceChange2.prototype.createFile = function(uri, optionsOrAnnotation, options) { + this.initDocumentChanges(); + if (this._workspaceEdit.documentChanges === void 0) { + throw new Error("Workspace edit is not configured for document changes."); + } + var annotation; + if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { + annotation = optionsOrAnnotation; + } else { + options = optionsOrAnnotation; + } + var operation; + var id; + if (annotation === void 0) { + operation = CreateFile.create(uri, options); + } else { + id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); + operation = CreateFile.create(uri, options, id); + } + this._workspaceEdit.documentChanges.push(operation); + if (id !== void 0) { + return id; + } + }; + WorkspaceChange2.prototype.renameFile = function(oldUri, newUri, optionsOrAnnotation, options) { + this.initDocumentChanges(); + if (this._workspaceEdit.documentChanges === void 0) { + throw new Error("Workspace edit is not configured for document changes."); + } + var annotation; + if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { + annotation = optionsOrAnnotation; + } else { + options = optionsOrAnnotation; + } + var operation; + var id; + if (annotation === void 0) { + operation = RenameFile.create(oldUri, newUri, options); + } else { + id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); + operation = RenameFile.create(oldUri, newUri, options, id); + } + this._workspaceEdit.documentChanges.push(operation); + if (id !== void 0) { + return id; + } + }; + WorkspaceChange2.prototype.deleteFile = function(uri, optionsOrAnnotation, options) { + this.initDocumentChanges(); + if (this._workspaceEdit.documentChanges === void 0) { + throw new Error("Workspace edit is not configured for document changes."); + } + var annotation; + if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { + annotation = optionsOrAnnotation; + } else { + options = optionsOrAnnotation; + } + var operation; + var id; + if (annotation === void 0) { + operation = DeleteFile.create(uri, options); + } else { + id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); + operation = DeleteFile.create(uri, options, id); + } + this._workspaceEdit.documentChanges.push(operation); + if (id !== void 0) { + return id; + } + }; + return WorkspaceChange2; + }(); + var TextDocumentIdentifier2; + (function(TextDocumentIdentifier3) { + function create(uri) { + return {uri}; + } + TextDocumentIdentifier3.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.string(candidate.uri); + } + TextDocumentIdentifier3.is = is; + })(TextDocumentIdentifier2 || (TextDocumentIdentifier2 = {})); + var VersionedTextDocumentIdentifier2; + (function(VersionedTextDocumentIdentifier3) { + function create(uri, version) { + return {uri, version}; + } + VersionedTextDocumentIdentifier3.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version); + } + VersionedTextDocumentIdentifier3.is = is; + })(VersionedTextDocumentIdentifier2 || (VersionedTextDocumentIdentifier2 = {})); + var OptionalVersionedTextDocumentIdentifier; + (function(OptionalVersionedTextDocumentIdentifier2) { + function create(uri, version) { + return {uri, version}; + } + OptionalVersionedTextDocumentIdentifier2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version)); + } + OptionalVersionedTextDocumentIdentifier2.is = is; + })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {})); + var TextDocumentItem; + (function(TextDocumentItem2) { + function create(uri, languageId, version, text) { + return {uri, languageId, version, text}; + } + TextDocumentItem2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text); + } + TextDocumentItem2.is = is; + })(TextDocumentItem || (TextDocumentItem = {})); + var MarkupKind; + (function(MarkupKind2) { + MarkupKind2.PlainText = "plaintext"; + MarkupKind2.Markdown = "markdown"; + })(MarkupKind || (MarkupKind = {})); + (function(MarkupKind2) { + function is(value) { + var candidate = value; + return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown; + } + MarkupKind2.is = is; + })(MarkupKind || (MarkupKind = {})); + var MarkupContent; + (function(MarkupContent2) { + function is(value) { + var candidate = value; + return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); + } + MarkupContent2.is = is; + })(MarkupContent || (MarkupContent = {})); + var CompletionItemKind; + (function(CompletionItemKind2) { + CompletionItemKind2.Text = 1; + CompletionItemKind2.Method = 2; + CompletionItemKind2.Function = 3; + CompletionItemKind2.Constructor = 4; + CompletionItemKind2.Field = 5; + CompletionItemKind2.Variable = 6; + CompletionItemKind2.Class = 7; + CompletionItemKind2.Interface = 8; + CompletionItemKind2.Module = 9; + CompletionItemKind2.Property = 10; + CompletionItemKind2.Unit = 11; + CompletionItemKind2.Value = 12; + CompletionItemKind2.Enum = 13; + CompletionItemKind2.Keyword = 14; + CompletionItemKind2.Snippet = 15; + CompletionItemKind2.Color = 16; + CompletionItemKind2.File = 17; + CompletionItemKind2.Reference = 18; + CompletionItemKind2.Folder = 19; + CompletionItemKind2.EnumMember = 20; + CompletionItemKind2.Constant = 21; + CompletionItemKind2.Struct = 22; + CompletionItemKind2.Event = 23; + CompletionItemKind2.Operator = 24; + CompletionItemKind2.TypeParameter = 25; + })(CompletionItemKind || (CompletionItemKind = {})); + var InsertTextFormat; + (function(InsertTextFormat2) { + InsertTextFormat2.PlainText = 1; + InsertTextFormat2.Snippet = 2; + })(InsertTextFormat || (InsertTextFormat = {})); + var CompletionItemTag; + (function(CompletionItemTag2) { + CompletionItemTag2.Deprecated = 1; + })(CompletionItemTag || (CompletionItemTag = {})); + var InsertReplaceEdit; + (function(InsertReplaceEdit2) { + function create(newText, insert, replace) { + return {newText, insert, replace}; + } + InsertReplaceEdit2.create = create; + function is(value) { + var candidate = value; + return candidate && Is.string(candidate.newText) && Range3.is(candidate.insert) && Range3.is(candidate.replace); + } + InsertReplaceEdit2.is = is; + })(InsertReplaceEdit || (InsertReplaceEdit = {})); + var InsertTextMode; + (function(InsertTextMode2) { + InsertTextMode2.asIs = 1; + InsertTextMode2.adjustIndentation = 2; + })(InsertTextMode || (InsertTextMode = {})); + var CompletionItem; + (function(CompletionItem2) { + function create(label) { + return {label}; + } + CompletionItem2.create = create; + })(CompletionItem || (CompletionItem = {})); + var CompletionList; + (function(CompletionList2) { + function create(items, isIncomplete) { + return {items: items ? items : [], isIncomplete: !!isIncomplete}; + } + CompletionList2.create = create; + })(CompletionList || (CompletionList = {})); + var MarkedString; + (function(MarkedString2) { + function fromPlainText(plainText) { + return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); + } + MarkedString2.fromPlainText = fromPlainText; + function is(value) { + var candidate = value; + return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value); + } + MarkedString2.is = is; + })(MarkedString || (MarkedString = {})); + var Hover; + (function(Hover2) { + function is(value) { + var candidate = value; + return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range3.is(value.range)); + } + Hover2.is = is; + })(Hover || (Hover = {})); + var ParameterInformation; + (function(ParameterInformation2) { + function create(label, documentation) { + return documentation ? {label, documentation} : {label}; + } + ParameterInformation2.create = create; + })(ParameterInformation || (ParameterInformation = {})); + var SignatureInformation; + (function(SignatureInformation2) { + function create(label, documentation) { + var parameters = []; + for (var _i = 2; _i < arguments.length; _i++) { + parameters[_i - 2] = arguments[_i]; + } + var result = {label}; + if (Is.defined(documentation)) { + result.documentation = documentation; + } + if (Is.defined(parameters)) { + result.parameters = parameters; + } else { + result.parameters = []; + } + return result; + } + SignatureInformation2.create = create; + })(SignatureInformation || (SignatureInformation = {})); + var DocumentHighlightKind; + (function(DocumentHighlightKind2) { + DocumentHighlightKind2.Text = 1; + DocumentHighlightKind2.Read = 2; + DocumentHighlightKind2.Write = 3; + })(DocumentHighlightKind || (DocumentHighlightKind = {})); + var DocumentHighlight; + (function(DocumentHighlight2) { + function create(range, kind) { + var result = {range}; + if (Is.number(kind)) { + result.kind = kind; + } + return result; + } + DocumentHighlight2.create = create; + })(DocumentHighlight || (DocumentHighlight = {})); + var SymbolKind; + (function(SymbolKind2) { + SymbolKind2.File = 1; + SymbolKind2.Module = 2; + SymbolKind2.Namespace = 3; + SymbolKind2.Package = 4; + SymbolKind2.Class = 5; + SymbolKind2.Method = 6; + SymbolKind2.Property = 7; + SymbolKind2.Field = 8; + SymbolKind2.Constructor = 9; + SymbolKind2.Enum = 10; + SymbolKind2.Interface = 11; + SymbolKind2.Function = 12; + SymbolKind2.Variable = 13; + SymbolKind2.Constant = 14; + SymbolKind2.String = 15; + SymbolKind2.Number = 16; + SymbolKind2.Boolean = 17; + SymbolKind2.Array = 18; + SymbolKind2.Object = 19; + SymbolKind2.Key = 20; + SymbolKind2.Null = 21; + SymbolKind2.EnumMember = 22; + SymbolKind2.Struct = 23; + SymbolKind2.Event = 24; + SymbolKind2.Operator = 25; + SymbolKind2.TypeParameter = 26; + })(SymbolKind || (SymbolKind = {})); + var SymbolTag; + (function(SymbolTag2) { + SymbolTag2.Deprecated = 1; + })(SymbolTag || (SymbolTag = {})); + var SymbolInformation; + (function(SymbolInformation2) { + function create(name, kind, range, uri, containerName) { + var result = { + name, + kind, + location: {uri, range} + }; + if (containerName) { + result.containerName = containerName; + } + return result; + } + SymbolInformation2.create = create; + })(SymbolInformation || (SymbolInformation = {})); + var DocumentSymbol; + (function(DocumentSymbol2) { + function create(name, detail, kind, range, selectionRange, children) { + var result = { + name, + detail, + kind, + range, + selectionRange + }; + if (children !== void 0) { + result.children = children; + } + return result; + } + DocumentSymbol2.create = create; + function is(value) { + var candidate = value; + return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range3.is(candidate.range) && Range3.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags)); + } + DocumentSymbol2.is = is; + })(DocumentSymbol || (DocumentSymbol = {})); + var CodeActionKind; + (function(CodeActionKind2) { + CodeActionKind2.Empty = ""; + CodeActionKind2.QuickFix = "quickfix"; + CodeActionKind2.Refactor = "refactor"; + CodeActionKind2.RefactorExtract = "refactor.extract"; + CodeActionKind2.RefactorInline = "refactor.inline"; + CodeActionKind2.RefactorRewrite = "refactor.rewrite"; + CodeActionKind2.Source = "source"; + CodeActionKind2.SourceOrganizeImports = "source.organizeImports"; + CodeActionKind2.SourceFixAll = "source.fixAll"; + })(CodeActionKind || (CodeActionKind = {})); + var CodeActionContext; + (function(CodeActionContext2) { + function create(diagnostics, only) { + var result = {diagnostics}; + if (only !== void 0 && only !== null) { + result.only = only; + } + return result; + } + CodeActionContext2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)); + } + CodeActionContext2.is = is; + })(CodeActionContext || (CodeActionContext = {})); + var CodeAction; + (function(CodeAction2) { + function create(title, kindOrCommandOrEdit, kind) { + var result = {title}; + var checkKind = true; + if (typeof kindOrCommandOrEdit === "string") { + checkKind = false; + result.kind = kindOrCommandOrEdit; + } else if (Command.is(kindOrCommandOrEdit)) { + result.command = kindOrCommandOrEdit; + } else { + result.edit = kindOrCommandOrEdit; + } + if (checkKind && kind !== void 0) { + result.kind = kind; + } + return result; + } + CodeAction2.create = create; + function is(value) { + var candidate = value; + return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit)); + } + CodeAction2.is = is; + })(CodeAction || (CodeAction = {})); + var CodeLens; + (function(CodeLens2) { + function create(range, data) { + var result = {range}; + if (Is.defined(data)) { + result.data = data; + } + return result; + } + CodeLens2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Range3.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command)); + } + CodeLens2.is = is; + })(CodeLens || (CodeLens = {})); + var FormattingOptions; + (function(FormattingOptions2) { + function create(tabSize, insertSpaces) { + return {tabSize, insertSpaces}; + } + FormattingOptions2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces); + } + FormattingOptions2.is = is; + })(FormattingOptions || (FormattingOptions = {})); + var DocumentLink; + (function(DocumentLink2) { + function create(range, target, data) { + return {range, target, data}; + } + DocumentLink2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Range3.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target)); + } + DocumentLink2.is = is; + })(DocumentLink || (DocumentLink = {})); + var SelectionRange; + (function(SelectionRange2) { + function create(range, parent) { + return {range, parent}; + } + SelectionRange2.create = create; + function is(value) { + var candidate = value; + return candidate !== void 0 && Range3.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent)); + } + SelectionRange2.is = is; + })(SelectionRange || (SelectionRange = {})); + var EOL = ["\n", "\r\n", "\r"]; + var TextDocument; + (function(TextDocument2) { + function create(uri, languageId, version, content) { + return new FullTextDocument(uri, languageId, version, content); + } + TextDocument2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false; + } + TextDocument2.is = is; + function applyEdits(document2, edits) { + var text = document2.getText(); + var sortedEdits = mergeSort(edits, function(a, b) { + var diff = a.range.start.line - b.range.start.line; + if (diff === 0) { + return a.range.start.character - b.range.start.character; + } + return diff; + }); + var lastModifiedOffset = text.length; + for (var i = sortedEdits.length - 1; i >= 0; i--) { + var e = sortedEdits[i]; + var startOffset = document2.offsetAt(e.range.start); + var endOffset = document2.offsetAt(e.range.end); + if (endOffset <= lastModifiedOffset) { + text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length); + } else { + throw new Error("Overlapping edit"); + } + lastModifiedOffset = startOffset; + } + return text; + } + TextDocument2.applyEdits = applyEdits; + function mergeSort(data, compare) { + if (data.length <= 1) { + return data; + } + var p = data.length / 2 | 0; + var left = data.slice(0, p); + var right = data.slice(p); + mergeSort(left, compare); + mergeSort(right, compare); + var leftIdx = 0; + var rightIdx = 0; + var i = 0; + while (leftIdx < left.length && rightIdx < right.length) { + var ret2 = compare(left[leftIdx], right[rightIdx]); + if (ret2 <= 0) { + data[i++] = left[leftIdx++]; + } else { + data[i++] = right[rightIdx++]; + } + } + while (leftIdx < left.length) { + data[i++] = left[leftIdx++]; + } + while (rightIdx < right.length) { + data[i++] = right[rightIdx++]; + } + return data; + } + })(TextDocument || (TextDocument = {})); + var FullTextDocument = function() { + function FullTextDocument2(uri, languageId, version, content) { + this._uri = uri; + this._languageId = languageId; + this._version = version; + this._content = content; + this._lineOffsets = void 0; + } + Object.defineProperty(FullTextDocument2.prototype, "uri", { + get: function() { + return this._uri; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(FullTextDocument2.prototype, "languageId", { + get: function() { + return this._languageId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(FullTextDocument2.prototype, "version", { + get: function() { + return this._version; + }, + enumerable: false, + configurable: true + }); + FullTextDocument2.prototype.getText = function(range) { + if (range) { + var start = this.offsetAt(range.start); + var end = this.offsetAt(range.end); + return this._content.substring(start, end); + } + return this._content; + }; + FullTextDocument2.prototype.update = function(event, version) { + this._content = event.text; + this._version = version; + this._lineOffsets = void 0; + }; + FullTextDocument2.prototype.getLineOffsets = function() { + if (this._lineOffsets === void 0) { + var lineOffsets = []; + var text = this._content; + var isLineStart = true; + for (var i = 0; i < text.length; i++) { + if (isLineStart) { + lineOffsets.push(i); + isLineStart = false; + } + var ch = text.charAt(i); + isLineStart = ch === "\r" || ch === "\n"; + if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") { + i++; + } + } + if (isLineStart && text.length > 0) { + lineOffsets.push(text.length); + } + this._lineOffsets = lineOffsets; + } + return this._lineOffsets; + }; + FullTextDocument2.prototype.positionAt = function(offset) { + offset = Math.max(Math.min(offset, this._content.length), 0); + var lineOffsets = this.getLineOffsets(); + var low = 0, high = lineOffsets.length; + if (high === 0) { + return Position.create(0, offset); + } + while (low < high) { + var mid = Math.floor((low + high) / 2); + if (lineOffsets[mid] > offset) { + high = mid; + } else { + low = mid + 1; + } + } + var line = low - 1; + return Position.create(line, offset - lineOffsets[line]); + }; + FullTextDocument2.prototype.offsetAt = function(position) { + var lineOffsets = this.getLineOffsets(); + if (position.line >= lineOffsets.length) { + return this._content.length; + } else if (position.line < 0) { + return 0; + } + var lineOffset = lineOffsets[position.line]; + var nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length; + return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); + }; + Object.defineProperty(FullTextDocument2.prototype, "lineCount", { + get: function() { + return this.getLineOffsets().length; + }, + enumerable: false, + configurable: true + }); + return FullTextDocument2; + }(); + var Is; + (function(Is2) { + var toString = Object.prototype.toString; + function defined(value) { + return typeof value !== "undefined"; + } + Is2.defined = defined; + function undefined2(value) { + return typeof value === "undefined"; + } + Is2.undefined = undefined2; + function boolean(value) { + return value === true || value === false; + } + Is2.boolean = boolean; + function string(value) { + return toString.call(value) === "[object String]"; + } + Is2.string = string; + function number(value) { + return toString.call(value) === "[object Number]"; + } + Is2.number = number; + function numberRange(value, min, max) { + return toString.call(value) === "[object Number]" && min <= value && value <= max; + } + Is2.numberRange = numberRange; + function integer2(value) { + return toString.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647; + } + Is2.integer = integer2; + function uinteger2(value) { + return toString.call(value) === "[object Number]" && 0 <= value && value <= 2147483647; + } + Is2.uinteger = uinteger2; + function func(value) { + return toString.call(value) === "[object Function]"; + } + Is2.func = func; + function objectLiteral(value) { + return value !== null && typeof value === "object"; + } + Is2.objectLiteral = objectLiteral; + function typedArray(value, check) { + return Array.isArray(value) && value.every(check); + } + Is2.typedArray = typedArray; + })(Is || (Is = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/messages.js +var require_messages2 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.ProtocolNotificationType = exports2.ProtocolNotificationType0 = exports2.ProtocolRequestType = exports2.ProtocolRequestType0 = exports2.RegistrationType = void 0; + var vscode_jsonrpc_1 = require_main(); + var RegistrationType = class { + constructor(method) { + this.method = method; + } + }; + exports2.RegistrationType = RegistrationType; + var ProtocolRequestType0 = class extends vscode_jsonrpc_1.RequestType0 { + constructor(method) { + super(method); + } + }; + exports2.ProtocolRequestType0 = ProtocolRequestType0; + var ProtocolRequestType = class extends vscode_jsonrpc_1.RequestType { + constructor(method) { + super(method, vscode_jsonrpc_1.ParameterStructures.byName); + } + }; + exports2.ProtocolRequestType = ProtocolRequestType; + var ProtocolNotificationType0 = class extends vscode_jsonrpc_1.NotificationType0 { + constructor(method) { + super(method); + } + }; + exports2.ProtocolNotificationType0 = ProtocolNotificationType0; + var ProtocolNotificationType = class extends vscode_jsonrpc_1.NotificationType { + constructor(method) { + super(method, vscode_jsonrpc_1.ParameterStructures.byName); + } + }; + exports2.ProtocolNotificationType = ProtocolNotificationType; +}); + +// node_modules/vscode-languageserver-protocol/lib/common/utils/is.js +var require_is2 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.objectLiteral = exports2.typedArray = exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0; + function boolean(value) { + return value === true || value === false; + } + exports2.boolean = boolean; + function string(value) { + return typeof value === "string" || value instanceof String; + } + exports2.string = string; + function number(value) { + return typeof value === "number" || value instanceof Number; + } + exports2.number = number; + function error(value) { + return value instanceof Error; + } + exports2.error = error; + function func(value) { + return typeof value === "function"; + } + exports2.func = func; + function array(value) { + return Array.isArray(value); + } + exports2.array = array; + function stringArray(value) { + return array(value) && value.every((elem) => string(elem)); + } + exports2.stringArray = stringArray; + function typedArray(value, check) { + return Array.isArray(value) && value.every(check); + } + exports2.typedArray = typedArray; + function objectLiteral(value) { + return value !== null && typeof value === "object"; + } + exports2.objectLiteral = objectLiteral; +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js +var require_protocol_implementation = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.ImplementationRequest = void 0; + var messages_1 = require_messages2(); + var ImplementationRequest; + (function(ImplementationRequest2) { + ImplementationRequest2.method = "textDocument/implementation"; + ImplementationRequest2.type = new messages_1.ProtocolRequestType(ImplementationRequest2.method); + })(ImplementationRequest = exports2.ImplementationRequest || (exports2.ImplementationRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js +var require_protocol_typeDefinition = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.TypeDefinitionRequest = void 0; + var messages_1 = require_messages2(); + var TypeDefinitionRequest; + (function(TypeDefinitionRequest2) { + TypeDefinitionRequest2.method = "textDocument/typeDefinition"; + TypeDefinitionRequest2.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest2.method); + })(TypeDefinitionRequest = exports2.TypeDefinitionRequest || (exports2.TypeDefinitionRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolders.js +var require_protocol_workspaceFolders = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = void 0; + var messages_1 = require_messages2(); + var WorkspaceFoldersRequest; + (function(WorkspaceFoldersRequest2) { + WorkspaceFoldersRequest2.type = new messages_1.ProtocolRequestType0("workspace/workspaceFolders"); + })(WorkspaceFoldersRequest = exports2.WorkspaceFoldersRequest || (exports2.WorkspaceFoldersRequest = {})); + var DidChangeWorkspaceFoldersNotification; + (function(DidChangeWorkspaceFoldersNotification2) { + DidChangeWorkspaceFoldersNotification2.type = new messages_1.ProtocolNotificationType("workspace/didChangeWorkspaceFolders"); + })(DidChangeWorkspaceFoldersNotification = exports2.DidChangeWorkspaceFoldersNotification || (exports2.DidChangeWorkspaceFoldersNotification = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js +var require_protocol_configuration = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.ConfigurationRequest = void 0; + var messages_1 = require_messages2(); + var ConfigurationRequest; + (function(ConfigurationRequest2) { + ConfigurationRequest2.type = new messages_1.ProtocolRequestType("workspace/configuration"); + })(ConfigurationRequest = exports2.ConfigurationRequest || (exports2.ConfigurationRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js +var require_protocol_colorProvider = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.ColorPresentationRequest = exports2.DocumentColorRequest = void 0; + var messages_1 = require_messages2(); + var DocumentColorRequest; + (function(DocumentColorRequest2) { + DocumentColorRequest2.method = "textDocument/documentColor"; + DocumentColorRequest2.type = new messages_1.ProtocolRequestType(DocumentColorRequest2.method); + })(DocumentColorRequest = exports2.DocumentColorRequest || (exports2.DocumentColorRequest = {})); + var ColorPresentationRequest; + (function(ColorPresentationRequest2) { + ColorPresentationRequest2.type = new messages_1.ProtocolRequestType("textDocument/colorPresentation"); + })(ColorPresentationRequest = exports2.ColorPresentationRequest || (exports2.ColorPresentationRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js +var require_protocol_foldingRange = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.FoldingRangeRequest = exports2.FoldingRangeKind = void 0; + var messages_1 = require_messages2(); + var FoldingRangeKind; + (function(FoldingRangeKind2) { + FoldingRangeKind2["Comment"] = "comment"; + FoldingRangeKind2["Imports"] = "imports"; + FoldingRangeKind2["Region"] = "region"; + })(FoldingRangeKind = exports2.FoldingRangeKind || (exports2.FoldingRangeKind = {})); + var FoldingRangeRequest; + (function(FoldingRangeRequest2) { + FoldingRangeRequest2.method = "textDocument/foldingRange"; + FoldingRangeRequest2.type = new messages_1.ProtocolRequestType(FoldingRangeRequest2.method); + })(FoldingRangeRequest = exports2.FoldingRangeRequest || (exports2.FoldingRangeRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js +var require_protocol_declaration = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.DeclarationRequest = void 0; + var messages_1 = require_messages2(); + var DeclarationRequest; + (function(DeclarationRequest2) { + DeclarationRequest2.method = "textDocument/declaration"; + DeclarationRequest2.type = new messages_1.ProtocolRequestType(DeclarationRequest2.method); + })(DeclarationRequest = exports2.DeclarationRequest || (exports2.DeclarationRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js +var require_protocol_selectionRange = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.SelectionRangeRequest = void 0; + var messages_1 = require_messages2(); + var SelectionRangeRequest; + (function(SelectionRangeRequest2) { + SelectionRangeRequest2.method = "textDocument/selectionRange"; + SelectionRangeRequest2.type = new messages_1.ProtocolRequestType(SelectionRangeRequest2.method); + })(SelectionRangeRequest = exports2.SelectionRangeRequest || (exports2.SelectionRangeRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js +var require_protocol_progress = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = void 0; + var vscode_jsonrpc_1 = require_main(); + var messages_1 = require_messages2(); + var WorkDoneProgress; + (function(WorkDoneProgress2) { + WorkDoneProgress2.type = new vscode_jsonrpc_1.ProgressType(); + function is(value) { + return value === WorkDoneProgress2.type; + } + WorkDoneProgress2.is = is; + })(WorkDoneProgress = exports2.WorkDoneProgress || (exports2.WorkDoneProgress = {})); + var WorkDoneProgressCreateRequest; + (function(WorkDoneProgressCreateRequest2) { + WorkDoneProgressCreateRequest2.type = new messages_1.ProtocolRequestType("window/workDoneProgress/create"); + })(WorkDoneProgressCreateRequest = exports2.WorkDoneProgressCreateRequest || (exports2.WorkDoneProgressCreateRequest = {})); + var WorkDoneProgressCancelNotification; + (function(WorkDoneProgressCancelNotification2) { + WorkDoneProgressCancelNotification2.type = new messages_1.ProtocolNotificationType("window/workDoneProgress/cancel"); + })(WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCancelNotification || (exports2.WorkDoneProgressCancelNotification = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js +var require_protocol_callHierarchy = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.CallHierarchyPrepareRequest = void 0; + var messages_1 = require_messages2(); + var CallHierarchyPrepareRequest; + (function(CallHierarchyPrepareRequest2) { + CallHierarchyPrepareRequest2.method = "textDocument/prepareCallHierarchy"; + CallHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest2.method); + })(CallHierarchyPrepareRequest = exports2.CallHierarchyPrepareRequest || (exports2.CallHierarchyPrepareRequest = {})); + var CallHierarchyIncomingCallsRequest; + (function(CallHierarchyIncomingCallsRequest2) { + CallHierarchyIncomingCallsRequest2.method = "callHierarchy/incomingCalls"; + CallHierarchyIncomingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method); + })(CallHierarchyIncomingCallsRequest = exports2.CallHierarchyIncomingCallsRequest || (exports2.CallHierarchyIncomingCallsRequest = {})); + var CallHierarchyOutgoingCallsRequest; + (function(CallHierarchyOutgoingCallsRequest2) { + CallHierarchyOutgoingCallsRequest2.method = "callHierarchy/outgoingCalls"; + CallHierarchyOutgoingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method); + })(CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyOutgoingCallsRequest || (exports2.CallHierarchyOutgoingCallsRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js +var require_protocol_semanticTokens = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.SemanticTokensRegistrationType = exports2.TokenFormat = exports2.SemanticTokens = exports2.SemanticTokenModifiers = exports2.SemanticTokenTypes = void 0; + var messages_1 = require_messages2(); + var SemanticTokenTypes; + (function(SemanticTokenTypes2) { + SemanticTokenTypes2["namespace"] = "namespace"; + SemanticTokenTypes2["type"] = "type"; + SemanticTokenTypes2["class"] = "class"; + SemanticTokenTypes2["enum"] = "enum"; + SemanticTokenTypes2["interface"] = "interface"; + SemanticTokenTypes2["struct"] = "struct"; + SemanticTokenTypes2["typeParameter"] = "typeParameter"; + SemanticTokenTypes2["parameter"] = "parameter"; + SemanticTokenTypes2["variable"] = "variable"; + SemanticTokenTypes2["property"] = "property"; + SemanticTokenTypes2["enumMember"] = "enumMember"; + SemanticTokenTypes2["event"] = "event"; + SemanticTokenTypes2["function"] = "function"; + SemanticTokenTypes2["method"] = "method"; + SemanticTokenTypes2["macro"] = "macro"; + SemanticTokenTypes2["keyword"] = "keyword"; + SemanticTokenTypes2["modifier"] = "modifier"; + SemanticTokenTypes2["comment"] = "comment"; + SemanticTokenTypes2["string"] = "string"; + SemanticTokenTypes2["number"] = "number"; + SemanticTokenTypes2["regexp"] = "regexp"; + SemanticTokenTypes2["operator"] = "operator"; + })(SemanticTokenTypes = exports2.SemanticTokenTypes || (exports2.SemanticTokenTypes = {})); + var SemanticTokenModifiers; + (function(SemanticTokenModifiers2) { + SemanticTokenModifiers2["declaration"] = "declaration"; + SemanticTokenModifiers2["definition"] = "definition"; + SemanticTokenModifiers2["readonly"] = "readonly"; + SemanticTokenModifiers2["static"] = "static"; + SemanticTokenModifiers2["deprecated"] = "deprecated"; + SemanticTokenModifiers2["abstract"] = "abstract"; + SemanticTokenModifiers2["async"] = "async"; + SemanticTokenModifiers2["modification"] = "modification"; + SemanticTokenModifiers2["documentation"] = "documentation"; + SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary"; + })(SemanticTokenModifiers = exports2.SemanticTokenModifiers || (exports2.SemanticTokenModifiers = {})); + var SemanticTokens; + (function(SemanticTokens2) { + function is(value) { + const candidate = value; + return candidate !== void 0 && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number"); + } + SemanticTokens2.is = is; + })(SemanticTokens = exports2.SemanticTokens || (exports2.SemanticTokens = {})); + var TokenFormat; + (function(TokenFormat2) { + TokenFormat2.Relative = "relative"; + })(TokenFormat = exports2.TokenFormat || (exports2.TokenFormat = {})); + var SemanticTokensRegistrationType; + (function(SemanticTokensRegistrationType2) { + SemanticTokensRegistrationType2.method = "textDocument/semanticTokens"; + SemanticTokensRegistrationType2.type = new messages_1.RegistrationType(SemanticTokensRegistrationType2.method); + })(SemanticTokensRegistrationType = exports2.SemanticTokensRegistrationType || (exports2.SemanticTokensRegistrationType = {})); + var SemanticTokensRequest; + (function(SemanticTokensRequest2) { + SemanticTokensRequest2.method = "textDocument/semanticTokens/full"; + SemanticTokensRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRequest2.method); + })(SemanticTokensRequest = exports2.SemanticTokensRequest || (exports2.SemanticTokensRequest = {})); + var SemanticTokensDeltaRequest; + (function(SemanticTokensDeltaRequest2) { + SemanticTokensDeltaRequest2.method = "textDocument/semanticTokens/full/delta"; + SemanticTokensDeltaRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest2.method); + })(SemanticTokensDeltaRequest = exports2.SemanticTokensDeltaRequest || (exports2.SemanticTokensDeltaRequest = {})); + var SemanticTokensRangeRequest; + (function(SemanticTokensRangeRequest2) { + SemanticTokensRangeRequest2.method = "textDocument/semanticTokens/range"; + SemanticTokensRangeRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest2.method); + })(SemanticTokensRangeRequest = exports2.SemanticTokensRangeRequest || (exports2.SemanticTokensRangeRequest = {})); + var SemanticTokensRefreshRequest; + (function(SemanticTokensRefreshRequest2) { + SemanticTokensRefreshRequest2.method = `workspace/semanticTokens/refresh`; + SemanticTokensRefreshRequest2.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method); + })(SemanticTokensRefreshRequest = exports2.SemanticTokensRefreshRequest || (exports2.SemanticTokensRefreshRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js +var require_protocol_showDocument = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.ShowDocumentRequest = void 0; + var messages_1 = require_messages2(); + var ShowDocumentRequest; + (function(ShowDocumentRequest2) { + ShowDocumentRequest2.method = "window/showDocument"; + ShowDocumentRequest2.type = new messages_1.ProtocolRequestType(ShowDocumentRequest2.method); + })(ShowDocumentRequest = exports2.ShowDocumentRequest || (exports2.ShowDocumentRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js +var require_protocol_linkedEditingRange = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.LinkedEditingRangeRequest = void 0; + var messages_1 = require_messages2(); + var LinkedEditingRangeRequest; + (function(LinkedEditingRangeRequest2) { + LinkedEditingRangeRequest2.method = "textDocument/linkedEditingRange"; + LinkedEditingRangeRequest2.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest2.method); + })(LinkedEditingRangeRequest = exports2.LinkedEditingRangeRequest || (exports2.LinkedEditingRangeRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js +var require_protocol_fileOperations = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.DidRenameFilesNotification = exports2.WillRenameFilesRequest = exports2.DidCreateFilesNotification = exports2.WillCreateFilesRequest = exports2.FileOperationPatternKind = void 0; + var messages_1 = require_messages2(); + var FileOperationPatternKind; + (function(FileOperationPatternKind2) { + FileOperationPatternKind2.file = "file"; + FileOperationPatternKind2.folder = "folder"; + })(FileOperationPatternKind = exports2.FileOperationPatternKind || (exports2.FileOperationPatternKind = {})); + var WillCreateFilesRequest; + (function(WillCreateFilesRequest2) { + WillCreateFilesRequest2.method = "workspace/willCreateFiles"; + WillCreateFilesRequest2.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method); + })(WillCreateFilesRequest = exports2.WillCreateFilesRequest || (exports2.WillCreateFilesRequest = {})); + var DidCreateFilesNotification; + (function(DidCreateFilesNotification2) { + DidCreateFilesNotification2.method = "workspace/didCreateFiles"; + DidCreateFilesNotification2.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method); + })(DidCreateFilesNotification = exports2.DidCreateFilesNotification || (exports2.DidCreateFilesNotification = {})); + var WillRenameFilesRequest; + (function(WillRenameFilesRequest2) { + WillRenameFilesRequest2.method = "workspace/willRenameFiles"; + WillRenameFilesRequest2.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method); + })(WillRenameFilesRequest = exports2.WillRenameFilesRequest || (exports2.WillRenameFilesRequest = {})); + var DidRenameFilesNotification; + (function(DidRenameFilesNotification2) { + DidRenameFilesNotification2.method = "workspace/didRenameFiles"; + DidRenameFilesNotification2.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method); + })(DidRenameFilesNotification = exports2.DidRenameFilesNotification || (exports2.DidRenameFilesNotification = {})); + var DidDeleteFilesNotification; + (function(DidDeleteFilesNotification2) { + DidDeleteFilesNotification2.method = "workspace/didDeleteFiles"; + DidDeleteFilesNotification2.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method); + })(DidDeleteFilesNotification = exports2.DidDeleteFilesNotification || (exports2.DidDeleteFilesNotification = {})); + var WillDeleteFilesRequest; + (function(WillDeleteFilesRequest2) { + WillDeleteFilesRequest2.method = "workspace/willDeleteFiles"; + WillDeleteFilesRequest2.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method); + })(WillDeleteFilesRequest = exports2.WillDeleteFilesRequest || (exports2.WillDeleteFilesRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js +var require_protocol_moniker = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = void 0; + var messages_1 = require_messages2(); + var UniquenessLevel; + (function(UniquenessLevel2) { + UniquenessLevel2["document"] = "document"; + UniquenessLevel2["project"] = "project"; + UniquenessLevel2["group"] = "group"; + UniquenessLevel2["scheme"] = "scheme"; + UniquenessLevel2["global"] = "global"; + })(UniquenessLevel = exports2.UniquenessLevel || (exports2.UniquenessLevel = {})); + var MonikerKind; + (function(MonikerKind2) { + MonikerKind2["import"] = "import"; + MonikerKind2["export"] = "export"; + MonikerKind2["local"] = "local"; + })(MonikerKind = exports2.MonikerKind || (exports2.MonikerKind = {})); + var MonikerRequest; + (function(MonikerRequest2) { + MonikerRequest2.method = "textDocument/moniker"; + MonikerRequest2.type = new messages_1.ProtocolRequestType(MonikerRequest2.method); + })(MonikerRequest = exports2.MonikerRequest || (exports2.MonikerRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.js +var require_protocol = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.DocumentLinkRequest = exports2.CodeLensRefreshRequest = exports2.CodeLensResolveRequest = exports2.CodeLensRequest = exports2.WorkspaceSymbolRequest = exports2.CodeActionResolveRequest = exports2.CodeActionRequest = exports2.DocumentSymbolRequest = exports2.DocumentHighlightRequest = exports2.ReferencesRequest = exports2.DefinitionRequest = exports2.SignatureHelpRequest = exports2.SignatureHelpTriggerKind = exports2.HoverRequest = exports2.CompletionResolveRequest = exports2.CompletionRequest = exports2.CompletionTriggerKind = exports2.PublishDiagnosticsNotification = exports2.WatchKind = exports2.FileChangeType = exports2.DidChangeWatchedFilesNotification = exports2.WillSaveTextDocumentWaitUntilRequest = exports2.WillSaveTextDocumentNotification = exports2.TextDocumentSaveReason = exports2.DidSaveTextDocumentNotification = exports2.DidCloseTextDocumentNotification = exports2.DidChangeTextDocumentNotification = exports2.TextDocumentContentChangeEvent = exports2.DidOpenTextDocumentNotification = exports2.TextDocumentSyncKind = exports2.TelemetryEventNotification = exports2.LogMessageNotification = exports2.ShowMessageRequest = exports2.ShowMessageNotification = exports2.MessageType = exports2.DidChangeConfigurationNotification = exports2.ExitNotification = exports2.ShutdownRequest = exports2.InitializedNotification = exports2.InitializeError = exports2.InitializeRequest = exports2.WorkDoneProgressOptions = exports2.TextDocumentRegistrationOptions = exports2.StaticRegistrationOptions = exports2.FailureHandlingKind = exports2.ResourceOperationKind = exports2.UnregistrationRequest = exports2.RegistrationRequest = exports2.DocumentSelector = exports2.DocumentFilter = void 0; + exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.WillRenameFilesRequest = exports2.DidRenameFilesNotification = exports2.WillCreateFilesRequest = exports2.DidCreateFilesNotification = exports2.FileOperationPatternKind = exports2.LinkedEditingRangeRequest = exports2.ShowDocumentRequest = exports2.SemanticTokensRegistrationType = exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.TokenFormat = exports2.SemanticTokens = exports2.SemanticTokenModifiers = exports2.SemanticTokenTypes = exports2.CallHierarchyPrepareRequest = exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = exports2.SelectionRangeRequest = exports2.DeclarationRequest = exports2.FoldingRangeRequest = exports2.ColorPresentationRequest = exports2.DocumentColorRequest = exports2.ConfigurationRequest = exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = exports2.TypeDefinitionRequest = exports2.ImplementationRequest = exports2.ApplyWorkspaceEditRequest = exports2.ExecuteCommandRequest = exports2.PrepareRenameRequest = exports2.RenameRequest = exports2.PrepareSupportDefaultBehavior = exports2.DocumentOnTypeFormattingRequest = exports2.DocumentRangeFormattingRequest = exports2.DocumentFormattingRequest = exports2.DocumentLinkResolveRequest = void 0; + var Is = require_is2(); + var messages_1 = require_messages2(); + var protocol_implementation_1 = require_protocol_implementation(); + Object.defineProperty(exports2, "ImplementationRequest", {enumerable: true, get: function() { + return protocol_implementation_1.ImplementationRequest; + }}); + var protocol_typeDefinition_1 = require_protocol_typeDefinition(); + Object.defineProperty(exports2, "TypeDefinitionRequest", {enumerable: true, get: function() { + return protocol_typeDefinition_1.TypeDefinitionRequest; + }}); + var protocol_workspaceFolders_1 = require_protocol_workspaceFolders(); + Object.defineProperty(exports2, "WorkspaceFoldersRequest", {enumerable: true, get: function() { + return protocol_workspaceFolders_1.WorkspaceFoldersRequest; + }}); + Object.defineProperty(exports2, "DidChangeWorkspaceFoldersNotification", {enumerable: true, get: function() { + return protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification; + }}); + var protocol_configuration_1 = require_protocol_configuration(); + Object.defineProperty(exports2, "ConfigurationRequest", {enumerable: true, get: function() { + return protocol_configuration_1.ConfigurationRequest; + }}); + var protocol_colorProvider_1 = require_protocol_colorProvider(); + Object.defineProperty(exports2, "DocumentColorRequest", {enumerable: true, get: function() { + return protocol_colorProvider_1.DocumentColorRequest; + }}); + Object.defineProperty(exports2, "ColorPresentationRequest", {enumerable: true, get: function() { + return protocol_colorProvider_1.ColorPresentationRequest; + }}); + var protocol_foldingRange_1 = require_protocol_foldingRange(); + Object.defineProperty(exports2, "FoldingRangeRequest", {enumerable: true, get: function() { + return protocol_foldingRange_1.FoldingRangeRequest; + }}); + var protocol_declaration_1 = require_protocol_declaration(); + Object.defineProperty(exports2, "DeclarationRequest", {enumerable: true, get: function() { + return protocol_declaration_1.DeclarationRequest; + }}); + var protocol_selectionRange_1 = require_protocol_selectionRange(); + Object.defineProperty(exports2, "SelectionRangeRequest", {enumerable: true, get: function() { + return protocol_selectionRange_1.SelectionRangeRequest; + }}); + var protocol_progress_1 = require_protocol_progress(); + Object.defineProperty(exports2, "WorkDoneProgress", {enumerable: true, get: function() { + return protocol_progress_1.WorkDoneProgress; + }}); + Object.defineProperty(exports2, "WorkDoneProgressCreateRequest", {enumerable: true, get: function() { + return protocol_progress_1.WorkDoneProgressCreateRequest; + }}); + Object.defineProperty(exports2, "WorkDoneProgressCancelNotification", {enumerable: true, get: function() { + return protocol_progress_1.WorkDoneProgressCancelNotification; + }}); + var protocol_callHierarchy_1 = require_protocol_callHierarchy(); + Object.defineProperty(exports2, "CallHierarchyIncomingCallsRequest", {enumerable: true, get: function() { + return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest; + }}); + Object.defineProperty(exports2, "CallHierarchyOutgoingCallsRequest", {enumerable: true, get: function() { + return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest; + }}); + Object.defineProperty(exports2, "CallHierarchyPrepareRequest", {enumerable: true, get: function() { + return protocol_callHierarchy_1.CallHierarchyPrepareRequest; + }}); + var protocol_semanticTokens_1 = require_protocol_semanticTokens(); + Object.defineProperty(exports2, "SemanticTokenTypes", {enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokenTypes; + }}); + Object.defineProperty(exports2, "SemanticTokenModifiers", {enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokenModifiers; + }}); + Object.defineProperty(exports2, "SemanticTokens", {enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokens; + }}); + Object.defineProperty(exports2, "TokenFormat", {enumerable: true, get: function() { + return protocol_semanticTokens_1.TokenFormat; + }}); + Object.defineProperty(exports2, "SemanticTokensRequest", {enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokensRequest; + }}); + Object.defineProperty(exports2, "SemanticTokensDeltaRequest", {enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokensDeltaRequest; + }}); + Object.defineProperty(exports2, "SemanticTokensRangeRequest", {enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokensRangeRequest; + }}); + Object.defineProperty(exports2, "SemanticTokensRefreshRequest", {enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokensRefreshRequest; + }}); + Object.defineProperty(exports2, "SemanticTokensRegistrationType", {enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokensRegistrationType; + }}); + var protocol_showDocument_1 = require_protocol_showDocument(); + Object.defineProperty(exports2, "ShowDocumentRequest", {enumerable: true, get: function() { + return protocol_showDocument_1.ShowDocumentRequest; + }}); + var protocol_linkedEditingRange_1 = require_protocol_linkedEditingRange(); + Object.defineProperty(exports2, "LinkedEditingRangeRequest", {enumerable: true, get: function() { + return protocol_linkedEditingRange_1.LinkedEditingRangeRequest; + }}); + var protocol_fileOperations_1 = require_protocol_fileOperations(); + Object.defineProperty(exports2, "FileOperationPatternKind", {enumerable: true, get: function() { + return protocol_fileOperations_1.FileOperationPatternKind; + }}); + Object.defineProperty(exports2, "DidCreateFilesNotification", {enumerable: true, get: function() { + return protocol_fileOperations_1.DidCreateFilesNotification; + }}); + Object.defineProperty(exports2, "WillCreateFilesRequest", {enumerable: true, get: function() { + return protocol_fileOperations_1.WillCreateFilesRequest; + }}); + Object.defineProperty(exports2, "DidRenameFilesNotification", {enumerable: true, get: function() { + return protocol_fileOperations_1.DidRenameFilesNotification; + }}); + Object.defineProperty(exports2, "WillRenameFilesRequest", {enumerable: true, get: function() { + return protocol_fileOperations_1.WillRenameFilesRequest; + }}); + Object.defineProperty(exports2, "DidDeleteFilesNotification", {enumerable: true, get: function() { + return protocol_fileOperations_1.DidDeleteFilesNotification; + }}); + Object.defineProperty(exports2, "WillDeleteFilesRequest", {enumerable: true, get: function() { + return protocol_fileOperations_1.WillDeleteFilesRequest; + }}); + var protocol_moniker_1 = require_protocol_moniker(); + Object.defineProperty(exports2, "UniquenessLevel", {enumerable: true, get: function() { + return protocol_moniker_1.UniquenessLevel; + }}); + Object.defineProperty(exports2, "MonikerKind", {enumerable: true, get: function() { + return protocol_moniker_1.MonikerKind; + }}); + Object.defineProperty(exports2, "MonikerRequest", {enumerable: true, get: function() { + return protocol_moniker_1.MonikerRequest; + }}); + var DocumentFilter; + (function(DocumentFilter2) { + function is(value) { + const candidate = value; + return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern); + } + DocumentFilter2.is = is; + })(DocumentFilter = exports2.DocumentFilter || (exports2.DocumentFilter = {})); + var DocumentSelector; + (function(DocumentSelector2) { + function is(value) { + if (!Array.isArray(value)) { + return false; + } + for (let elem of value) { + if (!Is.string(elem) && !DocumentFilter.is(elem)) { + return false; + } + } + return true; + } + DocumentSelector2.is = is; + })(DocumentSelector = exports2.DocumentSelector || (exports2.DocumentSelector = {})); + var RegistrationRequest; + (function(RegistrationRequest2) { + RegistrationRequest2.type = new messages_1.ProtocolRequestType("client/registerCapability"); + })(RegistrationRequest = exports2.RegistrationRequest || (exports2.RegistrationRequest = {})); + var UnregistrationRequest; + (function(UnregistrationRequest2) { + UnregistrationRequest2.type = new messages_1.ProtocolRequestType("client/unregisterCapability"); + })(UnregistrationRequest = exports2.UnregistrationRequest || (exports2.UnregistrationRequest = {})); + var ResourceOperationKind; + (function(ResourceOperationKind2) { + ResourceOperationKind2.Create = "create"; + ResourceOperationKind2.Rename = "rename"; + ResourceOperationKind2.Delete = "delete"; + })(ResourceOperationKind = exports2.ResourceOperationKind || (exports2.ResourceOperationKind = {})); + var FailureHandlingKind; + (function(FailureHandlingKind2) { + FailureHandlingKind2.Abort = "abort"; + FailureHandlingKind2.Transactional = "transactional"; + FailureHandlingKind2.TextOnlyTransactional = "textOnlyTransactional"; + FailureHandlingKind2.Undo = "undo"; + })(FailureHandlingKind = exports2.FailureHandlingKind || (exports2.FailureHandlingKind = {})); + var StaticRegistrationOptions; + (function(StaticRegistrationOptions2) { + function hasId(value) { + const candidate = value; + return candidate && Is.string(candidate.id) && candidate.id.length > 0; + } + StaticRegistrationOptions2.hasId = hasId; + })(StaticRegistrationOptions = exports2.StaticRegistrationOptions || (exports2.StaticRegistrationOptions = {})); + var TextDocumentRegistrationOptions; + (function(TextDocumentRegistrationOptions2) { + function is(value) { + const candidate = value; + return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector)); + } + TextDocumentRegistrationOptions2.is = is; + })(TextDocumentRegistrationOptions = exports2.TextDocumentRegistrationOptions || (exports2.TextDocumentRegistrationOptions = {})); + var WorkDoneProgressOptions; + (function(WorkDoneProgressOptions2) { + function is(value) { + const candidate = value; + return Is.objectLiteral(candidate) && (candidate.workDoneProgress === void 0 || Is.boolean(candidate.workDoneProgress)); + } + WorkDoneProgressOptions2.is = is; + function hasWorkDoneProgress(value) { + const candidate = value; + return candidate && Is.boolean(candidate.workDoneProgress); + } + WorkDoneProgressOptions2.hasWorkDoneProgress = hasWorkDoneProgress; + })(WorkDoneProgressOptions = exports2.WorkDoneProgressOptions || (exports2.WorkDoneProgressOptions = {})); + var InitializeRequest; + (function(InitializeRequest2) { + InitializeRequest2.type = new messages_1.ProtocolRequestType("initialize"); + })(InitializeRequest = exports2.InitializeRequest || (exports2.InitializeRequest = {})); + var InitializeError; + (function(InitializeError2) { + InitializeError2.unknownProtocolVersion = 1; + })(InitializeError = exports2.InitializeError || (exports2.InitializeError = {})); + var InitializedNotification; + (function(InitializedNotification2) { + InitializedNotification2.type = new messages_1.ProtocolNotificationType("initialized"); + })(InitializedNotification = exports2.InitializedNotification || (exports2.InitializedNotification = {})); + var ShutdownRequest; + (function(ShutdownRequest2) { + ShutdownRequest2.type = new messages_1.ProtocolRequestType0("shutdown"); + })(ShutdownRequest = exports2.ShutdownRequest || (exports2.ShutdownRequest = {})); + var ExitNotification; + (function(ExitNotification2) { + ExitNotification2.type = new messages_1.ProtocolNotificationType0("exit"); + })(ExitNotification = exports2.ExitNotification || (exports2.ExitNotification = {})); + var DidChangeConfigurationNotification; + (function(DidChangeConfigurationNotification2) { + DidChangeConfigurationNotification2.type = new messages_1.ProtocolNotificationType("workspace/didChangeConfiguration"); + })(DidChangeConfigurationNotification = exports2.DidChangeConfigurationNotification || (exports2.DidChangeConfigurationNotification = {})); + var MessageType; + (function(MessageType2) { + MessageType2.Error = 1; + MessageType2.Warning = 2; + MessageType2.Info = 3; + MessageType2.Log = 4; + })(MessageType = exports2.MessageType || (exports2.MessageType = {})); + var ShowMessageNotification; + (function(ShowMessageNotification2) { + ShowMessageNotification2.type = new messages_1.ProtocolNotificationType("window/showMessage"); + })(ShowMessageNotification = exports2.ShowMessageNotification || (exports2.ShowMessageNotification = {})); + var ShowMessageRequest; + (function(ShowMessageRequest2) { + ShowMessageRequest2.type = new messages_1.ProtocolRequestType("window/showMessageRequest"); + })(ShowMessageRequest = exports2.ShowMessageRequest || (exports2.ShowMessageRequest = {})); + var LogMessageNotification; + (function(LogMessageNotification2) { + LogMessageNotification2.type = new messages_1.ProtocolNotificationType("window/logMessage"); + })(LogMessageNotification = exports2.LogMessageNotification || (exports2.LogMessageNotification = {})); + var TelemetryEventNotification; + (function(TelemetryEventNotification2) { + TelemetryEventNotification2.type = new messages_1.ProtocolNotificationType("telemetry/event"); + })(TelemetryEventNotification = exports2.TelemetryEventNotification || (exports2.TelemetryEventNotification = {})); + var TextDocumentSyncKind; + (function(TextDocumentSyncKind2) { + TextDocumentSyncKind2.None = 0; + TextDocumentSyncKind2.Full = 1; + TextDocumentSyncKind2.Incremental = 2; + })(TextDocumentSyncKind = exports2.TextDocumentSyncKind || (exports2.TextDocumentSyncKind = {})); + var DidOpenTextDocumentNotification; + (function(DidOpenTextDocumentNotification2) { + DidOpenTextDocumentNotification2.method = "textDocument/didOpen"; + DidOpenTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification2.method); + })(DidOpenTextDocumentNotification = exports2.DidOpenTextDocumentNotification || (exports2.DidOpenTextDocumentNotification = {})); + var TextDocumentContentChangeEvent; + (function(TextDocumentContentChangeEvent2) { + function isIncremental(event) { + let candidate = event; + return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number"); + } + TextDocumentContentChangeEvent2.isIncremental = isIncremental; + function isFull(event) { + let candidate = event; + return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0; + } + TextDocumentContentChangeEvent2.isFull = isFull; + })(TextDocumentContentChangeEvent = exports2.TextDocumentContentChangeEvent || (exports2.TextDocumentContentChangeEvent = {})); + var DidChangeTextDocumentNotification; + (function(DidChangeTextDocumentNotification2) { + DidChangeTextDocumentNotification2.method = "textDocument/didChange"; + DidChangeTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification2.method); + })(DidChangeTextDocumentNotification = exports2.DidChangeTextDocumentNotification || (exports2.DidChangeTextDocumentNotification = {})); + var DidCloseTextDocumentNotification; + (function(DidCloseTextDocumentNotification2) { + DidCloseTextDocumentNotification2.method = "textDocument/didClose"; + DidCloseTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification2.method); + })(DidCloseTextDocumentNotification = exports2.DidCloseTextDocumentNotification || (exports2.DidCloseTextDocumentNotification = {})); + var DidSaveTextDocumentNotification; + (function(DidSaveTextDocumentNotification2) { + DidSaveTextDocumentNotification2.method = "textDocument/didSave"; + DidSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method); + })(DidSaveTextDocumentNotification = exports2.DidSaveTextDocumentNotification || (exports2.DidSaveTextDocumentNotification = {})); + var TextDocumentSaveReason; + (function(TextDocumentSaveReason2) { + TextDocumentSaveReason2.Manual = 1; + TextDocumentSaveReason2.AfterDelay = 2; + TextDocumentSaveReason2.FocusOut = 3; + })(TextDocumentSaveReason = exports2.TextDocumentSaveReason || (exports2.TextDocumentSaveReason = {})); + var WillSaveTextDocumentNotification; + (function(WillSaveTextDocumentNotification2) { + WillSaveTextDocumentNotification2.method = "textDocument/willSave"; + WillSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method); + })(WillSaveTextDocumentNotification = exports2.WillSaveTextDocumentNotification || (exports2.WillSaveTextDocumentNotification = {})); + var WillSaveTextDocumentWaitUntilRequest; + (function(WillSaveTextDocumentWaitUntilRequest2) { + WillSaveTextDocumentWaitUntilRequest2.method = "textDocument/willSaveWaitUntil"; + WillSaveTextDocumentWaitUntilRequest2.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method); + })(WillSaveTextDocumentWaitUntilRequest = exports2.WillSaveTextDocumentWaitUntilRequest || (exports2.WillSaveTextDocumentWaitUntilRequest = {})); + var DidChangeWatchedFilesNotification; + (function(DidChangeWatchedFilesNotification2) { + DidChangeWatchedFilesNotification2.type = new messages_1.ProtocolNotificationType("workspace/didChangeWatchedFiles"); + })(DidChangeWatchedFilesNotification = exports2.DidChangeWatchedFilesNotification || (exports2.DidChangeWatchedFilesNotification = {})); + var FileChangeType; + (function(FileChangeType2) { + FileChangeType2.Created = 1; + FileChangeType2.Changed = 2; + FileChangeType2.Deleted = 3; + })(FileChangeType = exports2.FileChangeType || (exports2.FileChangeType = {})); + var WatchKind; + (function(WatchKind2) { + WatchKind2.Create = 1; + WatchKind2.Change = 2; + WatchKind2.Delete = 4; + })(WatchKind = exports2.WatchKind || (exports2.WatchKind = {})); + var PublishDiagnosticsNotification; + (function(PublishDiagnosticsNotification2) { + PublishDiagnosticsNotification2.type = new messages_1.ProtocolNotificationType("textDocument/publishDiagnostics"); + })(PublishDiagnosticsNotification = exports2.PublishDiagnosticsNotification || (exports2.PublishDiagnosticsNotification = {})); + var CompletionTriggerKind; + (function(CompletionTriggerKind2) { + CompletionTriggerKind2.Invoked = 1; + CompletionTriggerKind2.TriggerCharacter = 2; + CompletionTriggerKind2.TriggerForIncompleteCompletions = 3; + })(CompletionTriggerKind = exports2.CompletionTriggerKind || (exports2.CompletionTriggerKind = {})); + var CompletionRequest; + (function(CompletionRequest2) { + CompletionRequest2.method = "textDocument/completion"; + CompletionRequest2.type = new messages_1.ProtocolRequestType(CompletionRequest2.method); + })(CompletionRequest = exports2.CompletionRequest || (exports2.CompletionRequest = {})); + var CompletionResolveRequest; + (function(CompletionResolveRequest2) { + CompletionResolveRequest2.method = "completionItem/resolve"; + CompletionResolveRequest2.type = new messages_1.ProtocolRequestType(CompletionResolveRequest2.method); + })(CompletionResolveRequest = exports2.CompletionResolveRequest || (exports2.CompletionResolveRequest = {})); + var HoverRequest; + (function(HoverRequest2) { + HoverRequest2.method = "textDocument/hover"; + HoverRequest2.type = new messages_1.ProtocolRequestType(HoverRequest2.method); + })(HoverRequest = exports2.HoverRequest || (exports2.HoverRequest = {})); + var SignatureHelpTriggerKind; + (function(SignatureHelpTriggerKind2) { + SignatureHelpTriggerKind2.Invoked = 1; + SignatureHelpTriggerKind2.TriggerCharacter = 2; + SignatureHelpTriggerKind2.ContentChange = 3; + })(SignatureHelpTriggerKind = exports2.SignatureHelpTriggerKind || (exports2.SignatureHelpTriggerKind = {})); + var SignatureHelpRequest; + (function(SignatureHelpRequest2) { + SignatureHelpRequest2.method = "textDocument/signatureHelp"; + SignatureHelpRequest2.type = new messages_1.ProtocolRequestType(SignatureHelpRequest2.method); + })(SignatureHelpRequest = exports2.SignatureHelpRequest || (exports2.SignatureHelpRequest = {})); + var DefinitionRequest; + (function(DefinitionRequest2) { + DefinitionRequest2.method = "textDocument/definition"; + DefinitionRequest2.type = new messages_1.ProtocolRequestType(DefinitionRequest2.method); + })(DefinitionRequest = exports2.DefinitionRequest || (exports2.DefinitionRequest = {})); + var ReferencesRequest; + (function(ReferencesRequest2) { + ReferencesRequest2.method = "textDocument/references"; + ReferencesRequest2.type = new messages_1.ProtocolRequestType(ReferencesRequest2.method); + })(ReferencesRequest = exports2.ReferencesRequest || (exports2.ReferencesRequest = {})); + var DocumentHighlightRequest; + (function(DocumentHighlightRequest2) { + DocumentHighlightRequest2.method = "textDocument/documentHighlight"; + DocumentHighlightRequest2.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method); + })(DocumentHighlightRequest = exports2.DocumentHighlightRequest || (exports2.DocumentHighlightRequest = {})); + var DocumentSymbolRequest; + (function(DocumentSymbolRequest2) { + DocumentSymbolRequest2.method = "textDocument/documentSymbol"; + DocumentSymbolRequest2.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest2.method); + })(DocumentSymbolRequest = exports2.DocumentSymbolRequest || (exports2.DocumentSymbolRequest = {})); + var CodeActionRequest; + (function(CodeActionRequest2) { + CodeActionRequest2.method = "textDocument/codeAction"; + CodeActionRequest2.type = new messages_1.ProtocolRequestType(CodeActionRequest2.method); + })(CodeActionRequest = exports2.CodeActionRequest || (exports2.CodeActionRequest = {})); + var CodeActionResolveRequest; + (function(CodeActionResolveRequest2) { + CodeActionResolveRequest2.method = "codeAction/resolve"; + CodeActionResolveRequest2.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method); + })(CodeActionResolveRequest = exports2.CodeActionResolveRequest || (exports2.CodeActionResolveRequest = {})); + var WorkspaceSymbolRequest; + (function(WorkspaceSymbolRequest2) { + WorkspaceSymbolRequest2.method = "workspace/symbol"; + WorkspaceSymbolRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest2.method); + })(WorkspaceSymbolRequest = exports2.WorkspaceSymbolRequest || (exports2.WorkspaceSymbolRequest = {})); + var CodeLensRequest; + (function(CodeLensRequest2) { + CodeLensRequest2.method = "textDocument/codeLens"; + CodeLensRequest2.type = new messages_1.ProtocolRequestType(CodeLensRequest2.method); + })(CodeLensRequest = exports2.CodeLensRequest || (exports2.CodeLensRequest = {})); + var CodeLensResolveRequest; + (function(CodeLensResolveRequest2) { + CodeLensResolveRequest2.method = "codeLens/resolve"; + CodeLensResolveRequest2.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method); + })(CodeLensResolveRequest = exports2.CodeLensResolveRequest || (exports2.CodeLensResolveRequest = {})); + var CodeLensRefreshRequest; + (function(CodeLensRefreshRequest2) { + CodeLensRefreshRequest2.method = `workspace/codeLens/refresh`; + CodeLensRefreshRequest2.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest2.method); + })(CodeLensRefreshRequest = exports2.CodeLensRefreshRequest || (exports2.CodeLensRefreshRequest = {})); + var DocumentLinkRequest; + (function(DocumentLinkRequest2) { + DocumentLinkRequest2.method = "textDocument/documentLink"; + DocumentLinkRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkRequest2.method); + })(DocumentLinkRequest = exports2.DocumentLinkRequest || (exports2.DocumentLinkRequest = {})); + var DocumentLinkResolveRequest; + (function(DocumentLinkResolveRequest2) { + DocumentLinkResolveRequest2.method = "documentLink/resolve"; + DocumentLinkResolveRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method); + })(DocumentLinkResolveRequest = exports2.DocumentLinkResolveRequest || (exports2.DocumentLinkResolveRequest = {})); + var DocumentFormattingRequest; + (function(DocumentFormattingRequest2) { + DocumentFormattingRequest2.method = "textDocument/formatting"; + DocumentFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method); + })(DocumentFormattingRequest = exports2.DocumentFormattingRequest || (exports2.DocumentFormattingRequest = {})); + var DocumentRangeFormattingRequest; + (function(DocumentRangeFormattingRequest2) { + DocumentRangeFormattingRequest2.method = "textDocument/rangeFormatting"; + DocumentRangeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method); + })(DocumentRangeFormattingRequest = exports2.DocumentRangeFormattingRequest || (exports2.DocumentRangeFormattingRequest = {})); + var DocumentOnTypeFormattingRequest; + (function(DocumentOnTypeFormattingRequest2) { + DocumentOnTypeFormattingRequest2.method = "textDocument/onTypeFormatting"; + DocumentOnTypeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method); + })(DocumentOnTypeFormattingRequest = exports2.DocumentOnTypeFormattingRequest || (exports2.DocumentOnTypeFormattingRequest = {})); + var PrepareSupportDefaultBehavior; + (function(PrepareSupportDefaultBehavior2) { + PrepareSupportDefaultBehavior2.Identifier = 1; + })(PrepareSupportDefaultBehavior = exports2.PrepareSupportDefaultBehavior || (exports2.PrepareSupportDefaultBehavior = {})); + var RenameRequest; + (function(RenameRequest2) { + RenameRequest2.method = "textDocument/rename"; + RenameRequest2.type = new messages_1.ProtocolRequestType(RenameRequest2.method); + })(RenameRequest = exports2.RenameRequest || (exports2.RenameRequest = {})); + var PrepareRenameRequest; + (function(PrepareRenameRequest2) { + PrepareRenameRequest2.method = "textDocument/prepareRename"; + PrepareRenameRequest2.type = new messages_1.ProtocolRequestType(PrepareRenameRequest2.method); + })(PrepareRenameRequest = exports2.PrepareRenameRequest || (exports2.PrepareRenameRequest = {})); + var ExecuteCommandRequest; + (function(ExecuteCommandRequest2) { + ExecuteCommandRequest2.type = new messages_1.ProtocolRequestType("workspace/executeCommand"); + })(ExecuteCommandRequest = exports2.ExecuteCommandRequest || (exports2.ExecuteCommandRequest = {})); + var ApplyWorkspaceEditRequest; + (function(ApplyWorkspaceEditRequest2) { + ApplyWorkspaceEditRequest2.type = new messages_1.ProtocolRequestType("workspace/applyEdit"); + })(ApplyWorkspaceEditRequest = exports2.ApplyWorkspaceEditRequest || (exports2.ApplyWorkspaceEditRequest = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/common/connection.js +var require_connection2 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.createProtocolConnection = void 0; + var vscode_jsonrpc_1 = require_main(); + function createProtocolConnection(input, output, logger, options) { + if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) { + options = {connectionStrategy: options}; + } + return vscode_jsonrpc_1.createMessageConnection(input, output, logger, options); + } + exports2.createProtocolConnection = createProtocolConnection; +}); + +// node_modules/vscode-languageserver-protocol/lib/common/api.js +var require_api2 = __commonJS((exports2) => { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, {enumerable: true, get: function() { + return m[k]; + }}); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) + if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) + __createBinding(exports3, m, p); + }; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.LSPErrorCodes = exports2.createProtocolConnection = void 0; + __exportStar2(require_main(), exports2); + __exportStar2(require_main2(), exports2); + __exportStar2(require_messages2(), exports2); + __exportStar2(require_protocol(), exports2); + var connection_1 = require_connection2(); + Object.defineProperty(exports2, "createProtocolConnection", {enumerable: true, get: function() { + return connection_1.createProtocolConnection; + }}); + var LSPErrorCodes; + (function(LSPErrorCodes2) { + LSPErrorCodes2.lspReservedErrorRangeStart = -32899; + LSPErrorCodes2.ContentModified = -32801; + LSPErrorCodes2.RequestCancelled = -32800; + LSPErrorCodes2.lspReservedErrorRangeEnd = -32800; + })(LSPErrorCodes = exports2.LSPErrorCodes || (exports2.LSPErrorCodes = {})); +}); + +// node_modules/vscode-languageserver-protocol/lib/node/main.js +var require_main3 = __commonJS((exports2) => { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, {enumerable: true, get: function() { + return m[k]; + }}); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) + if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) + __createBinding(exports3, m, p); + }; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.createProtocolConnection = void 0; + var node_1 = require_node(); + __exportStar2(require_node(), exports2); + __exportStar2(require_api2(), exports2); + function createProtocolConnection(input, output, logger, options) { + return node_1.createMessageConnection(input, output, logger, options); + } + exports2.createProtocolConnection = createProtocolConnection; +}); + +// node_modules/abort-controller/dist/abort-controller.mjs +var require_abort_controller = __commonJS((exports2) => { + __markAsModule(exports2); + __export(exports2, { + AbortController: () => AbortController, + AbortSignal: () => AbortSignal, + default: () => abort_controller_default + }); + var AbortSignal = class extends EventTarget { + constructor() { + super(); + throw new TypeError("AbortSignal cannot be constructed directly"); + } + get aborted() { + const aborted = abortedFlags.get(this); + if (typeof aborted !== "boolean") { + throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`); + } + return aborted; + } + }; + defineEventAttribute(AbortSignal.prototype, "abort"); + function createAbortSignal() { + const signal = Object.create(AbortSignal.prototype); + EventTarget.call(signal); + abortedFlags.set(signal, false); + return signal; + } + function abortSignal(signal) { + if (abortedFlags.get(signal) !== false) { + return; + } + abortedFlags.set(signal, true); + signal.dispatchEvent({type: "abort"}); + } + var abortedFlags = new WeakMap(); + Object.defineProperties(AbortSignal.prototype, { + aborted: {enumerable: true} + }); + if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { + Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, { + configurable: true, + value: "AbortSignal" + }); + } + var AbortController = class { + constructor() { + signals.set(this, createAbortSignal()); + } + get signal() { + return getSignal(this); + } + abort() { + abortSignal(getSignal(this)); + } + }; + var signals = new WeakMap(); + function getSignal(controller) { + const signal = signals.get(controller); + if (signal == null) { + throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`); + } + return signal; + } + Object.defineProperties(AbortController.prototype, { + signal: {enumerable: true}, + abort: {enumerable: true} + }); + if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { + Object.defineProperty(AbortController.prototype, Symbol.toStringTag, { + configurable: true, + value: "AbortController" + }); + } + var abort_controller_default = AbortController; +}); + +// node_modules/node-fetch/lib/index.mjs +var require_lib = __commonJS((exports2) => { + __markAsModule(exports2); + __export(exports2, { + FetchError: () => FetchError, + Headers: () => Headers, + Request: () => Request, + Response: () => Response, + default: () => lib_default + }); + var import_stream = __toModule(require("stream")); + var import_http = __toModule(require("http")); + var import_url = __toModule(require("url")); + var import_https = __toModule(require("https")); + var import_zlib = __toModule(require("zlib")); + var Readable = import_stream.default.Readable; + var BUFFER = Symbol("buffer"); + var TYPE = Symbol("type"); + var Blob = class { + constructor() { + this[TYPE] = ""; + const blobParts = arguments[0]; + const options = arguments[1]; + const buffers = []; + let size = 0; + if (blobParts) { + const a = blobParts; + const length = Number(a.length); + for (let i = 0; i < length; i++) { + const element = a[i]; + let buffer; + if (element instanceof Buffer) { + buffer = element; + } else if (ArrayBuffer.isView(element)) { + buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); + } else if (element instanceof ArrayBuffer) { + buffer = Buffer.from(element); + } else if (element instanceof Blob) { + buffer = element[BUFFER]; + } else { + buffer = Buffer.from(typeof element === "string" ? element : String(element)); + } + size += buffer.length; + buffers.push(buffer); + } + } + this[BUFFER] = Buffer.concat(buffers); + let type = options && options.type !== void 0 && String(options.type).toLowerCase(); + if (type && !/[^\u0020-\u007E]/.test(type)) { + this[TYPE] = type; + } + } + get size() { + return this[BUFFER].length; + } + get type() { + return this[TYPE]; + } + text() { + return Promise.resolve(this[BUFFER].toString()); + } + arrayBuffer() { + const buf = this[BUFFER]; + const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + return Promise.resolve(ab); + } + stream() { + const readable = new Readable(); + readable._read = function() { + }; + readable.push(this[BUFFER]); + readable.push(null); + return readable; + } + toString() { + return "[object Blob]"; + } + slice() { + const size = this.size; + const start = arguments[0]; + const end = arguments[1]; + let relativeStart, relativeEnd; + if (start === void 0) { + relativeStart = 0; + } else if (start < 0) { + relativeStart = Math.max(size + start, 0); + } else { + relativeStart = Math.min(start, size); + } + if (end === void 0) { + relativeEnd = size; + } else if (end < 0) { + relativeEnd = Math.max(size + end, 0); + } else { + relativeEnd = Math.min(end, size); + } + const span = Math.max(relativeEnd - relativeStart, 0); + const buffer = this[BUFFER]; + const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); + const blob = new Blob([], {type: arguments[2]}); + blob[BUFFER] = slicedBuffer; + return blob; + } + }; + Object.defineProperties(Blob.prototype, { + size: {enumerable: true}, + type: {enumerable: true}, + slice: {enumerable: true} + }); + Object.defineProperty(Blob.prototype, Symbol.toStringTag, { + value: "Blob", + writable: false, + enumerable: false, + configurable: true + }); + function FetchError(message, type, systemError) { + Error.call(this, message); + this.message = message; + this.type = type; + if (systemError) { + this.code = this.errno = systemError.code; + } + Error.captureStackTrace(this, this.constructor); + } + FetchError.prototype = Object.create(Error.prototype); + FetchError.prototype.constructor = FetchError; + FetchError.prototype.name = "FetchError"; + var convert; + try { + convert = require("encoding").convert; + } catch (e) { + } + var INTERNALS = Symbol("Body internals"); + var PassThrough = import_stream.default.PassThrough; + function Body(body) { + var _this = this; + var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref$size = _ref.size; + let size = _ref$size === void 0 ? 0 : _ref$size; + var _ref$timeout = _ref.timeout; + let timeout = _ref$timeout === void 0 ? 0 : _ref$timeout; + if (body == null) { + body = null; + } else if (isURLSearchParams(body)) { + body = Buffer.from(body.toString()); + } else if (isBlob(body)) + ; + else if (Buffer.isBuffer(body)) + ; + else if (Object.prototype.toString.call(body) === "[object ArrayBuffer]") { + body = Buffer.from(body); + } else if (ArrayBuffer.isView(body)) { + body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); + } else if (body instanceof import_stream.default) + ; + else { + body = Buffer.from(String(body)); + } + this[INTERNALS] = { + body, + disturbed: false, + error: null + }; + this.size = size; + this.timeout = timeout; + if (body instanceof import_stream.default) { + body.on("error", function(err) { + const error = err.name === "AbortError" ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, "system", err); + _this[INTERNALS].error = error; + }); + } + } + Body.prototype = { + get body() { + return this[INTERNALS].body; + }, + get bodyUsed() { + return this[INTERNALS].disturbed; + }, + arrayBuffer() { + return consumeBody.call(this).then(function(buf) { + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + }); + }, + blob() { + let ct = this.headers && this.headers.get("content-type") || ""; + return consumeBody.call(this).then(function(buf) { + return Object.assign(new Blob([], { + type: ct.toLowerCase() + }), { + [BUFFER]: buf + }); + }); + }, + json() { + var _this2 = this; + return consumeBody.call(this).then(function(buffer) { + try { + return JSON.parse(buffer.toString()); + } catch (err) { + return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, "invalid-json")); + } + }); + }, + text() { + return consumeBody.call(this).then(function(buffer) { + return buffer.toString(); + }); + }, + buffer() { + return consumeBody.call(this); + }, + textConverted() { + var _this3 = this; + return consumeBody.call(this).then(function(buffer) { + return convertBody(buffer, _this3.headers); + }); + } + }; + Object.defineProperties(Body.prototype, { + body: {enumerable: true}, + bodyUsed: {enumerable: true}, + arrayBuffer: {enumerable: true}, + blob: {enumerable: true}, + json: {enumerable: true}, + text: {enumerable: true} + }); + Body.mixIn = function(proto) { + for (const name of Object.getOwnPropertyNames(Body.prototype)) { + if (!(name in proto)) { + const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); + Object.defineProperty(proto, name, desc); + } + } + }; + function consumeBody() { + var _this4 = this; + if (this[INTERNALS].disturbed) { + return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); + } + this[INTERNALS].disturbed = true; + if (this[INTERNALS].error) { + return Body.Promise.reject(this[INTERNALS].error); + } + let body = this.body; + if (body === null) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + if (isBlob(body)) { + body = body.stream(); + } + if (Buffer.isBuffer(body)) { + return Body.Promise.resolve(body); + } + if (!(body instanceof import_stream.default)) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + let accum = []; + let accumBytes = 0; + let abort = false; + return new Body.Promise(function(resolve, reject) { + let resTimeout; + if (_this4.timeout) { + resTimeout = setTimeout(function() { + abort = true; + reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, "body-timeout")); + }, _this4.timeout); + } + body.on("error", function(err) { + if (err.name === "AbortError") { + abort = true; + reject(err); + } else { + reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, "system", err)); + } + }); + body.on("data", function(chunk) { + if (abort || chunk === null) { + return; + } + if (_this4.size && accumBytes + chunk.length > _this4.size) { + abort = true; + reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, "max-size")); + return; + } + accumBytes += chunk.length; + accum.push(chunk); + }); + body.on("end", function() { + if (abort) { + return; + } + clearTimeout(resTimeout); + try { + resolve(Buffer.concat(accum, accumBytes)); + } catch (err) { + reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err)); + } + }); + }); + } + function convertBody(buffer, headers) { + if (typeof convert !== "function") { + throw new Error("The package `encoding` must be installed to use the textConverted() function"); + } + const ct = headers.get("content-type"); + let charset = "utf-8"; + let res, str; + if (ct) { + res = /charset=([^;]*)/i.exec(ct); + } + str = buffer.slice(0, 1024).toString(); + if (!res && str) { + res = / 0 && arguments[0] !== void 0 ? arguments[0] : void 0; + this[MAP] = Object.create(null); + if (init instanceof Headers) { + const rawHeaders = init.raw(); + const headerNames = Object.keys(rawHeaders); + for (const headerName of headerNames) { + for (const value of rawHeaders[headerName]) { + this.append(headerName, value); + } + } + return; + } + if (init == null) + ; + else if (typeof init === "object") { + const method = init[Symbol.iterator]; + if (method != null) { + if (typeof method !== "function") { + throw new TypeError("Header pairs must be iterable"); + } + const pairs = []; + for (const pair of init) { + if (typeof pair !== "object" || typeof pair[Symbol.iterator] !== "function") { + throw new TypeError("Each header pair must be iterable"); + } + pairs.push(Array.from(pair)); + } + for (const pair of pairs) { + if (pair.length !== 2) { + throw new TypeError("Each header pair must be a name/value tuple"); + } + this.append(pair[0], pair[1]); + } + } else { + for (const key of Object.keys(init)) { + const value = init[key]; + this.append(key, value); + } + } + } else { + throw new TypeError("Provided initializer must be an object"); + } + } + get(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key === void 0) { + return null; + } + return this[MAP][key].join(", "); + } + forEach(callback) { + let thisArg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : void 0; + let pairs = getHeaders(this); + let i = 0; + while (i < pairs.length) { + var _pairs$i = pairs[i]; + const name = _pairs$i[0], value = _pairs$i[1]; + callback.call(thisArg, value, name, this); + pairs = getHeaders(this); + i++; + } + } + set(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + this[MAP][key !== void 0 ? key : name] = [value]; + } + append(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + if (key !== void 0) { + this[MAP][key].push(value); + } else { + this[MAP][name] = [value]; + } + } + has(name) { + name = `${name}`; + validateName(name); + return find(this[MAP], name) !== void 0; + } + delete(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key !== void 0) { + delete this[MAP][key]; + } + } + raw() { + return this[MAP]; + } + keys() { + return createHeadersIterator(this, "key"); + } + values() { + return createHeadersIterator(this, "value"); + } + [Symbol.iterator]() { + return createHeadersIterator(this, "key+value"); + } + }; + Headers.prototype.entries = Headers.prototype[Symbol.iterator]; + Object.defineProperty(Headers.prototype, Symbol.toStringTag, { + value: "Headers", + writable: false, + enumerable: false, + configurable: true + }); + Object.defineProperties(Headers.prototype, { + get: {enumerable: true}, + forEach: {enumerable: true}, + set: {enumerable: true}, + append: {enumerable: true}, + has: {enumerable: true}, + delete: {enumerable: true}, + keys: {enumerable: true}, + values: {enumerable: true}, + entries: {enumerable: true} + }); + function getHeaders(headers) { + let kind = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "key+value"; + const keys = Object.keys(headers[MAP]).sort(); + return keys.map(kind === "key" ? function(k) { + return k.toLowerCase(); + } : kind === "value" ? function(k) { + return headers[MAP][k].join(", "); + } : function(k) { + return [k.toLowerCase(), headers[MAP][k].join(", ")]; + }); + } + var INTERNAL = Symbol("internal"); + function createHeadersIterator(target, kind) { + const iterator = Object.create(HeadersIteratorPrototype); + iterator[INTERNAL] = { + target, + kind, + index: 0 + }; + return iterator; + } + var HeadersIteratorPrototype = Object.setPrototypeOf({ + next() { + if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { + throw new TypeError("Value of `this` is not a HeadersIterator"); + } + var _INTERNAL = this[INTERNAL]; + const target = _INTERNAL.target, kind = _INTERNAL.kind, index = _INTERNAL.index; + const values = getHeaders(target, kind); + const len = values.length; + if (index >= len) { + return { + value: void 0, + done: true + }; + } + this[INTERNAL].index = index + 1; + return { + value: values[index], + done: false + }; + } + }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); + Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { + value: "HeadersIterator", + writable: false, + enumerable: false, + configurable: true + }); + function exportNodeCompatibleHeaders(headers) { + const obj = Object.assign({__proto__: null}, headers[MAP]); + const hostHeaderKey = find(headers[MAP], "Host"); + if (hostHeaderKey !== void 0) { + obj[hostHeaderKey] = obj[hostHeaderKey][0]; + } + return obj; + } + function createHeadersLenient(obj) { + const headers = new Headers(); + for (const name of Object.keys(obj)) { + if (invalidTokenRegex.test(name)) { + continue; + } + if (Array.isArray(obj[name])) { + for (const val of obj[name]) { + if (invalidHeaderCharRegex.test(val)) { + continue; + } + if (headers[MAP][name] === void 0) { + headers[MAP][name] = [val]; + } else { + headers[MAP][name].push(val); + } + } + } else if (!invalidHeaderCharRegex.test(obj[name])) { + headers[MAP][name] = [obj[name]]; + } + } + return headers; + } + var INTERNALS$1 = Symbol("Response internals"); + var STATUS_CODES = import_http.default.STATUS_CODES; + var Response = class { + constructor() { + let body = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null; + let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + Body.call(this, body, opts); + const status = opts.status || 200; + const headers = new Headers(opts.headers); + if (body != null && !headers.has("Content-Type")) { + const contentType = extractContentType(body); + if (contentType) { + headers.append("Content-Type", contentType); + } + } + this[INTERNALS$1] = { + url: opts.url, + status, + statusText: opts.statusText || STATUS_CODES[status], + headers, + counter: opts.counter + }; + } + get url() { + return this[INTERNALS$1].url || ""; + } + get status() { + return this[INTERNALS$1].status; + } + get ok() { + return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; + } + get redirected() { + return this[INTERNALS$1].counter > 0; + } + get statusText() { + return this[INTERNALS$1].statusText; + } + get headers() { + return this[INTERNALS$1].headers; + } + clone() { + return new Response(clone(this), { + url: this.url, + status: this.status, + statusText: this.statusText, + headers: this.headers, + ok: this.ok, + redirected: this.redirected + }); + } + }; + Body.mixIn(Response.prototype); + Object.defineProperties(Response.prototype, { + url: {enumerable: true}, + status: {enumerable: true}, + ok: {enumerable: true}, + redirected: {enumerable: true}, + statusText: {enumerable: true}, + headers: {enumerable: true}, + clone: {enumerable: true} + }); + Object.defineProperty(Response.prototype, Symbol.toStringTag, { + value: "Response", + writable: false, + enumerable: false, + configurable: true + }); + var INTERNALS$2 = Symbol("Request internals"); + var parse_url = import_url.default.parse; + var format_url = import_url.default.format; + var streamDestructionSupported = "destroy" in import_stream.default.Readable.prototype; + function isRequest(input) { + return typeof input === "object" && typeof input[INTERNALS$2] === "object"; + } + function isAbortSignal(signal) { + const proto = signal && typeof signal === "object" && Object.getPrototypeOf(signal); + return !!(proto && proto.constructor.name === "AbortSignal"); + } + var Request = class { + constructor(input) { + let init = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + let parsedURL; + if (!isRequest(input)) { + if (input && input.href) { + parsedURL = parse_url(input.href); + } else { + parsedURL = parse_url(`${input}`); + } + input = {}; + } else { + parsedURL = parse_url(input.url); + } + let method = init.method || input.method || "GET"; + method = method.toUpperCase(); + if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) { + throw new TypeError("Request with GET/HEAD method cannot have body"); + } + let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; + Body.call(this, inputBody, { + timeout: init.timeout || input.timeout || 0, + size: init.size || input.size || 0 + }); + const headers = new Headers(init.headers || input.headers || {}); + if (inputBody != null && !headers.has("Content-Type")) { + const contentType = extractContentType(inputBody); + if (contentType) { + headers.append("Content-Type", contentType); + } + } + let signal = isRequest(input) ? input.signal : null; + if ("signal" in init) + signal = init.signal; + if (signal != null && !isAbortSignal(signal)) { + throw new TypeError("Expected signal to be an instanceof AbortSignal"); + } + this[INTERNALS$2] = { + method, + redirect: init.redirect || input.redirect || "follow", + headers, + parsedURL, + signal + }; + this.follow = init.follow !== void 0 ? init.follow : input.follow !== void 0 ? input.follow : 20; + this.compress = init.compress !== void 0 ? init.compress : input.compress !== void 0 ? input.compress : true; + this.counter = init.counter || input.counter || 0; + this.agent = init.agent || input.agent; + } + get method() { + return this[INTERNALS$2].method; + } + get url() { + return format_url(this[INTERNALS$2].parsedURL); + } + get headers() { + return this[INTERNALS$2].headers; + } + get redirect() { + return this[INTERNALS$2].redirect; + } + get signal() { + return this[INTERNALS$2].signal; + } + clone() { + return new Request(this); + } + }; + Body.mixIn(Request.prototype); + Object.defineProperty(Request.prototype, Symbol.toStringTag, { + value: "Request", + writable: false, + enumerable: false, + configurable: true + }); + Object.defineProperties(Request.prototype, { + method: {enumerable: true}, + url: {enumerable: true}, + headers: {enumerable: true}, + redirect: {enumerable: true}, + clone: {enumerable: true}, + signal: {enumerable: true} + }); + function getNodeRequestOptions(request) { + const parsedURL = request[INTERNALS$2].parsedURL; + const headers = new Headers(request[INTERNALS$2].headers); + if (!headers.has("Accept")) { + headers.set("Accept", "*/*"); + } + if (!parsedURL.protocol || !parsedURL.hostname) { + throw new TypeError("Only absolute URLs are supported"); + } + if (!/^https?:$/.test(parsedURL.protocol)) { + throw new TypeError("Only HTTP(S) protocols are supported"); + } + if (request.signal && request.body instanceof import_stream.default.Readable && !streamDestructionSupported) { + throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8"); + } + let contentLengthValue = null; + if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { + contentLengthValue = "0"; + } + if (request.body != null) { + const totalBytes = getTotalBytes(request); + if (typeof totalBytes === "number") { + contentLengthValue = String(totalBytes); + } + } + if (contentLengthValue) { + headers.set("Content-Length", contentLengthValue); + } + if (!headers.has("User-Agent")) { + headers.set("User-Agent", "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"); + } + if (request.compress && !headers.has("Accept-Encoding")) { + headers.set("Accept-Encoding", "gzip,deflate"); + } + let agent = request.agent; + if (typeof agent === "function") { + agent = agent(parsedURL); + } + if (!headers.has("Connection") && !agent) { + headers.set("Connection", "close"); + } + return Object.assign({}, parsedURL, { + method: request.method, + headers: exportNodeCompatibleHeaders(headers), + agent + }); + } + function AbortError(message) { + Error.call(this, message); + this.type = "aborted"; + this.message = message; + Error.captureStackTrace(this, this.constructor); + } + AbortError.prototype = Object.create(Error.prototype); + AbortError.prototype.constructor = AbortError; + AbortError.prototype.name = "AbortError"; + var PassThrough$1 = import_stream.default.PassThrough; + var resolve_url = import_url.default.resolve; + function fetch(url, opts) { + if (!fetch.Promise) { + throw new Error("native promise missing, set fetch.Promise to your favorite alternative"); + } + Body.Promise = fetch.Promise; + return new fetch.Promise(function(resolve, reject) { + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); + const send = (options.protocol === "https:" ? import_https.default : import_http.default).request; + const signal = request.signal; + let response = null; + const abort = function abort2() { + let error = new AbortError("The user aborted a request."); + reject(error); + if (request.body && request.body instanceof import_stream.default.Readable) { + request.body.destroy(error); + } + if (!response || !response.body) + return; + response.body.emit("error", error); + }; + if (signal && signal.aborted) { + abort(); + return; + } + const abortAndFinalize = function abortAndFinalize2() { + abort(); + finalize(); + }; + const req = send(options); + let reqTimeout; + if (signal) { + signal.addEventListener("abort", abortAndFinalize); + } + function finalize() { + req.abort(); + if (signal) + signal.removeEventListener("abort", abortAndFinalize); + clearTimeout(reqTimeout); + } + if (request.timeout) { + req.once("socket", function(socket) { + reqTimeout = setTimeout(function() { + reject(new FetchError(`network timeout at: ${request.url}`, "request-timeout")); + finalize(); + }, request.timeout); + }); + } + req.on("error", function(err) { + reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, "system", err)); + finalize(); + }); + req.on("response", function(res) { + clearTimeout(reqTimeout); + const headers = createHeadersLenient(res.headers); + if (fetch.isRedirect(res.statusCode)) { + const location = headers.get("Location"); + const locationURL = location === null ? null : resolve_url(request.url, location); + switch (request.redirect) { + case "error": + reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, "no-redirect")); + finalize(); + return; + case "manual": + if (locationURL !== null) { + try { + headers.set("Location", locationURL); + } catch (err) { + reject(err); + } + } + break; + case "follow": + if (locationURL === null) { + break; + } + if (request.counter >= request.follow) { + reject(new FetchError(`maximum redirect reached at: ${request.url}`, "max-redirect")); + finalize(); + return; + } + const requestOpts = { + headers: new Headers(request.headers), + follow: request.follow, + counter: request.counter + 1, + agent: request.agent, + compress: request.compress, + method: request.method, + body: request.body, + signal: request.signal, + timeout: request.timeout, + size: request.size + }; + if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { + reject(new FetchError("Cannot follow redirect with body being a readable stream", "unsupported-redirect")); + finalize(); + return; + } + if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === "POST") { + requestOpts.method = "GET"; + requestOpts.body = void 0; + requestOpts.headers.delete("content-length"); + } + resolve(fetch(new Request(locationURL, requestOpts))); + finalize(); + return; + } + } + res.once("end", function() { + if (signal) + signal.removeEventListener("abort", abortAndFinalize); + }); + let body = res.pipe(new PassThrough$1()); + const response_options = { + url: request.url, + status: res.statusCode, + statusText: res.statusMessage, + headers, + size: request.size, + timeout: request.timeout, + counter: request.counter + }; + const codings = headers.get("Content-Encoding"); + if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) { + response = new Response(body, response_options); + resolve(response); + return; + } + const zlibOptions = { + flush: import_zlib.default.Z_SYNC_FLUSH, + finishFlush: import_zlib.default.Z_SYNC_FLUSH + }; + if (codings == "gzip" || codings == "x-gzip") { + body = body.pipe(import_zlib.default.createGunzip(zlibOptions)); + response = new Response(body, response_options); + resolve(response); + return; + } + if (codings == "deflate" || codings == "x-deflate") { + const raw = res.pipe(new PassThrough$1()); + raw.once("data", function(chunk) { + if ((chunk[0] & 15) === 8) { + body = body.pipe(import_zlib.default.createInflate()); + } else { + body = body.pipe(import_zlib.default.createInflateRaw()); + } + response = new Response(body, response_options); + resolve(response); + }); + return; + } + if (codings == "br" && typeof import_zlib.default.createBrotliDecompress === "function") { + body = body.pipe(import_zlib.default.createBrotliDecompress()); + response = new Response(body, response_options); + resolve(response); + return; + } + response = new Response(body, response_options); + resolve(response); + }); + writeToStream(req, request); + }); + } + fetch.isRedirect = function(code) { + return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; + }; + fetch.Promise = global.Promise; + var lib_default = fetch; +}); + +// node_modules/picomatch/lib/constants.js +var require_constants = __commonJS((exports2, module2) => { + "use strict"; + var path = require("path"); + var WIN_SLASH = "\\\\/"; + var WIN_NO_SLASH = `[^${WIN_SLASH}]`; + var DOT_LITERAL = "\\."; + var PLUS_LITERAL = "\\+"; + var QMARK_LITERAL = "\\?"; + var SLASH_LITERAL = "\\/"; + var ONE_CHAR = "(?=.)"; + var QMARK = "[^/]"; + var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; + var START_ANCHOR = `(?:^|${SLASH_LITERAL})`; + var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; + var NO_DOT = `(?!${DOT_LITERAL})`; + var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; + var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; + var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; + var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; + var STAR = `${QMARK}*?`; + var POSIX_CHARS = { + DOT_LITERAL, + PLUS_LITERAL, + QMARK_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + QMARK, + END_ANCHOR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK_NO_DOT, + STAR, + START_ANCHOR + }; + var WINDOWS_CHARS = { + ...POSIX_CHARS, + SLASH_LITERAL: `[${WIN_SLASH}]`, + QMARK: WIN_NO_SLASH, + STAR: `${WIN_NO_SLASH}*?`, + DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, + NO_DOT: `(?!${DOT_LITERAL})`, + NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, + NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + QMARK_NO_DOT: `[^.${WIN_SLASH}]`, + START_ANCHOR: `(?:^|[${WIN_SLASH}])`, + END_ANCHOR: `(?:[${WIN_SLASH}]|$)` + }; + var POSIX_REGEX_SOURCE = { + alnum: "a-zA-Z0-9", + alpha: "a-zA-Z", + ascii: "\\x00-\\x7F", + blank: " \\t", + cntrl: "\\x00-\\x1F\\x7F", + digit: "0-9", + graph: "\\x21-\\x7E", + lower: "a-z", + print: "\\x20-\\x7E ", + punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~", + space: " \\t\\r\\n\\v\\f", + upper: "A-Z", + word: "A-Za-z0-9_", + xdigit: "A-Fa-f0-9" + }; + module2.exports = { + MAX_LENGTH: 1024 * 64, + POSIX_REGEX_SOURCE, + REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, + REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, + REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, + REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, + REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, + REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, + REPLACEMENTS: { + "***": "*", + "**/**": "**", + "**/**/**": "**" + }, + CHAR_0: 48, + CHAR_9: 57, + CHAR_UPPERCASE_A: 65, + CHAR_LOWERCASE_A: 97, + CHAR_UPPERCASE_Z: 90, + CHAR_LOWERCASE_Z: 122, + CHAR_LEFT_PARENTHESES: 40, + CHAR_RIGHT_PARENTHESES: 41, + CHAR_ASTERISK: 42, + CHAR_AMPERSAND: 38, + CHAR_AT: 64, + CHAR_BACKWARD_SLASH: 92, + CHAR_CARRIAGE_RETURN: 13, + CHAR_CIRCUMFLEX_ACCENT: 94, + CHAR_COLON: 58, + CHAR_COMMA: 44, + CHAR_DOT: 46, + CHAR_DOUBLE_QUOTE: 34, + CHAR_EQUAL: 61, + CHAR_EXCLAMATION_MARK: 33, + CHAR_FORM_FEED: 12, + CHAR_FORWARD_SLASH: 47, + CHAR_GRAVE_ACCENT: 96, + CHAR_HASH: 35, + CHAR_HYPHEN_MINUS: 45, + CHAR_LEFT_ANGLE_BRACKET: 60, + CHAR_LEFT_CURLY_BRACE: 123, + CHAR_LEFT_SQUARE_BRACKET: 91, + CHAR_LINE_FEED: 10, + CHAR_NO_BREAK_SPACE: 160, + CHAR_PERCENT: 37, + CHAR_PLUS: 43, + CHAR_QUESTION_MARK: 63, + CHAR_RIGHT_ANGLE_BRACKET: 62, + CHAR_RIGHT_CURLY_BRACE: 125, + CHAR_RIGHT_SQUARE_BRACKET: 93, + CHAR_SEMICOLON: 59, + CHAR_SINGLE_QUOTE: 39, + CHAR_SPACE: 32, + CHAR_TAB: 9, + CHAR_UNDERSCORE: 95, + CHAR_VERTICAL_LINE: 124, + CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, + SEP: path.sep, + extglobChars(chars) { + return { + "!": {type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})`}, + "?": {type: "qmark", open: "(?:", close: ")?"}, + "+": {type: "plus", open: "(?:", close: ")+"}, + "*": {type: "star", open: "(?:", close: ")*"}, + "@": {type: "at", open: "(?:", close: ")"} + }; + }, + globChars(win32) { + return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; + } + }; +}); + +// node_modules/picomatch/lib/utils.js +var require_utils = __commonJS((exports2) => { + "use strict"; + var path = require("path"); + var win32 = process.platform === "win32"; + var { + REGEX_BACKSLASH, + REGEX_REMOVE_BACKSLASH, + REGEX_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_GLOBAL + } = require_constants(); + exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val); + exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str); + exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str); + exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1"); + exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/"); + exports2.removeBackslashes = (str) => { + return str.replace(REGEX_REMOVE_BACKSLASH, (match) => { + return match === "\\" ? "" : match; + }); + }; + exports2.supportsLookbehinds = () => { + const segs = process.version.slice(1).split(".").map(Number); + if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) { + return true; + } + return false; + }; + exports2.isWindows = (options) => { + if (options && typeof options.windows === "boolean") { + return options.windows; + } + return win32 === true || path.sep === "\\"; + }; + exports2.escapeLast = (input, char, lastIdx) => { + const idx = input.lastIndexOf(char, lastIdx); + if (idx === -1) + return input; + if (input[idx - 1] === "\\") + return exports2.escapeLast(input, char, idx - 1); + return `${input.slice(0, idx)}\\${input.slice(idx)}`; + }; + exports2.removePrefix = (input, state = {}) => { + let output = input; + if (output.startsWith("./")) { + output = output.slice(2); + state.prefix = "./"; + } + return output; + }; + exports2.wrapOutput = (input, state = {}, options = {}) => { + const prepend = options.contains ? "" : "^"; + const append = options.contains ? "" : "$"; + let output = `${prepend}(?:${input})${append}`; + if (state.negated === true) { + output = `(?:^(?!${output}).*$)`; + } + return output; + }; +}); + +// node_modules/picomatch/lib/scan.js +var require_scan = __commonJS((exports2, module2) => { + "use strict"; + var utils = require_utils(); + var { + CHAR_ASTERISK, + CHAR_AT, + CHAR_BACKWARD_SLASH, + CHAR_COMMA, + CHAR_DOT, + CHAR_EXCLAMATION_MARK, + CHAR_FORWARD_SLASH, + CHAR_LEFT_CURLY_BRACE, + CHAR_LEFT_PARENTHESES, + CHAR_LEFT_SQUARE_BRACKET, + CHAR_PLUS, + CHAR_QUESTION_MARK, + CHAR_RIGHT_CURLY_BRACE, + CHAR_RIGHT_PARENTHESES, + CHAR_RIGHT_SQUARE_BRACKET + } = require_constants(); + var isPathSeparator = (code) => { + return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; + }; + var depth = (token) => { + if (token.isPrefix !== true) { + token.depth = token.isGlobstar ? Infinity : 1; + } + }; + var scan = (input, options) => { + const opts = options || {}; + const length = input.length - 1; + const scanToEnd = opts.parts === true || opts.scanToEnd === true; + const slashes = []; + const tokens = []; + const parts = []; + let str = input; + let index = -1; + let start = 0; + let lastIndex = 0; + let isBrace = false; + let isBracket = false; + let isGlob = false; + let isExtglob = false; + let isGlobstar = false; + let braceEscaped = false; + let backslashes = false; + let negated = false; + let finished = false; + let braces = 0; + let prev; + let code; + let token = {value: "", depth: 0, isGlob: false}; + const eos = () => index >= length; + const peek = () => str.charCodeAt(index + 1); + const advance = () => { + prev = code; + return str.charCodeAt(++index); + }; + while (index < length) { + code = advance(); + let next; + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + if (code === CHAR_LEFT_CURLY_BRACE) { + braceEscaped = true; + } + continue; + } + if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { + braces++; + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + if (code === CHAR_LEFT_CURLY_BRACE) { + braces++; + continue; + } + if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + if (braceEscaped !== true && code === CHAR_COMMA) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + if (code === CHAR_RIGHT_CURLY_BRACE) { + braces--; + if (braces === 0) { + braceEscaped = false; + isBrace = token.isBrace = true; + finished = true; + break; + } + } + } + if (scanToEnd === true) { + continue; + } + break; + } + if (code === CHAR_FORWARD_SLASH) { + slashes.push(index); + tokens.push(token); + token = {value: "", depth: 0, isGlob: false}; + if (finished === true) + continue; + if (prev === CHAR_DOT && index === start + 1) { + start += 2; + continue; + } + lastIndex = index + 1; + continue; + } + if (opts.noext !== true) { + const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK; + if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + isExtglob = token.isExtglob = true; + finished = true; + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + if (code === CHAR_RIGHT_PARENTHESES) { + isGlob = token.isGlob = true; + finished = true; + break; + } + } + continue; + } + break; + } + } + if (code === CHAR_ASTERISK) { + if (prev === CHAR_ASTERISK) + isGlobstar = token.isGlobstar = true; + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + if (code === CHAR_QUESTION_MARK) { + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + if (code === CHAR_LEFT_SQUARE_BRACKET) { + while (eos() !== true && (next = advance())) { + if (next === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + isBracket = token.isBracket = true; + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + } + } + if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { + negated = token.negated = true; + start++; + continue; + } + if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_LEFT_PARENTHESES) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + if (code === CHAR_RIGHT_PARENTHESES) { + finished = true; + break; + } + } + continue; + } + break; + } + if (isGlob === true) { + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + } + if (opts.noext === true) { + isExtglob = false; + isGlob = false; + } + let base = str; + let prefix = ""; + let glob = ""; + if (start > 0) { + prefix = str.slice(0, start); + str = str.slice(start); + lastIndex -= start; + } + if (base && isGlob === true && lastIndex > 0) { + base = str.slice(0, lastIndex); + glob = str.slice(lastIndex); + } else if (isGlob === true) { + base = ""; + glob = str; + } else { + base = str; + } + if (base && base !== "" && base !== "/" && base !== str) { + if (isPathSeparator(base.charCodeAt(base.length - 1))) { + base = base.slice(0, -1); + } + } + if (opts.unescape === true) { + if (glob) + glob = utils.removeBackslashes(glob); + if (base && backslashes === true) { + base = utils.removeBackslashes(base); + } + } + const state = { + prefix, + input, + start, + base, + glob, + isBrace, + isBracket, + isGlob, + isExtglob, + isGlobstar, + negated + }; + if (opts.tokens === true) { + state.maxDepth = 0; + if (!isPathSeparator(code)) { + tokens.push(token); + } + state.tokens = tokens; + } + if (opts.parts === true || opts.tokens === true) { + let prevIndex; + for (let idx = 0; idx < slashes.length; idx++) { + const n = prevIndex ? prevIndex + 1 : start; + const i = slashes[idx]; + const value = input.slice(n, i); + if (opts.tokens) { + if (idx === 0 && start !== 0) { + tokens[idx].isPrefix = true; + tokens[idx].value = prefix; + } else { + tokens[idx].value = value; + } + depth(tokens[idx]); + state.maxDepth += tokens[idx].depth; + } + if (idx !== 0 || value !== "") { + parts.push(value); + } + prevIndex = i; + } + if (prevIndex && prevIndex + 1 < input.length) { + const value = input.slice(prevIndex + 1); + parts.push(value); + if (opts.tokens) { + tokens[tokens.length - 1].value = value; + depth(tokens[tokens.length - 1]); + state.maxDepth += tokens[tokens.length - 1].depth; + } + } + state.slashes = slashes; + state.parts = parts; + } + return state; + }; + module2.exports = scan; +}); + +// node_modules/picomatch/lib/parse.js +var require_parse = __commonJS((exports2, module2) => { + "use strict"; + var constants = require_constants(); + var utils = require_utils(); + var { + MAX_LENGTH, + POSIX_REGEX_SOURCE, + REGEX_NON_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_BACKREF, + REPLACEMENTS + } = constants; + var expandRange = (args, options) => { + if (typeof options.expandRange === "function") { + return options.expandRange(...args, options); + } + args.sort(); + const value = `[${args.join("-")}]`; + try { + new RegExp(value); + } catch (ex) { + return args.map((v) => utils.escapeRegex(v)).join(".."); + } + return value; + }; + var syntaxError = (type, char) => { + return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; + }; + var parse = (input, options) => { + if (typeof input !== "string") { + throw new TypeError("Expected a string"); + } + input = REPLACEMENTS[input] || input; + const opts = {...options}; + const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + let len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + const bos = {type: "bos", value: "", output: opts.prepend || ""}; + const tokens = [bos]; + const capture = opts.capture ? "" : "?:"; + const win32 = utils.isWindows(options); + const PLATFORM_CHARS = constants.globChars(win32); + const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); + const { + DOT_LITERAL, + PLUS_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK, + QMARK_NO_DOT, + STAR, + START_ANCHOR + } = PLATFORM_CHARS; + const globstar = (opts2) => { + return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + const nodot = opts.dot ? "" : NO_DOT; + const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; + let star = opts.bash === true ? globstar(opts) : STAR; + if (opts.capture) { + star = `(${star})`; + } + if (typeof opts.noext === "boolean") { + opts.noextglob = opts.noext; + } + const state = { + input, + index: -1, + start: 0, + dot: opts.dot === true, + consumed: "", + output: "", + prefix: "", + backtrack: false, + negated: false, + brackets: 0, + braces: 0, + parens: 0, + quotes: 0, + globstar: false, + tokens + }; + input = utils.removePrefix(input, state); + len = input.length; + const extglobs = []; + const braces = []; + const stack = []; + let prev = bos; + let value; + const eos = () => state.index === len - 1; + const peek = state.peek = (n = 1) => input[state.index + n]; + const advance = state.advance = () => input[++state.index]; + const remaining = () => input.slice(state.index + 1); + const consume = (value2 = "", num = 0) => { + state.consumed += value2; + state.index += num; + }; + const append = (token) => { + state.output += token.output != null ? token.output : token.value; + consume(token.value); + }; + const negate = () => { + let count = 1; + while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) { + advance(); + state.start++; + count++; + } + if (count % 2 === 0) { + return false; + } + state.negated = true; + state.start++; + return true; + }; + const increment = (type) => { + state[type]++; + stack.push(type); + }; + const decrement = (type) => { + state[type]--; + stack.pop(); + }; + const push = (tok) => { + if (prev.type === "globstar") { + const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace"); + const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren"); + if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) { + state.output = state.output.slice(0, -prev.output.length); + prev.type = "star"; + prev.value = "*"; + prev.output = star; + state.output += prev.output; + } + } + if (extglobs.length && tok.type !== "paren" && !EXTGLOB_CHARS[tok.value]) { + extglobs[extglobs.length - 1].inner += tok.value; + } + if (tok.value || tok.output) + append(tok); + if (prev && prev.type === "text" && tok.type === "text") { + prev.value += tok.value; + prev.output = (prev.output || "") + tok.value; + return; + } + tok.prev = prev; + tokens.push(tok); + prev = tok; + }; + const extglobOpen = (type, value2) => { + const token = {...EXTGLOB_CHARS[value2], conditions: 1, inner: ""}; + token.prev = prev; + token.parens = state.parens; + token.output = state.output; + const output = (opts.capture ? "(" : "") + token.open; + increment("parens"); + push({type, value: value2, output: state.output ? "" : ONE_CHAR}); + push({type: "paren", extglob: true, value: advance(), output}); + extglobs.push(token); + }; + const extglobClose = (token) => { + let output = token.close + (opts.capture ? ")" : ""); + if (token.type === "negate") { + let extglobStar = star; + if (token.inner && token.inner.length > 1 && token.inner.includes("/")) { + extglobStar = globstar(opts); + } + if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { + output = token.close = `)$))${extglobStar}`; + } + if (token.prev.type === "bos" && eos()) { + state.negatedExtglob = true; + } + } + push({type: "paren", extglob: true, value, output}); + decrement("parens"); + }; + if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { + let backslashes = false; + let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { + if (first === "\\") { + backslashes = true; + return m; + } + if (first === "?") { + if (esc) { + return esc + first + (rest ? QMARK.repeat(rest.length) : ""); + } + if (index === 0) { + return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ""); + } + return QMARK.repeat(chars.length); + } + if (first === ".") { + return DOT_LITERAL.repeat(chars.length); + } + if (first === "*") { + if (esc) { + return esc + first + (rest ? star : ""); + } + return star; + } + return esc ? m : `\\${m}`; + }); + if (backslashes === true) { + if (opts.unescape === true) { + output = output.replace(/\\/g, ""); + } else { + output = output.replace(/\\+/g, (m) => { + return m.length % 2 === 0 ? "\\\\" : m ? "\\" : ""; + }); + } + } + if (output === input && opts.contains === true) { + state.output = input; + return state; + } + state.output = utils.wrapOutput(output, state, options); + return state; + } + while (!eos()) { + value = advance(); + if (value === "\0") { + continue; + } + if (value === "\\") { + const next = peek(); + if (next === "/" && opts.bash !== true) { + continue; + } + if (next === "." || next === ";") { + continue; + } + if (!next) { + value += "\\"; + push({type: "text", value}); + continue; + } + const match = /^\\+/.exec(remaining()); + let slashes = 0; + if (match && match[0].length > 2) { + slashes = match[0].length; + state.index += slashes; + if (slashes % 2 !== 0) { + value += "\\"; + } + } + if (opts.unescape === true) { + value = advance() || ""; + } else { + value += advance() || ""; + } + if (state.brackets === 0) { + push({type: "text", value}); + continue; + } + } + if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) { + if (opts.posix !== false && value === ":") { + const inner = prev.value.slice(1); + if (inner.includes("[")) { + prev.posix = true; + if (inner.includes(":")) { + const idx = prev.value.lastIndexOf("["); + const pre = prev.value.slice(0, idx); + const rest2 = prev.value.slice(idx + 2); + const posix = POSIX_REGEX_SOURCE[rest2]; + if (posix) { + prev.value = pre + posix; + state.backtrack = true; + advance(); + if (!bos.output && tokens.indexOf(prev) === 1) { + bos.output = ONE_CHAR; + } + continue; + } + } + } + } + if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") { + value = `\\${value}`; + } + if (value === "]" && (prev.value === "[" || prev.value === "[^")) { + value = `\\${value}`; + } + if (opts.posix === true && value === "!" && prev.value === "[") { + value = "^"; + } + prev.value += value; + append({value}); + continue; + } + if (state.quotes === 1 && value !== '"') { + value = utils.escapeRegex(value); + prev.value += value; + append({value}); + continue; + } + if (value === '"') { + state.quotes = state.quotes === 1 ? 0 : 1; + if (opts.keepQuotes === true) { + push({type: "text", value}); + } + continue; + } + if (value === "(") { + increment("parens"); + push({type: "paren", value}); + continue; + } + if (value === ")") { + if (state.parens === 0 && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError("opening", "(")); + } + const extglob = extglobs[extglobs.length - 1]; + if (extglob && state.parens === extglob.parens + 1) { + extglobClose(extglobs.pop()); + continue; + } + push({type: "paren", value, output: state.parens ? ")" : "\\)"}); + decrement("parens"); + continue; + } + if (value === "[") { + if (opts.nobracket === true || !remaining().includes("]")) { + if (opts.nobracket !== true && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError("closing", "]")); + } + value = `\\${value}`; + } else { + increment("brackets"); + } + push({type: "bracket", value}); + continue; + } + if (value === "]") { + if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) { + push({type: "text", value, output: `\\${value}`}); + continue; + } + if (state.brackets === 0) { + if (opts.strictBrackets === true) { + throw new SyntaxError(syntaxError("opening", "[")); + } + push({type: "text", value, output: `\\${value}`}); + continue; + } + decrement("brackets"); + const prevValue = prev.value.slice(1); + if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) { + value = `/${value}`; + } + prev.value += value; + append({value}); + if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { + continue; + } + const escaped = utils.escapeRegex(prev.value); + state.output = state.output.slice(0, -prev.value.length); + if (opts.literalBrackets === true) { + state.output += escaped; + prev.value = escaped; + continue; + } + prev.value = `(${capture}${escaped}|${prev.value})`; + state.output += prev.value; + continue; + } + if (value === "{" && opts.nobrace !== true) { + increment("braces"); + const open = { + type: "brace", + value, + output: "(", + outputIndex: state.output.length, + tokensIndex: state.tokens.length + }; + braces.push(open); + push(open); + continue; + } + if (value === "}") { + const brace = braces[braces.length - 1]; + if (opts.nobrace === true || !brace) { + push({type: "text", value, output: value}); + continue; + } + let output = ")"; + if (brace.dots === true) { + const arr = tokens.slice(); + const range = []; + for (let i = arr.length - 1; i >= 0; i--) { + tokens.pop(); + if (arr[i].type === "brace") { + break; + } + if (arr[i].type !== "dots") { + range.unshift(arr[i].value); + } + } + output = expandRange(range, opts); + state.backtrack = true; + } + if (brace.comma !== true && brace.dots !== true) { + const out = state.output.slice(0, brace.outputIndex); + const toks = state.tokens.slice(brace.tokensIndex); + brace.value = brace.output = "\\{"; + value = output = "\\}"; + state.output = out; + for (const t of toks) { + state.output += t.output || t.value; + } + } + push({type: "brace", value, output}); + decrement("braces"); + braces.pop(); + continue; + } + if (value === "|") { + if (extglobs.length > 0) { + extglobs[extglobs.length - 1].conditions++; + } + push({type: "text", value}); + continue; + } + if (value === ",") { + let output = value; + const brace = braces[braces.length - 1]; + if (brace && stack[stack.length - 1] === "braces") { + brace.comma = true; + output = "|"; + } + push({type: "comma", value, output}); + continue; + } + if (value === "/") { + if (prev.type === "dot" && state.index === state.start + 1) { + state.start = state.index + 1; + state.consumed = ""; + state.output = ""; + tokens.pop(); + prev = bos; + continue; + } + push({type: "slash", value, output: SLASH_LITERAL}); + continue; + } + if (value === ".") { + if (state.braces > 0 && prev.type === "dot") { + if (prev.value === ".") + prev.output = DOT_LITERAL; + const brace = braces[braces.length - 1]; + prev.type = "dots"; + prev.output += value; + prev.value += value; + brace.dots = true; + continue; + } + if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") { + push({type: "text", value, output: DOT_LITERAL}); + continue; + } + push({type: "dot", value, output: DOT_LITERAL}); + continue; + } + if (value === "?") { + const isGroup = prev && prev.value === "("; + if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") { + extglobOpen("qmark", value); + continue; + } + if (prev && prev.type === "paren") { + const next = peek(); + let output = value; + if (next === "<" && !utils.supportsLookbehinds()) { + throw new Error("Node.js v10 or higher is required for regex lookbehinds"); + } + if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) { + output = `\\${value}`; + } + push({type: "text", value, output}); + continue; + } + if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) { + push({type: "qmark", value, output: QMARK_NO_DOT}); + continue; + } + push({type: "qmark", value, output: QMARK}); + continue; + } + if (value === "!") { + if (opts.noextglob !== true && peek() === "(") { + if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) { + extglobOpen("negate", value); + continue; + } + } + if (opts.nonegate !== true && state.index === 0) { + negate(); + continue; + } + } + if (value === "+") { + if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") { + extglobOpen("plus", value); + continue; + } + if (prev && prev.value === "(" || opts.regex === false) { + push({type: "plus", value, output: PLUS_LITERAL}); + continue; + } + if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) { + push({type: "plus", value}); + continue; + } + push({type: "plus", value: PLUS_LITERAL}); + continue; + } + if (value === "@") { + if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") { + push({type: "at", extglob: true, value, output: ""}); + continue; + } + push({type: "text", value}); + continue; + } + if (value !== "*") { + if (value === "$" || value === "^") { + value = `\\${value}`; + } + const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); + if (match) { + value += match[0]; + state.index += match[0].length; + } + push({type: "text", value}); + continue; + } + if (prev && (prev.type === "globstar" || prev.star === true)) { + prev.type = "star"; + prev.star = true; + prev.value += value; + prev.output = star; + state.backtrack = true; + state.globstar = true; + consume(value); + continue; + } + let rest = remaining(); + if (opts.noextglob !== true && /^\([^?]/.test(rest)) { + extglobOpen("star", value); + continue; + } + if (prev.type === "star") { + if (opts.noglobstar === true) { + consume(value); + continue; + } + const prior = prev.prev; + const before = prior.prev; + const isStart = prior.type === "slash" || prior.type === "bos"; + const afterStar = before && (before.type === "star" || before.type === "globstar"); + if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) { + push({type: "star", value, output: ""}); + continue; + } + const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace"); + const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren"); + if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) { + push({type: "star", value, output: ""}); + continue; + } + while (rest.slice(0, 3) === "/**") { + const after = input[state.index + 4]; + if (after && after !== "/") { + break; + } + rest = rest.slice(3); + consume("/**", 3); + } + if (prior.type === "bos" && eos()) { + prev.type = "globstar"; + prev.value += value; + prev.output = globstar(opts); + state.output = prev.output; + state.globstar = true; + consume(value); + continue; + } + if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) { + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + prev.type = "globstar"; + prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)"); + prev.value += value; + state.globstar = true; + state.output += prior.output + prev.output; + consume(value); + continue; + } + if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") { + const end = rest[1] !== void 0 ? "|$" : ""; + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + prev.type = "globstar"; + prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; + prev.value += value; + state.output += prior.output + prev.output; + state.globstar = true; + consume(value + advance()); + push({type: "slash", value: "/", output: ""}); + continue; + } + if (prior.type === "bos" && rest[0] === "/") { + prev.type = "globstar"; + prev.value += value; + prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; + state.output = prev.output; + state.globstar = true; + consume(value + advance()); + push({type: "slash", value: "/", output: ""}); + continue; + } + state.output = state.output.slice(0, -prev.output.length); + prev.type = "globstar"; + prev.output = globstar(opts); + prev.value += value; + state.output += prev.output; + state.globstar = true; + consume(value); + continue; + } + const token = {type: "star", value, output: star}; + if (opts.bash === true) { + token.output = ".*?"; + if (prev.type === "bos" || prev.type === "slash") { + token.output = nodot + token.output; + } + push(token); + continue; + } + if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) { + token.output = value; + push(token); + continue; + } + if (state.index === state.start || prev.type === "slash" || prev.type === "dot") { + if (prev.type === "dot") { + state.output += NO_DOT_SLASH; + prev.output += NO_DOT_SLASH; + } else if (opts.dot === true) { + state.output += NO_DOTS_SLASH; + prev.output += NO_DOTS_SLASH; + } else { + state.output += nodot; + prev.output += nodot; + } + if (peek() !== "*") { + state.output += ONE_CHAR; + prev.output += ONE_CHAR; + } + } + push(token); + } + while (state.brackets > 0) { + if (opts.strictBrackets === true) + throw new SyntaxError(syntaxError("closing", "]")); + state.output = utils.escapeLast(state.output, "["); + decrement("brackets"); + } + while (state.parens > 0) { + if (opts.strictBrackets === true) + throw new SyntaxError(syntaxError("closing", ")")); + state.output = utils.escapeLast(state.output, "("); + decrement("parens"); + } + while (state.braces > 0) { + if (opts.strictBrackets === true) + throw new SyntaxError(syntaxError("closing", "}")); + state.output = utils.escapeLast(state.output, "{"); + decrement("braces"); + } + if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) { + push({type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?`}); + } + if (state.backtrack === true) { + state.output = ""; + for (const token of state.tokens) { + state.output += token.output != null ? token.output : token.value; + if (token.suffix) { + state.output += token.suffix; + } + } + } + return state; + }; + parse.fastpaths = (input, options) => { + const opts = {...options}; + const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + const len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + input = REPLACEMENTS[input] || input; + const win32 = utils.isWindows(options); + const { + DOT_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOTS_SLASH, + STAR, + START_ANCHOR + } = constants.globChars(win32); + const nodot = opts.dot ? NO_DOTS : NO_DOT; + const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; + const capture = opts.capture ? "" : "?:"; + const state = {negated: false, prefix: ""}; + let star = opts.bash === true ? ".*?" : STAR; + if (opts.capture) { + star = `(${star})`; + } + const globstar = (opts2) => { + if (opts2.noglobstar === true) + return star; + return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + const create = (str) => { + switch (str) { + case "*": + return `${nodot}${ONE_CHAR}${star}`; + case ".*": + return `${DOT_LITERAL}${ONE_CHAR}${star}`; + case "*.*": + return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + case "*/*": + return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; + case "**": + return nodot + globstar(opts); + case "**/*": + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; + case "**/*.*": + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + case "**/.*": + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; + default: { + const match = /^(.*?)\.(\w+)$/.exec(str); + if (!match) + return; + const source2 = create(match[1]); + if (!source2) + return; + return source2 + DOT_LITERAL + match[2]; + } + } + }; + const output = utils.removePrefix(input, state); + let source = create(output); + if (source && opts.strictSlashes !== true) { + source += `${SLASH_LITERAL}?`; + } + return source; + }; + module2.exports = parse; +}); + +// node_modules/picomatch/lib/picomatch.js +var require_picomatch = __commonJS((exports2, module2) => { + "use strict"; + var path = require("path"); + var scan = require_scan(); + var parse = require_parse(); + var utils = require_utils(); + var constants = require_constants(); + var isObject3 = (val) => val && typeof val === "object" && !Array.isArray(val); + var picomatch = (glob, options, returnState = false) => { + if (Array.isArray(glob)) { + const fns = glob.map((input) => picomatch(input, options, returnState)); + const arrayMatcher = (str) => { + for (const isMatch of fns) { + const state2 = isMatch(str); + if (state2) + return state2; + } + return false; + }; + return arrayMatcher; + } + const isState = isObject3(glob) && glob.tokens && glob.input; + if (glob === "" || typeof glob !== "string" && !isState) { + throw new TypeError("Expected pattern to be a non-empty string"); + } + const opts = options || {}; + const posix = utils.isWindows(options); + const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true); + const state = regex.state; + delete regex.state; + let isIgnored = () => false; + if (opts.ignore) { + const ignoreOpts = {...options, ignore: null, onMatch: null, onResult: null}; + isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); + } + const matcher = (input, returnObject = false) => { + const {isMatch, match, output} = picomatch.test(input, regex, options, {glob, posix}); + const result = {glob, state, regex, posix, input, output, match, isMatch}; + if (typeof opts.onResult === "function") { + opts.onResult(result); + } + if (isMatch === false) { + result.isMatch = false; + return returnObject ? result : false; + } + if (isIgnored(input)) { + if (typeof opts.onIgnore === "function") { + opts.onIgnore(result); + } + result.isMatch = false; + return returnObject ? result : false; + } + if (typeof opts.onMatch === "function") { + opts.onMatch(result); + } + return returnObject ? result : true; + }; + if (returnState) { + matcher.state = state; + } + return matcher; + }; + picomatch.test = (input, regex, options, {glob, posix} = {}) => { + if (typeof input !== "string") { + throw new TypeError("Expected input to be a string"); + } + if (input === "") { + return {isMatch: false, output: ""}; + } + const opts = options || {}; + const format = opts.format || (posix ? utils.toPosixSlashes : null); + let match = input === glob; + let output = match && format ? format(input) : input; + if (match === false) { + output = format ? format(input) : input; + match = output === glob; + } + if (match === false || opts.capture === true) { + if (opts.matchBase === true || opts.basename === true) { + match = picomatch.matchBase(input, regex, options, posix); + } else { + match = regex.exec(output); + } + } + return {isMatch: Boolean(match), match, output}; + }; + picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { + const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); + return regex.test(path.basename(input)); + }; + picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); + picomatch.parse = (pattern, options) => { + if (Array.isArray(pattern)) + return pattern.map((p) => picomatch.parse(p, options)); + return parse(pattern, {...options, fastpaths: false}); + }; + picomatch.scan = (input, options) => scan(input, options); + picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => { + if (returnOutput === true) { + return parsed.output; + } + const opts = options || {}; + const prepend = opts.contains ? "" : "^"; + const append = opts.contains ? "" : "$"; + let source = `${prepend}(?:${parsed.output})${append}`; + if (parsed && parsed.negated === true) { + source = `^(?!${source}).*$`; + } + const regex = picomatch.toRegex(source, options); + if (returnState === true) { + regex.state = parsed; + } + return regex; + }; + picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => { + if (!input || typeof input !== "string") { + throw new TypeError("Expected a non-empty string"); + } + const opts = options || {}; + let parsed = {negated: false, fastpaths: true}; + let prefix = ""; + let output; + if (input.startsWith("./")) { + input = input.slice(2); + prefix = parsed.prefix = "./"; + } + if (opts.fastpaths !== false && (input[0] === "." || input[0] === "*")) { + output = parse.fastpaths(input, options); + } + if (output === void 0) { + parsed = parse(input, options); + parsed.prefix = prefix + (parsed.prefix || ""); + } else { + parsed.output = output; + } + return picomatch.compileRe(parsed, options, returnOutput, returnState); + }; + picomatch.toRegex = (source, options) => { + try { + const opts = options || {}; + return new RegExp(source, opts.flags || (opts.nocase ? "i" : "")); + } catch (err) { + if (options && options.debug === true) + throw err; + return /$^/; + } + }; + picomatch.constants = constants; + module2.exports = picomatch; +}); + +// node_modules/picomatch/index.js +var require_picomatch2 = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = require_picomatch(); +}); + +// node_modules/readdirp/index.js +var require_readdirp = __commonJS((exports2, module2) => { + "use strict"; + var fs = require("fs"); + var {Readable} = require("stream"); + var sysPath = require("path"); + var {promisify} = require("util"); + var picomatch = require_picomatch2(); + var readdir = promisify(fs.readdir); + var stat = promisify(fs.stat); + var lstat = promisify(fs.lstat); + var realpath = promisify(fs.realpath); + var BANG = "!"; + var NORMAL_FLOW_ERRORS = new Set(["ENOENT", "EPERM", "EACCES", "ELOOP"]); + var FILE_TYPE = "files"; + var DIR_TYPE = "directories"; + var FILE_DIR_TYPE = "files_directories"; + var EVERYTHING_TYPE = "all"; + var ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE]; + var isNormalFlowError = (error) => NORMAL_FLOW_ERRORS.has(error.code); + var normalizeFilter = (filter) => { + if (filter === void 0) + return; + if (typeof filter === "function") + return filter; + if (typeof filter === "string") { + const glob = picomatch(filter.trim()); + return (entry) => glob(entry.basename); + } + if (Array.isArray(filter)) { + const positive = []; + const negative = []; + for (const item of filter) { + const trimmed = item.trim(); + if (trimmed.charAt(0) === BANG) { + negative.push(picomatch(trimmed.slice(1))); + } else { + positive.push(picomatch(trimmed)); + } + } + if (negative.length > 0) { + if (positive.length > 0) { + return (entry) => positive.some((f) => f(entry.basename)) && !negative.some((f) => f(entry.basename)); + } + return (entry) => !negative.some((f) => f(entry.basename)); + } + return (entry) => positive.some((f) => f(entry.basename)); + } + }; + var ReaddirpStream = class extends Readable { + static get defaultOptions() { + return { + root: ".", + fileFilter: (path) => true, + directoryFilter: (path) => true, + type: FILE_TYPE, + lstat: false, + depth: 2147483648, + alwaysStat: false + }; + } + constructor(options = {}) { + super({ + objectMode: true, + autoDestroy: true, + highWaterMark: options.highWaterMark || 4096 + }); + const opts = {...ReaddirpStream.defaultOptions, ...options}; + const {root, type} = opts; + this._fileFilter = normalizeFilter(opts.fileFilter); + this._directoryFilter = normalizeFilter(opts.directoryFilter); + const statMethod = opts.lstat ? lstat : stat; + if (process.platform === "win32" && stat.length === 3) { + this._stat = (path) => statMethod(path, {bigint: true}); + } else { + this._stat = statMethod; + } + this._maxDepth = opts.depth; + this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type); + this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type); + this._wantsEverything = type === EVERYTHING_TYPE; + this._root = sysPath.resolve(root); + this._isDirent = "Dirent" in fs && !opts.alwaysStat; + this._statsProp = this._isDirent ? "dirent" : "stats"; + this._rdOptions = {encoding: "utf8", withFileTypes: this._isDirent}; + this.parents = [this._exploreDir(root, 1)]; + this.reading = false; + this.parent = void 0; + } + async _read(batch) { + if (this.reading) + return; + this.reading = true; + try { + while (!this.destroyed && batch > 0) { + const {path, depth, files = []} = this.parent || {}; + if (files.length > 0) { + const slice = files.splice(0, batch).map((dirent) => this._formatEntry(dirent, path)); + for (const entry of await Promise.all(slice)) { + if (this.destroyed) + return; + const entryType = await this._getEntryType(entry); + if (entryType === "directory" && this._directoryFilter(entry)) { + if (depth <= this._maxDepth) { + this.parents.push(this._exploreDir(entry.fullPath, depth + 1)); + } + if (this._wantsDir) { + this.push(entry); + batch--; + } + } else if ((entryType === "file" || this._includeAsFile(entry)) && this._fileFilter(entry)) { + if (this._wantsFile) { + this.push(entry); + batch--; + } + } + } + } else { + const parent = this.parents.pop(); + if (!parent) { + this.push(null); + break; + } + this.parent = await parent; + if (this.destroyed) + return; + } + } + } catch (error) { + this.destroy(error); + } finally { + this.reading = false; + } + } + async _exploreDir(path, depth) { + let files; + try { + files = await readdir(path, this._rdOptions); + } catch (error) { + this._onError(error); + } + return {files, depth, path}; + } + async _formatEntry(dirent, path) { + let entry; + try { + const basename2 = this._isDirent ? dirent.name : dirent; + const fullPath = sysPath.resolve(sysPath.join(path, basename2)); + entry = {path: sysPath.relative(this._root, fullPath), fullPath, basename: basename2}; + entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath); + } catch (err) { + this._onError(err); + } + return entry; + } + _onError(err) { + if (isNormalFlowError(err) && !this.destroyed) { + this.emit("warn", err); + } else { + this.destroy(err); + } + } + async _getEntryType(entry) { + const stats = entry && entry[this._statsProp]; + if (!stats) { + return; + } + if (stats.isFile()) { + return "file"; + } + if (stats.isDirectory()) { + return "directory"; + } + if (stats && stats.isSymbolicLink()) { + try { + const entryRealPath = await realpath(entry.fullPath); + const entryRealPathStats = await lstat(entryRealPath); + if (entryRealPathStats.isFile()) { + return "file"; + } + if (entryRealPathStats.isDirectory()) { + return "directory"; + } + } catch (error) { + this._onError(error); + } + } + } + _includeAsFile(entry) { + const stats = entry && entry[this._statsProp]; + return stats && this._wantsEverything && !stats.isDirectory(); + } + }; + var readdirp = (root, options = {}) => { + let type = options.entryType || options.type; + if (type === "both") + type = FILE_DIR_TYPE; + if (type) + options.type = type; + if (!root) { + throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)"); + } else if (typeof root !== "string") { + throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)"); + } else if (type && !ALL_TYPES.includes(type)) { + throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(", ")}`); + } + options.root = root; + return new ReaddirpStream(options); + }; + var readdirpPromise = (root, options = {}) => { + return new Promise((resolve, reject) => { + const files = []; + readdirp(root, options).on("data", (entry) => files.push(entry)).on("end", () => resolve(files)).on("error", (error) => reject(error)); + }); + }; + readdirp.promise = readdirpPromise; + readdirp.ReaddirpStream = ReaddirpStream; + readdirp.default = readdirp; + module2.exports = readdirp; +}); + +// node_modules/fs.realpath/old.js +var require_old = __commonJS((exports2) => { + var pathModule = require("path"); + var isWindows = process.platform === "win32"; + var fs = require("fs"); + var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); + function rethrow() { + var callback; + if (DEBUG) { + var backtrace = new Error(); + callback = debugCallback; + } else + callback = missingCallback; + return callback; + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); + } + } + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; + else if (!process.noDeprecation) { + var msg = "fs: missing callback " + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); + } + } + } + } + function maybeCallback(cb) { + return typeof cb === "function" ? cb : rethrow(); + } + var normalize = pathModule.normalize; + if (isWindows) { + nextPartRe = /(.*?)(?:[\/\\]+|$)/g; + } else { + nextPartRe = /(.*?)(?:[\/]+|$)/g; + } + var nextPartRe; + if (isWindows) { + splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; + } else { + splitRootRe = /^[\/]*/; + } + var splitRootRe; + exports2.realpathSync = function realpathSync(p, cache) { + p = pathModule.resolve(p); + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; + } + var original = p, seenLinks = {}, knownHard = {}; + var pos; + var current; + var base; + var previous; + start(); + function start() { + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ""; + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; + } + } + while (pos < p.length) { + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + if (knownHard[base] || cache && cache[base] === base) { + continue; + } + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + resolvedLink = cache[base]; + } else { + var stat = fs.lstatSync(base); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) + cache[base] = base; + continue; + } + var linkTarget = null; + if (!isWindows) { + var id = stat.dev.toString(32) + ":" + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs.statSync(base); + linkTarget = fs.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + if (cache) + cache[base] = resolvedLink; + if (!isWindows) + seenLinks[id] = linkTarget; + } + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } + if (cache) + cache[original] = p; + return p; + }; + exports2.realpath = function realpath(p, cache, cb) { + if (typeof cb !== "function") { + cb = maybeCallback(cache); + cache = null; + } + p = pathModule.resolve(p); + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } + var original = p, seenLinks = {}, knownHard = {}; + var pos; + var current; + var base; + var previous; + start(); + function start() { + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ""; + if (isWindows && !knownHard[base]) { + fs.lstat(base, function(err) { + if (err) + return cb(err); + knownHard[base] = true; + LOOP(); + }); + } else { + process.nextTick(LOOP); + } + } + function LOOP() { + if (pos >= p.length) { + if (cache) + cache[original] = p; + return cb(null, p); + } + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + if (knownHard[base] || cache && cache[base] === base) { + return process.nextTick(LOOP); + } + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + return gotResolvedLink(cache[base]); + } + return fs.lstat(base, gotStat); + } + function gotStat(err, stat) { + if (err) + return cb(err); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) + cache[base] = base; + return process.nextTick(LOOP); + } + if (!isWindows) { + var id = stat.dev.toString(32) + ":" + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); + } + } + fs.stat(base, function(err2) { + if (err2) + return cb(err2); + fs.readlink(base, function(err3, target) { + if (!isWindows) + seenLinks[id] = target; + gotTarget(err3, target); + }); + }); + } + function gotTarget(err, target, base2) { + if (err) + return cb(err); + var resolvedLink = pathModule.resolve(previous, target); + if (cache) + cache[base2] = resolvedLink; + gotResolvedLink(resolvedLink); + } + function gotResolvedLink(resolvedLink) { + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } + }; +}); + +// node_modules/fs.realpath/index.js +var require_fs = __commonJS((exports2, module2) => { + module2.exports = realpath; + realpath.realpath = realpath; + realpath.sync = realpathSync; + realpath.realpathSync = realpathSync; + realpath.monkeypatch = monkeypatch; + realpath.unmonkeypatch = unmonkeypatch; + var fs = require("fs"); + var origRealpath = fs.realpath; + var origRealpathSync = fs.realpathSync; + var version = process.version; + var ok = /^v[0-5]\./.test(version); + var old = require_old(); + function newError(er) { + return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG"); + } + function realpath(p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb); + } + if (typeof cache === "function") { + cb = cache; + cache = null; + } + origRealpath(p, cache, function(er, result) { + if (newError(er)) { + old.realpath(p, cache, cb); + } else { + cb(er, result); + } + }); + } + function realpathSync(p, cache) { + if (ok) { + return origRealpathSync(p, cache); + } + try { + return origRealpathSync(p, cache); + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache); + } else { + throw er; + } + } + } + function monkeypatch() { + fs.realpath = realpath; + fs.realpathSync = realpathSync; + } + function unmonkeypatch() { + fs.realpath = origRealpath; + fs.realpathSync = origRealpathSync; + } +}); + +// node_modules/concat-map/index.js +var require_concat_map = __commonJS((exports2, module2) => { + module2.exports = function(xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) + res.push.apply(res, x); + else + res.push(x); + } + return res; + }; + var isArray = Array.isArray || function(xs) { + return Object.prototype.toString.call(xs) === "[object Array]"; + }; +}); + +// node_modules/balanced-match/index.js +var require_balanced_match = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = balanced; + function balanced(a, b, str) { + if (a instanceof RegExp) + a = maybeMatch(a, str); + if (b instanceof RegExp) + b = maybeMatch(b, str); + var r = range(a, b, str); + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; + } + function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; + } + balanced.range = range; + function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + if (ai >= 0 && bi > 0) { + begs = []; + left = str.length; + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [begs.pop(), bi]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + bi = str.indexOf(b, i + 1); + } + i = ai < bi && ai >= 0 ? ai : bi; + } + if (begs.length) { + result = [left, right]; + } + } + return result; + } +}); + +// node_modules/brace-expansion/index.js +var require_brace_expansion = __commonJS((exports2, module2) => { + var concatMap = require_concat_map(); + var balanced = require_balanced_match(); + module2.exports = expandTop; + var escSlash = "\0SLASH" + Math.random() + "\0"; + var escOpen = "\0OPEN" + Math.random() + "\0"; + var escClose = "\0CLOSE" + Math.random() + "\0"; + var escComma = "\0COMMA" + Math.random() + "\0"; + var escPeriod = "\0PERIOD" + Math.random() + "\0"; + function numeric(str) { + return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0); + } + function escapeBraces(str) { + return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod); + } + function unescapeBraces(str) { + return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join("."); + } + function parseCommaParts(str) { + if (!str) + return [""]; + var parts = []; + var m = balanced("{", "}", str); + if (!m) + return str.split(","); + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(","); + p[p.length - 1] += "{" + body + "}"; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length - 1] += postParts.shift(); + p.push.apply(p, postParts); + } + parts.push.apply(parts, p); + return parts; + } + function expandTop(str) { + if (!str) + return []; + if (str.substr(0, 2) === "{}") { + str = "\\{\\}" + str.substr(2); + } + return expand(escapeBraces(str), true).map(unescapeBraces); + } + function embrace(str) { + return "{" + str + "}"; + } + function isPadded(el) { + return /^-?0\d/.test(el); + } + function lte(i, y) { + return i <= y; + } + function gte(i, y) { + return i >= y; + } + function expand(str, isTop) { + var expansions = []; + var m = balanced("{", "}", str); + if (!m || /\$$/.test(m.pre)) + return [str]; + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(",") >= 0; + if (!isSequence && !isOptions) { + if (m.post.match(/,.*\}/)) { + str = m.pre + "{" + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length ? expand(m.post, false) : [""]; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + var pre = m.pre; + var post = m.post.length ? expand(m.post, false) : [""]; + var N; + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length); + var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + N = []; + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === "\\") + c = ""; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join("0"); + if (i < 0) + c = "-" + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { + return expand(el, false); + }); + } + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + return expansions; + } +}); + +// node_modules/minimatch/minimatch.js +var require_minimatch = __commonJS((exports2, module2) => { + module2.exports = minimatch; + minimatch.Minimatch = Minimatch; + var path = {sep: "/"}; + try { + path = require("path"); + } catch (er) { + } + var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}; + var expand = require_brace_expansion(); + var plTypes = { + "!": {open: "(?:(?!(?:", close: "))[^/]*?)"}, + "?": {open: "(?:", close: ")?"}, + "+": {open: "(?:", close: ")+"}, + "*": {open: "(?:", close: ")*"}, + "@": {open: "(?:", close: ")"} + }; + var qmark = "[^/]"; + var star = qmark + "*?"; + var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?"; + var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?"; + var reSpecials = charSet("().*{}+?[]^$\\!"); + function charSet(s) { + return s.split("").reduce(function(set, c) { + set[c] = true; + return set; + }, {}); + } + var slashSplit = /\/+/; + minimatch.filter = filter; + function filter(pattern, options) { + options = options || {}; + return function(p, i, list) { + return minimatch(p, pattern, options); + }; + } + function ext(a, b) { + a = a || {}; + b = b || {}; + var t = {}; + Object.keys(b).forEach(function(k) { + t[k] = b[k]; + }); + Object.keys(a).forEach(function(k) { + t[k] = a[k]; + }); + return t; + } + minimatch.defaults = function(def) { + if (!def || !Object.keys(def).length) + return minimatch; + var orig = minimatch; + var m = function minimatch2(p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)); + }; + m.Minimatch = function Minimatch2(pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)); + }; + return m; + }; + Minimatch.defaults = function(def) { + if (!def || !Object.keys(def).length) + return Minimatch; + return minimatch.defaults(def).Minimatch; + }; + function minimatch(p, pattern, options) { + if (typeof pattern !== "string") { + throw new TypeError("glob pattern string required"); + } + if (!options) + options = {}; + if (!options.nocomment && pattern.charAt(0) === "#") { + return false; + } + if (pattern.trim() === "") + return p === ""; + return new Minimatch(pattern, options).match(p); + } + function Minimatch(pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options); + } + if (typeof pattern !== "string") { + throw new TypeError("glob pattern string required"); + } + if (!options) + options = {}; + pattern = pattern.trim(); + if (path.sep !== "/") { + pattern = pattern.split(path.sep).join("/"); + } + this.options = options; + this.set = []; + this.pattern = pattern; + this.regexp = null; + this.negate = false; + this.comment = false; + this.empty = false; + this.make(); + } + Minimatch.prototype.debug = function() { + }; + Minimatch.prototype.make = make; + function make() { + if (this._made) + return; + var pattern = this.pattern; + var options = this.options; + if (!options.nocomment && pattern.charAt(0) === "#") { + this.comment = true; + return; + } + if (!pattern) { + this.empty = true; + return; + } + this.parseNegate(); + var set = this.globSet = this.braceExpand(); + if (options.debug) + this.debug = console.error; + this.debug(this.pattern, set); + set = this.globParts = set.map(function(s) { + return s.split(slashSplit); + }); + this.debug(this.pattern, set); + set = set.map(function(s, si, set2) { + return s.map(this.parse, this); + }, this); + this.debug(this.pattern, set); + set = set.filter(function(s) { + return s.indexOf(false) === -1; + }); + this.debug(this.pattern, set); + this.set = set; + } + Minimatch.prototype.parseNegate = parseNegate; + function parseNegate() { + var pattern = this.pattern; + var negate = false; + var options = this.options; + var negateOffset = 0; + if (options.nonegate) + return; + for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) { + negate = !negate; + negateOffset++; + } + if (negateOffset) + this.pattern = pattern.substr(negateOffset); + this.negate = negate; + } + minimatch.braceExpand = function(pattern, options) { + return braceExpand(pattern, options); + }; + Minimatch.prototype.braceExpand = braceExpand; + function braceExpand(pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options; + } else { + options = {}; + } + } + pattern = typeof pattern === "undefined" ? this.pattern : pattern; + if (typeof pattern === "undefined") { + throw new TypeError("undefined pattern"); + } + if (options.nobrace || !pattern.match(/\{.*\}/)) { + return [pattern]; + } + return expand(pattern); + } + Minimatch.prototype.parse = parse; + var SUBPARSE = {}; + function parse(pattern, isSub) { + if (pattern.length > 1024 * 64) { + throw new TypeError("pattern is too long"); + } + var options = this.options; + if (!options.noglobstar && pattern === "**") + return GLOBSTAR; + if (pattern === "") + return ""; + var re = ""; + var hasMagic = !!options.nocase; + var escaping = false; + var patternListStack = []; + var negativeLists = []; + var stateChar; + var inClass = false; + var reClassStart = -1; + var classStart = -1; + var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)"; + var self2 = this; + function clearStateChar() { + if (stateChar) { + switch (stateChar) { + case "*": + re += star; + hasMagic = true; + break; + case "?": + re += qmark; + hasMagic = true; + break; + default: + re += "\\" + stateChar; + break; + } + self2.debug("clearStateChar %j %j", stateChar, re); + stateChar = false; + } + } + for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) { + this.debug("%s %s %s %j", pattern, i, re, c); + if (escaping && reSpecials[c]) { + re += "\\" + c; + escaping = false; + continue; + } + switch (c) { + case "/": + return false; + case "\\": + clearStateChar(); + escaping = true; + continue; + case "?": + case "*": + case "+": + case "@": + case "!": + this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c); + if (inClass) { + this.debug(" in class"); + if (c === "!" && i === classStart + 1) + c = "^"; + re += c; + continue; + } + self2.debug("call clearStateChar %j", stateChar); + clearStateChar(); + stateChar = c; + if (options.noext) + clearStateChar(); + continue; + case "(": + if (inClass) { + re += "("; + continue; + } + if (!stateChar) { + re += "\\("; + continue; + } + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }); + re += stateChar === "!" ? "(?:(?!(?:" : "(?:"; + this.debug("plType %j %j", stateChar, re); + stateChar = false; + continue; + case ")": + if (inClass || !patternListStack.length) { + re += "\\)"; + continue; + } + clearStateChar(); + hasMagic = true; + var pl = patternListStack.pop(); + re += pl.close; + if (pl.type === "!") { + negativeLists.push(pl); + } + pl.reEnd = re.length; + continue; + case "|": + if (inClass || !patternListStack.length || escaping) { + re += "\\|"; + escaping = false; + continue; + } + clearStateChar(); + re += "|"; + continue; + case "[": + clearStateChar(); + if (inClass) { + re += "\\" + c; + continue; + } + inClass = true; + classStart = i; + reClassStart = re.length; + re += c; + continue; + case "]": + if (i === classStart + 1 || !inClass) { + re += "\\" + c; + escaping = false; + continue; + } + if (inClass) { + var cs = pattern.substring(classStart + 1, i); + try { + RegExp("[" + cs + "]"); + } catch (er) { + var sp = this.parse(cs, SUBPARSE); + re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]"; + hasMagic = hasMagic || sp[1]; + inClass = false; + continue; + } + } + hasMagic = true; + inClass = false; + re += c; + continue; + default: + clearStateChar(); + if (escaping) { + escaping = false; + } else if (reSpecials[c] && !(c === "^" && inClass)) { + re += "\\"; + } + re += c; + } + } + if (inClass) { + cs = pattern.substr(classStart + 1); + sp = this.parse(cs, SUBPARSE); + re = re.substr(0, reClassStart) + "\\[" + sp[0]; + hasMagic = hasMagic || sp[1]; + } + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length); + this.debug("setting tail", re, pl); + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) { + if (!$2) { + $2 = "\\"; + } + return $1 + $1 + $2 + "|"; + }); + this.debug("tail=%j\n %s", tail, tail, pl, re); + var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type; + hasMagic = true; + re = re.slice(0, pl.reStart) + t + "\\(" + tail; + } + clearStateChar(); + if (escaping) { + re += "\\\\"; + } + var addPatternStart = false; + switch (re.charAt(0)) { + case ".": + case "[": + case "(": + addPatternStart = true; + } + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n]; + var nlBefore = re.slice(0, nl.reStart); + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8); + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd); + var nlAfter = re.slice(nl.reEnd); + nlLast += nlAfter; + var openParensBefore = nlBefore.split("(").length - 1; + var cleanAfter = nlAfter; + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, ""); + } + nlAfter = cleanAfter; + var dollar = ""; + if (nlAfter === "" && isSub !== SUBPARSE) { + dollar = "$"; + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast; + re = newRe; + } + if (re !== "" && hasMagic) { + re = "(?=.)" + re; + } + if (addPatternStart) { + re = patternStart + re; + } + if (isSub === SUBPARSE) { + return [re, hasMagic]; + } + if (!hasMagic) { + return globUnescape(pattern); + } + var flags = options.nocase ? "i" : ""; + try { + var regExp = new RegExp("^" + re + "$", flags); + } catch (er) { + return new RegExp("$."); + } + regExp._glob = pattern; + regExp._src = re; + return regExp; + } + minimatch.makeRe = function(pattern, options) { + return new Minimatch(pattern, options || {}).makeRe(); + }; + Minimatch.prototype.makeRe = makeRe; + function makeRe() { + if (this.regexp || this.regexp === false) + return this.regexp; + var set = this.set; + if (!set.length) { + this.regexp = false; + return this.regexp; + } + var options = this.options; + var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot; + var flags = options.nocase ? "i" : ""; + var re = set.map(function(pattern) { + return pattern.map(function(p) { + return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src; + }).join("\\/"); + }).join("|"); + re = "^(?:" + re + ")$"; + if (this.negate) + re = "^(?!" + re + ").*$"; + try { + this.regexp = new RegExp(re, flags); + } catch (ex) { + this.regexp = false; + } + return this.regexp; + } + minimatch.match = function(list, pattern, options) { + options = options || {}; + var mm = new Minimatch(pattern, options); + list = list.filter(function(f) { + return mm.match(f); + }); + if (mm.options.nonull && !list.length) { + list.push(pattern); + } + return list; + }; + Minimatch.prototype.match = match; + function match(f, partial) { + this.debug("match", f, this.pattern); + if (this.comment) + return false; + if (this.empty) + return f === ""; + if (f === "/" && partial) + return true; + var options = this.options; + if (path.sep !== "/") { + f = f.split(path.sep).join("/"); + } + f = f.split(slashSplit); + this.debug(this.pattern, "split", f); + var set = this.set; + this.debug(this.pattern, "set", set); + var filename; + var i; + for (i = f.length - 1; i >= 0; i--) { + filename = f[i]; + if (filename) + break; + } + for (i = 0; i < set.length; i++) { + var pattern = set[i]; + var file = f; + if (options.matchBase && pattern.length === 1) { + file = [filename]; + } + var hit = this.matchOne(file, pattern, partial); + if (hit) { + if (options.flipNegate) + return true; + return !this.negate; + } + } + if (options.flipNegate) + return false; + return this.negate; + } + Minimatch.prototype.matchOne = function(file, pattern, partial) { + var options = this.options; + this.debug("matchOne", {this: this, file, pattern}); + this.debug("matchOne", file.length, pattern.length); + for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) { + this.debug("matchOne loop"); + var p = pattern[pi]; + var f = file[fi]; + this.debug(pattern, p, f); + if (p === false) + return false; + if (p === GLOBSTAR) { + this.debug("GLOBSTAR", [pattern, p, f]); + var fr = fi; + var pr = pi + 1; + if (pr === pl) { + this.debug("** at the end"); + for (; fi < fl; fi++) { + if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") + return false; + } + return true; + } + while (fr < fl) { + var swallowee = file[fr]; + this.debug("\nglobstar while", file, fr, pattern, pr, swallowee); + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug("globstar found match!", fr, fl, swallowee); + return true; + } else { + if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") { + this.debug("dot detected!", file, fr, pattern, pr); + break; + } + this.debug("globstar swallow a segment, and continue"); + fr++; + } + } + if (partial) { + this.debug("\n>>> no match, partial?", file, fr, pattern, pr); + if (fr === fl) + return true; + } + return false; + } + var hit; + if (typeof p === "string") { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase(); + } else { + hit = f === p; + } + this.debug("string match", p, f, hit); + } else { + hit = f.match(p); + this.debug("pattern match", p, f, hit); + } + if (!hit) + return false; + } + if (fi === fl && pi === pl) { + return true; + } else if (fi === fl) { + return partial; + } else if (pi === pl) { + var emptyFileEnd = fi === fl - 1 && file[fi] === ""; + return emptyFileEnd; + } + throw new Error("wtf?"); + }; + function globUnescape(s) { + return s.replace(/\\(.)/g, "$1"); + } + function regExpEscape(s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + } +}); + +// node_modules/inherits/inherits_browser.js +var require_inherits_browser = __commonJS((exports2, module2) => { + if (typeof Object.create === "function") { + module2.exports = function inherits2(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + } + }; + } else { + module2.exports = function inherits2(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + }; + } +}); + +// node_modules/inherits/inherits.js +var require_inherits = __commonJS((exports2, module2) => { + try { + util = require("util"); + if (typeof util.inherits !== "function") + throw ""; + module2.exports = util.inherits; + } catch (e) { + module2.exports = require_inherits_browser(); + } + var util; +}); + +// node_modules/path-is-absolute/index.js +var require_path_is_absolute = __commonJS((exports2, module2) => { + "use strict"; + function posix(path) { + return path.charAt(0) === "/"; + } + function win32(path) { + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ""; + var isUnc = Boolean(device && device.charAt(1) !== ":"); + return Boolean(result[2] || isUnc); + } + module2.exports = process.platform === "win32" ? win32 : posix; + module2.exports.posix = posix; + module2.exports.win32 = win32; +}); + +// node_modules/glob/common.js +var require_common = __commonJS((exports2) => { + exports2.alphasort = alphasort; + exports2.alphasorti = alphasorti; + exports2.setopts = setopts; + exports2.ownProp = ownProp; + exports2.makeAbs = makeAbs; + exports2.finish = finish; + exports2.mark = mark; + exports2.isIgnored = isIgnored; + exports2.childrenIgnored = childrenIgnored; + function ownProp(obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field); + } + var path = require("path"); + var minimatch = require_minimatch(); + var isAbsolute = require_path_is_absolute(); + var Minimatch = minimatch.Minimatch; + function alphasorti(a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()); + } + function alphasort(a, b) { + return a.localeCompare(b); + } + function setupIgnores(self2, options) { + self2.ignore = options.ignore || []; + if (!Array.isArray(self2.ignore)) + self2.ignore = [self2.ignore]; + if (self2.ignore.length) { + self2.ignore = self2.ignore.map(ignoreMap); + } + } + function ignoreMap(pattern) { + var gmatcher = null; + if (pattern.slice(-3) === "/**") { + var gpattern = pattern.replace(/(\/\*\*)+$/, ""); + gmatcher = new Minimatch(gpattern, {dot: true}); + } + return { + matcher: new Minimatch(pattern, {dot: true}), + gmatcher + }; + } + function setopts(self2, pattern, options) { + if (!options) + options = {}; + if (options.matchBase && pattern.indexOf("/") === -1) { + if (options.noglobstar) { + throw new Error("base matching requires globstar"); + } + pattern = "**/" + pattern; + } + self2.silent = !!options.silent; + self2.pattern = pattern; + self2.strict = options.strict !== false; + self2.realpath = !!options.realpath; + self2.realpathCache = options.realpathCache || Object.create(null); + self2.follow = !!options.follow; + self2.dot = !!options.dot; + self2.mark = !!options.mark; + self2.nodir = !!options.nodir; + if (self2.nodir) + self2.mark = true; + self2.sync = !!options.sync; + self2.nounique = !!options.nounique; + self2.nonull = !!options.nonull; + self2.nosort = !!options.nosort; + self2.nocase = !!options.nocase; + self2.stat = !!options.stat; + self2.noprocess = !!options.noprocess; + self2.absolute = !!options.absolute; + self2.maxLength = options.maxLength || Infinity; + self2.cache = options.cache || Object.create(null); + self2.statCache = options.statCache || Object.create(null); + self2.symlinks = options.symlinks || Object.create(null); + setupIgnores(self2, options); + self2.changedCwd = false; + var cwd = process.cwd(); + if (!ownProp(options, "cwd")) + self2.cwd = cwd; + else { + self2.cwd = path.resolve(options.cwd); + self2.changedCwd = self2.cwd !== cwd; + } + self2.root = options.root || path.resolve(self2.cwd, "/"); + self2.root = path.resolve(self2.root); + if (process.platform === "win32") + self2.root = self2.root.replace(/\\/g, "/"); + self2.cwdAbs = isAbsolute(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd); + if (process.platform === "win32") + self2.cwdAbs = self2.cwdAbs.replace(/\\/g, "/"); + self2.nomount = !!options.nomount; + options.nonegate = true; + options.nocomment = true; + self2.minimatch = new Minimatch(pattern, options); + self2.options = self2.minimatch.options; + } + function finish(self2) { + var nou = self2.nounique; + var all = nou ? [] : Object.create(null); + for (var i = 0, l = self2.matches.length; i < l; i++) { + var matches = self2.matches[i]; + if (!matches || Object.keys(matches).length === 0) { + if (self2.nonull) { + var literal = self2.minimatch.globSet[i]; + if (nou) + all.push(literal); + else + all[literal] = true; + } + } else { + var m = Object.keys(matches); + if (nou) + all.push.apply(all, m); + else + m.forEach(function(m2) { + all[m2] = true; + }); + } + } + if (!nou) + all = Object.keys(all); + if (!self2.nosort) + all = all.sort(self2.nocase ? alphasorti : alphasort); + if (self2.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self2._mark(all[i]); + } + if (self2.nodir) { + all = all.filter(function(e) { + var notDir = !/\/$/.test(e); + var c = self2.cache[e] || self2.cache[makeAbs(self2, e)]; + if (notDir && c) + notDir = c !== "DIR" && !Array.isArray(c); + return notDir; + }); + } + } + if (self2.ignore.length) + all = all.filter(function(m2) { + return !isIgnored(self2, m2); + }); + self2.found = all; + } + function mark(self2, p) { + var abs = makeAbs(self2, p); + var c = self2.cache[abs]; + var m = p; + if (c) { + var isDir = c === "DIR" || Array.isArray(c); + var slash = p.slice(-1) === "/"; + if (isDir && !slash) + m += "/"; + else if (!isDir && slash) + m = m.slice(0, -1); + if (m !== p) { + var mabs = makeAbs(self2, m); + self2.statCache[mabs] = self2.statCache[abs]; + self2.cache[mabs] = self2.cache[abs]; + } + } + return m; + } + function makeAbs(self2, f) { + var abs = f; + if (f.charAt(0) === "/") { + abs = path.join(self2.root, f); + } else if (isAbsolute(f) || f === "") { + abs = f; + } else if (self2.changedCwd) { + abs = path.resolve(self2.cwd, f); + } else { + abs = path.resolve(f); + } + if (process.platform === "win32") + abs = abs.replace(/\\/g, "/"); + return abs; + } + function isIgnored(self2, path2) { + if (!self2.ignore.length) + return false; + return self2.ignore.some(function(item) { + return item.matcher.match(path2) || !!(item.gmatcher && item.gmatcher.match(path2)); + }); + } + function childrenIgnored(self2, path2) { + if (!self2.ignore.length) + return false; + return self2.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path2)); + }); + } +}); + +// node_modules/glob/sync.js +var require_sync = __commonJS((exports2, module2) => { + module2.exports = globSync; + globSync.GlobSync = GlobSync; + var fs = require("fs"); + var rp = require_fs(); + var minimatch = require_minimatch(); + var Minimatch = minimatch.Minimatch; + var Glob = require_glob().Glob; + var util = require("util"); + var path = require("path"); + var assert = require("assert"); + var isAbsolute = require_path_is_absolute(); + var common2 = require_common(); + var alphasort = common2.alphasort; + var alphasorti = common2.alphasorti; + var setopts = common2.setopts; + var ownProp = common2.ownProp; + var childrenIgnored = common2.childrenIgnored; + var isIgnored = common2.isIgnored; + function globSync(pattern, options) { + if (typeof options === "function" || arguments.length === 3) + throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167"); + return new GlobSync(pattern, options).found; + } + function GlobSync(pattern, options) { + if (!pattern) + throw new Error("must provide pattern"); + if (typeof options === "function" || arguments.length === 3) + throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167"); + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options); + setopts(this, pattern, options); + if (this.noprocess) + return this; + var n = this.minimatch.set.length; + this.matches = new Array(n); + for (var i = 0; i < n; i++) { + this._process(this.minimatch.set[i], i, false); + } + this._finish(); + } + GlobSync.prototype._finish = function() { + assert(this instanceof GlobSync); + if (this.realpath) { + var self2 = this; + this.matches.forEach(function(matchset, index) { + var set = self2.matches[index] = Object.create(null); + for (var p in matchset) { + try { + p = self2._makeAbs(p); + var real = rp.realpathSync(p, self2.realpathCache); + set[real] = true; + } catch (er) { + if (er.syscall === "stat") + set[self2._makeAbs(p)] = true; + else + throw er; + } + } + }); + } + common2.finish(this); + }; + GlobSync.prototype._process = function(pattern, index, inGlobStar) { + assert(this instanceof GlobSync); + var n = 0; + while (typeof pattern[n] === "string") { + n++; + } + var prefix; + switch (n) { + case pattern.length: + this._processSimple(pattern.join("/"), index); + return; + case 0: + prefix = null; + break; + default: + prefix = pattern.slice(0, n).join("/"); + break; + } + var remain = pattern.slice(n); + var read; + if (prefix === null) + read = "."; + else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) { + if (!prefix || !isAbsolute(prefix)) + prefix = "/" + prefix; + read = prefix; + } else + read = prefix; + var abs = this._makeAbs(read); + if (childrenIgnored(this, read)) + return; + var isGlobStar = remain[0] === minimatch.GLOBSTAR; + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar); + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar); + }; + GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar); + if (!entries) + return; + var pn = remain[0]; + var negate = !!this.minimatch.negate; + var rawGlob = pn._glob; + var dotOk = this.dot || rawGlob.charAt(0) === "."; + var matchedEntries = []; + for (var i = 0; i < entries.length; i++) { + var e = entries[i]; + if (e.charAt(0) !== "." || dotOk) { + var m; + if (negate && !prefix) { + m = !e.match(pn); + } else { + m = e.match(pn); + } + if (m) + matchedEntries.push(e); + } + } + var len = matchedEntries.length; + if (len === 0) + return; + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null); + for (var i = 0; i < len; i++) { + var e = matchedEntries[i]; + if (prefix) { + if (prefix.slice(-1) !== "/") + e = prefix + "/" + e; + else + e = prefix + e; + } + if (e.charAt(0) === "/" && !this.nomount) { + e = path.join(this.root, e); + } + this._emitMatch(index, e); + } + return; + } + remain.shift(); + for (var i = 0; i < len; i++) { + var e = matchedEntries[i]; + var newPattern; + if (prefix) + newPattern = [prefix, e]; + else + newPattern = [e]; + this._process(newPattern.concat(remain), index, inGlobStar); + } + }; + GlobSync.prototype._emitMatch = function(index, e) { + if (isIgnored(this, e)) + return; + var abs = this._makeAbs(e); + if (this.mark) + e = this._mark(e); + if (this.absolute) { + e = abs; + } + if (this.matches[index][e]) + return; + if (this.nodir) { + var c = this.cache[abs]; + if (c === "DIR" || Array.isArray(c)) + return; + } + this.matches[index][e] = true; + if (this.stat) + this._stat(e); + }; + GlobSync.prototype._readdirInGlobStar = function(abs) { + if (this.follow) + return this._readdir(abs, false); + var entries; + var lstat; + var stat; + try { + lstat = fs.lstatSync(abs); + } catch (er) { + if (er.code === "ENOENT") { + return null; + } + } + var isSym = lstat && lstat.isSymbolicLink(); + this.symlinks[abs] = isSym; + if (!isSym && lstat && !lstat.isDirectory()) + this.cache[abs] = "FILE"; + else + entries = this._readdir(abs, false); + return entries; + }; + GlobSync.prototype._readdir = function(abs, inGlobStar) { + var entries; + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs); + if (ownProp(this.cache, abs)) { + var c = this.cache[abs]; + if (!c || c === "FILE") + return null; + if (Array.isArray(c)) + return c; + } + try { + return this._readdirEntries(abs, fs.readdirSync(abs)); + } catch (er) { + this._readdirError(abs, er); + return null; + } + }; + GlobSync.prototype._readdirEntries = function(abs, entries) { + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i++) { + var e = entries[i]; + if (abs === "/") + e = abs + e; + else + e = abs + "/" + e; + this.cache[e] = true; + } + } + this.cache[abs] = entries; + return entries; + }; + GlobSync.prototype._readdirError = function(f, er) { + switch (er.code) { + case "ENOTSUP": + case "ENOTDIR": + var abs = this._makeAbs(f); + this.cache[abs] = "FILE"; + if (abs === this.cwdAbs) { + var error = new Error(er.code + " invalid cwd " + this.cwd); + error.path = this.cwd; + error.code = er.code; + throw error; + } + break; + case "ENOENT": + case "ELOOP": + case "ENAMETOOLONG": + case "UNKNOWN": + this.cache[this._makeAbs(f)] = false; + break; + default: + this.cache[this._makeAbs(f)] = false; + if (this.strict) + throw er; + if (!this.silent) + console.error("glob error", er); + break; + } + }; + GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar); + if (!entries) + return; + var remainWithoutGlobStar = remain.slice(1); + var gspref = prefix ? [prefix] : []; + var noGlobStar = gspref.concat(remainWithoutGlobStar); + this._process(noGlobStar, index, false); + var len = entries.length; + var isSym = this.symlinks[abs]; + if (isSym && inGlobStar) + return; + for (var i = 0; i < len; i++) { + var e = entries[i]; + if (e.charAt(0) === "." && !this.dot) + continue; + var instead = gspref.concat(entries[i], remainWithoutGlobStar); + this._process(instead, index, true); + var below = gspref.concat(entries[i], remain); + this._process(below, index, true); + } + }; + GlobSync.prototype._processSimple = function(prefix, index) { + var exists = this._stat(prefix); + if (!this.matches[index]) + this.matches[index] = Object.create(null); + if (!exists) + return; + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix); + if (prefix.charAt(0) === "/") { + prefix = path.join(this.root, prefix); + } else { + prefix = path.resolve(this.root, prefix); + if (trail) + prefix += "/"; + } + } + if (process.platform === "win32") + prefix = prefix.replace(/\\/g, "/"); + this._emitMatch(index, prefix); + }; + GlobSync.prototype._stat = function(f) { + var abs = this._makeAbs(f); + var needDir = f.slice(-1) === "/"; + if (f.length > this.maxLength) + return false; + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs]; + if (Array.isArray(c)) + c = "DIR"; + if (!needDir || c === "DIR") + return c; + if (needDir && c === "FILE") + return false; + } + var exists; + var stat = this.statCache[abs]; + if (!stat) { + var lstat; + try { + lstat = fs.lstatSync(abs); + } catch (er) { + if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) { + this.statCache[abs] = false; + return false; + } + } + if (lstat && lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs); + } catch (er) { + stat = lstat; + } + } else { + stat = lstat; + } + } + this.statCache[abs] = stat; + var c = true; + if (stat) + c = stat.isDirectory() ? "DIR" : "FILE"; + this.cache[abs] = this.cache[abs] || c; + if (needDir && c === "FILE") + return false; + return c; + }; + GlobSync.prototype._mark = function(p) { + return common2.mark(this, p); + }; + GlobSync.prototype._makeAbs = function(f) { + return common2.makeAbs(this, f); + }; +}); + +// node_modules/wrappy/wrappy.js +var require_wrappy = __commonJS((exports2, module2) => { + module2.exports = wrappy; + function wrappy(fn, cb) { + if (fn && cb) + return wrappy(fn)(cb); + if (typeof fn !== "function") + throw new TypeError("need wrapper function"); + Object.keys(fn).forEach(function(k) { + wrapper[k] = fn[k]; + }); + return wrapper; + function wrapper() { + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + var ret2 = fn.apply(this, args); + var cb2 = args[args.length - 1]; + if (typeof ret2 === "function" && ret2 !== cb2) { + Object.keys(cb2).forEach(function(k) { + ret2[k] = cb2[k]; + }); + } + return ret2; + } + } +}); + +// node_modules/once/once.js +var require_once = __commonJS((exports2, module2) => { + var wrappy = require_wrappy(); + module2.exports = wrappy(once); + module2.exports.strict = wrappy(onceStrict); + once.proto = once(function() { + Object.defineProperty(Function.prototype, "once", { + value: function() { + return once(this); + }, + configurable: true + }); + Object.defineProperty(Function.prototype, "onceStrict", { + value: function() { + return onceStrict(this); + }, + configurable: true + }); + }); + function once(fn) { + var f = function() { + if (f.called) + return f.value; + f.called = true; + return f.value = fn.apply(this, arguments); + }; + f.called = false; + return f; + } + function onceStrict(fn) { + var f = function() { + if (f.called) + throw new Error(f.onceError); + f.called = true; + return f.value = fn.apply(this, arguments); + }; + var name = fn.name || "Function wrapped with `once`"; + f.onceError = name + " shouldn't be called more than once"; + f.called = false; + return f; + } +}); + +// node_modules/inflight/inflight.js +var require_inflight = __commonJS((exports2, module2) => { + var wrappy = require_wrappy(); + var reqs = Object.create(null); + var once = require_once(); + module2.exports = wrappy(inflight); + function inflight(key, cb) { + if (reqs[key]) { + reqs[key].push(cb); + return null; + } else { + reqs[key] = [cb]; + return makeres(key); + } + } + function makeres(key) { + return once(function RES() { + var cbs = reqs[key]; + var len = cbs.length; + var args = slice(arguments); + try { + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args); + } + } finally { + if (cbs.length > len) { + cbs.splice(0, len); + process.nextTick(function() { + RES.apply(null, args); + }); + } else { + delete reqs[key]; + } + } + }); + } + function slice(args) { + var length = args.length; + var array = []; + for (var i = 0; i < length; i++) + array[i] = args[i]; + return array; + } +}); + +// node_modules/glob/glob.js +var require_glob = __commonJS((exports2, module2) => { + module2.exports = glob; + var fs = require("fs"); + var rp = require_fs(); + var minimatch = require_minimatch(); + var Minimatch = minimatch.Minimatch; + var inherits2 = require_inherits(); + var EE = require("events").EventEmitter; + var path = require("path"); + var assert = require("assert"); + var isAbsolute = require_path_is_absolute(); + var globSync = require_sync(); + var common2 = require_common(); + var alphasort = common2.alphasort; + var alphasorti = common2.alphasorti; + var setopts = common2.setopts; + var ownProp = common2.ownProp; + var inflight = require_inflight(); + var util = require("util"); + var childrenIgnored = common2.childrenIgnored; + var isIgnored = common2.isIgnored; + var once = require_once(); + function glob(pattern, options, cb) { + if (typeof options === "function") + cb = options, options = {}; + if (!options) + options = {}; + if (options.sync) { + if (cb) + throw new TypeError("callback provided to sync glob"); + return globSync(pattern, options); + } + return new Glob(pattern, options, cb); + } + glob.sync = globSync; + var GlobSync = glob.GlobSync = globSync.GlobSync; + glob.glob = glob; + function extend(origin, add) { + if (add === null || typeof add !== "object") { + return origin; + } + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; + } + glob.hasMagic = function(pattern, options_) { + var options = extend({}, options_); + options.noprocess = true; + var g = new Glob(pattern, options); + var set = g.minimatch.set; + if (!pattern) + return false; + if (set.length > 1) + return true; + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== "string") + return true; + } + return false; + }; + glob.Glob = Glob; + inherits2(Glob, EE); + function Glob(pattern, options, cb) { + if (typeof options === "function") { + cb = options; + options = null; + } + if (options && options.sync) { + if (cb) + throw new TypeError("callback provided to sync glob"); + return new GlobSync(pattern, options); + } + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb); + setopts(this, pattern, options); + this._didRealPath = false; + var n = this.minimatch.set.length; + this.matches = new Array(n); + if (typeof cb === "function") { + cb = once(cb); + this.on("error", cb); + this.on("end", function(matches) { + cb(null, matches); + }); + } + var self2 = this; + this._processing = 0; + this._emitQueue = []; + this._processQueue = []; + this.paused = false; + if (this.noprocess) + return this; + if (n === 0) + return done(); + var sync = true; + for (var i = 0; i < n; i++) { + this._process(this.minimatch.set[i], i, false, done); + } + sync = false; + function done() { + --self2._processing; + if (self2._processing <= 0) { + if (sync) { + process.nextTick(function() { + self2._finish(); + }); + } else { + self2._finish(); + } + } + } + } + Glob.prototype._finish = function() { + assert(this instanceof Glob); + if (this.aborted) + return; + if (this.realpath && !this._didRealpath) + return this._realpath(); + common2.finish(this); + this.emit("end", this.found); + }; + Glob.prototype._realpath = function() { + if (this._didRealpath) + return; + this._didRealpath = true; + var n = this.matches.length; + if (n === 0) + return this._finish(); + var self2 = this; + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next); + function next() { + if (--n === 0) + self2._finish(); + } + }; + Glob.prototype._realpathSet = function(index, cb) { + var matchset = this.matches[index]; + if (!matchset) + return cb(); + var found = Object.keys(matchset); + var self2 = this; + var n = found.length; + if (n === 0) + return cb(); + var set = this.matches[index] = Object.create(null); + found.forEach(function(p, i) { + p = self2._makeAbs(p); + rp.realpath(p, self2.realpathCache, function(er, real) { + if (!er) + set[real] = true; + else if (er.syscall === "stat") + set[p] = true; + else + self2.emit("error", er); + if (--n === 0) { + self2.matches[index] = set; + cb(); + } + }); + }); + }; + Glob.prototype._mark = function(p) { + return common2.mark(this, p); + }; + Glob.prototype._makeAbs = function(f) { + return common2.makeAbs(this, f); + }; + Glob.prototype.abort = function() { + this.aborted = true; + this.emit("abort"); + }; + Glob.prototype.pause = function() { + if (!this.paused) { + this.paused = true; + this.emit("pause"); + } + }; + Glob.prototype.resume = function() { + if (this.paused) { + this.emit("resume"); + this.paused = false; + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0); + this._emitQueue.length = 0; + for (var i = 0; i < eq.length; i++) { + var e = eq[i]; + this._emitMatch(e[0], e[1]); + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0); + this._processQueue.length = 0; + for (var i = 0; i < pq.length; i++) { + var p = pq[i]; + this._processing--; + this._process(p[0], p[1], p[2], p[3]); + } + } + } + }; + Glob.prototype._process = function(pattern, index, inGlobStar, cb) { + assert(this instanceof Glob); + assert(typeof cb === "function"); + if (this.aborted) + return; + this._processing++; + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]); + return; + } + var n = 0; + while (typeof pattern[n] === "string") { + n++; + } + var prefix; + switch (n) { + case pattern.length: + this._processSimple(pattern.join("/"), index, cb); + return; + case 0: + prefix = null; + break; + default: + prefix = pattern.slice(0, n).join("/"); + break; + } + var remain = pattern.slice(n); + var read; + if (prefix === null) + read = "."; + else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) { + if (!prefix || !isAbsolute(prefix)) + prefix = "/" + prefix; + read = prefix; + } else + read = prefix; + var abs = this._makeAbs(read); + if (childrenIgnored(this, read)) + return cb(); + var isGlobStar = remain[0] === minimatch.GLOBSTAR; + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb); + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb); + }; + Glob.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar, cb) { + var self2 = this; + this._readdir(abs, inGlobStar, function(er, entries) { + return self2._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb); + }); + }; + Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) { + if (!entries) + return cb(); + var pn = remain[0]; + var negate = !!this.minimatch.negate; + var rawGlob = pn._glob; + var dotOk = this.dot || rawGlob.charAt(0) === "."; + var matchedEntries = []; + for (var i = 0; i < entries.length; i++) { + var e = entries[i]; + if (e.charAt(0) !== "." || dotOk) { + var m; + if (negate && !prefix) { + m = !e.match(pn); + } else { + m = e.match(pn); + } + if (m) + matchedEntries.push(e); + } + } + var len = matchedEntries.length; + if (len === 0) + return cb(); + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null); + for (var i = 0; i < len; i++) { + var e = matchedEntries[i]; + if (prefix) { + if (prefix !== "/") + e = prefix + "/" + e; + else + e = prefix + e; + } + if (e.charAt(0) === "/" && !this.nomount) { + e = path.join(this.root, e); + } + this._emitMatch(index, e); + } + return cb(); + } + remain.shift(); + for (var i = 0; i < len; i++) { + var e = matchedEntries[i]; + var newPattern; + if (prefix) { + if (prefix !== "/") + e = prefix + "/" + e; + else + e = prefix + e; + } + this._process([e].concat(remain), index, inGlobStar, cb); + } + cb(); + }; + Glob.prototype._emitMatch = function(index, e) { + if (this.aborted) + return; + if (isIgnored(this, e)) + return; + if (this.paused) { + this._emitQueue.push([index, e]); + return; + } + var abs = isAbsolute(e) ? e : this._makeAbs(e); + if (this.mark) + e = this._mark(e); + if (this.absolute) + e = abs; + if (this.matches[index][e]) + return; + if (this.nodir) { + var c = this.cache[abs]; + if (c === "DIR" || Array.isArray(c)) + return; + } + this.matches[index][e] = true; + var st = this.statCache[abs]; + if (st) + this.emit("stat", e, st); + this.emit("match", e); + }; + Glob.prototype._readdirInGlobStar = function(abs, cb) { + if (this.aborted) + return; + if (this.follow) + return this._readdir(abs, false, cb); + var lstatkey = "lstat\0" + abs; + var self2 = this; + var lstatcb = inflight(lstatkey, lstatcb_); + if (lstatcb) + fs.lstat(abs, lstatcb); + function lstatcb_(er, lstat) { + if (er && er.code === "ENOENT") + return cb(); + var isSym = lstat && lstat.isSymbolicLink(); + self2.symlinks[abs] = isSym; + if (!isSym && lstat && !lstat.isDirectory()) { + self2.cache[abs] = "FILE"; + cb(); + } else + self2._readdir(abs, false, cb); + } + }; + Glob.prototype._readdir = function(abs, inGlobStar, cb) { + if (this.aborted) + return; + cb = inflight("readdir\0" + abs + "\0" + inGlobStar, cb); + if (!cb) + return; + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb); + if (ownProp(this.cache, abs)) { + var c = this.cache[abs]; + if (!c || c === "FILE") + return cb(); + if (Array.isArray(c)) + return cb(null, c); + } + var self2 = this; + fs.readdir(abs, readdirCb(this, abs, cb)); + }; + function readdirCb(self2, abs, cb) { + return function(er, entries) { + if (er) + self2._readdirError(abs, er, cb); + else + self2._readdirEntries(abs, entries, cb); + }; + } + Glob.prototype._readdirEntries = function(abs, entries, cb) { + if (this.aborted) + return; + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i++) { + var e = entries[i]; + if (abs === "/") + e = abs + e; + else + e = abs + "/" + e; + this.cache[e] = true; + } + } + this.cache[abs] = entries; + return cb(null, entries); + }; + Glob.prototype._readdirError = function(f, er, cb) { + if (this.aborted) + return; + switch (er.code) { + case "ENOTSUP": + case "ENOTDIR": + var abs = this._makeAbs(f); + this.cache[abs] = "FILE"; + if (abs === this.cwdAbs) { + var error = new Error(er.code + " invalid cwd " + this.cwd); + error.path = this.cwd; + error.code = er.code; + this.emit("error", error); + this.abort(); + } + break; + case "ENOENT": + case "ELOOP": + case "ENAMETOOLONG": + case "UNKNOWN": + this.cache[this._makeAbs(f)] = false; + break; + default: + this.cache[this._makeAbs(f)] = false; + if (this.strict) { + this.emit("error", er); + this.abort(); + } + if (!this.silent) + console.error("glob error", er); + break; + } + return cb(); + }; + Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar, cb) { + var self2 = this; + this._readdir(abs, inGlobStar, function(er, entries) { + self2._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb); + }); + }; + Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) { + if (!entries) + return cb(); + var remainWithoutGlobStar = remain.slice(1); + var gspref = prefix ? [prefix] : []; + var noGlobStar = gspref.concat(remainWithoutGlobStar); + this._process(noGlobStar, index, false, cb); + var isSym = this.symlinks[abs]; + var len = entries.length; + if (isSym && inGlobStar) + return cb(); + for (var i = 0; i < len; i++) { + var e = entries[i]; + if (e.charAt(0) === "." && !this.dot) + continue; + var instead = gspref.concat(entries[i], remainWithoutGlobStar); + this._process(instead, index, true, cb); + var below = gspref.concat(entries[i], remain); + this._process(below, index, true, cb); + } + cb(); + }; + Glob.prototype._processSimple = function(prefix, index, cb) { + var self2 = this; + this._stat(prefix, function(er, exists) { + self2._processSimple2(prefix, index, er, exists, cb); + }); + }; + Glob.prototype._processSimple2 = function(prefix, index, er, exists, cb) { + if (!this.matches[index]) + this.matches[index] = Object.create(null); + if (!exists) + return cb(); + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix); + if (prefix.charAt(0) === "/") { + prefix = path.join(this.root, prefix); + } else { + prefix = path.resolve(this.root, prefix); + if (trail) + prefix += "/"; + } + } + if (process.platform === "win32") + prefix = prefix.replace(/\\/g, "/"); + this._emitMatch(index, prefix); + cb(); + }; + Glob.prototype._stat = function(f, cb) { + var abs = this._makeAbs(f); + var needDir = f.slice(-1) === "/"; + if (f.length > this.maxLength) + return cb(); + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs]; + if (Array.isArray(c)) + c = "DIR"; + if (!needDir || c === "DIR") + return cb(null, c); + if (needDir && c === "FILE") + return cb(); + } + var exists; + var stat = this.statCache[abs]; + if (stat !== void 0) { + if (stat === false) + return cb(null, stat); + else { + var type = stat.isDirectory() ? "DIR" : "FILE"; + if (needDir && type === "FILE") + return cb(); + else + return cb(null, type, stat); + } + } + var self2 = this; + var statcb = inflight("stat\0" + abs, lstatcb_); + if (statcb) + fs.lstat(abs, statcb); + function lstatcb_(er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + return fs.stat(abs, function(er2, stat2) { + if (er2) + self2._stat2(f, abs, null, lstat, cb); + else + self2._stat2(f, abs, er2, stat2, cb); + }); + } else { + self2._stat2(f, abs, er, lstat, cb); + } + } + }; + Glob.prototype._stat2 = function(f, abs, er, stat, cb) { + if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) { + this.statCache[abs] = false; + return cb(); + } + var needDir = f.slice(-1) === "/"; + this.statCache[abs] = stat; + if (abs.slice(-1) === "/" && stat && !stat.isDirectory()) + return cb(null, false, stat); + var c = true; + if (stat) + c = stat.isDirectory() ? "DIR" : "FILE"; + this.cache[abs] = this.cache[abs] || c; + if (needDir && c === "FILE") + return cb(); + return cb(null, c, stat); + }; +}); + +// node_modules/rimraf/rimraf.js +var require_rimraf = __commonJS((exports2, module2) => { + var assert = require("assert"); + var path = require("path"); + var fs = require("fs"); + var glob = void 0; + try { + glob = require_glob(); + } catch (_err) { + } + var defaultGlobOpts = { + nosort: true, + silent: true + }; + var timeout = 0; + var isWindows = process.platform === "win32"; + var defaults = (options) => { + const methods = [ + "unlink", + "chmod", + "stat", + "lstat", + "rmdir", + "readdir" + ]; + methods.forEach((m) => { + options[m] = options[m] || fs[m]; + m = m + "Sync"; + options[m] = options[m] || fs[m]; + }); + options.maxBusyTries = options.maxBusyTries || 3; + options.emfileWait = options.emfileWait || 1e3; + if (options.glob === false) { + options.disableGlob = true; + } + if (options.disableGlob !== true && glob === void 0) { + throw Error("glob dependency not found, set `options.disableGlob = true` if intentional"); + } + options.disableGlob = options.disableGlob || false; + options.glob = options.glob || defaultGlobOpts; + }; + var rimraf = (p, options, cb) => { + if (typeof options === "function") { + cb = options; + options = {}; + } + assert(p, "rimraf: missing path"); + assert.equal(typeof p, "string", "rimraf: path should be a string"); + assert.equal(typeof cb, "function", "rimraf: callback function required"); + assert(options, "rimraf: invalid options argument provided"); + assert.equal(typeof options, "object", "rimraf: options should be object"); + defaults(options); + let busyTries = 0; + let errState = null; + let n = 0; + const next = (er) => { + errState = errState || er; + if (--n === 0) + cb(errState); + }; + const afterGlob = (er, results) => { + if (er) + return cb(er); + n = results.length; + if (n === 0) + return cb(); + results.forEach((p2) => { + const CB = (er2) => { + if (er2) { + if ((er2.code === "EBUSY" || er2.code === "ENOTEMPTY" || er2.code === "EPERM") && busyTries < options.maxBusyTries) { + busyTries++; + return setTimeout(() => rimraf_(p2, options, CB), busyTries * 100); + } + if (er2.code === "EMFILE" && timeout < options.emfileWait) { + return setTimeout(() => rimraf_(p2, options, CB), timeout++); + } + if (er2.code === "ENOENT") + er2 = null; + } + timeout = 0; + next(er2); + }; + rimraf_(p2, options, CB); + }); + }; + if (options.disableGlob || !glob.hasMagic(p)) + return afterGlob(null, [p]); + options.lstat(p, (er, stat) => { + if (!er) + return afterGlob(null, [p]); + glob(p, options.glob, afterGlob); + }); + }; + var rimraf_ = (p, options, cb) => { + assert(p); + assert(options); + assert(typeof cb === "function"); + options.lstat(p, (er, st) => { + if (er && er.code === "ENOENT") + return cb(null); + if (er && er.code === "EPERM" && isWindows) + fixWinEPERM(p, options, er, cb); + if (st && st.isDirectory()) + return rmdir(p, options, er, cb); + options.unlink(p, (er2) => { + if (er2) { + if (er2.code === "ENOENT") + return cb(null); + if (er2.code === "EPERM") + return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb); + if (er2.code === "EISDIR") + return rmdir(p, options, er2, cb); + } + return cb(er2); + }); + }); + }; + var fixWinEPERM = (p, options, er, cb) => { + assert(p); + assert(options); + assert(typeof cb === "function"); + options.chmod(p, 438, (er2) => { + if (er2) + cb(er2.code === "ENOENT" ? null : er); + else + options.stat(p, (er3, stats) => { + if (er3) + cb(er3.code === "ENOENT" ? null : er); + else if (stats.isDirectory()) + rmdir(p, options, er, cb); + else + options.unlink(p, cb); + }); + }); + }; + var fixWinEPERMSync = (p, options, er) => { + assert(p); + assert(options); + try { + options.chmodSync(p, 438); + } catch (er2) { + if (er2.code === "ENOENT") + return; + else + throw er; + } + let stats; + try { + stats = options.statSync(p); + } catch (er3) { + if (er3.code === "ENOENT") + return; + else + throw er; + } + if (stats.isDirectory()) + rmdirSync(p, options, er); + else + options.unlinkSync(p); + }; + var rmdir = (p, options, originalEr, cb) => { + assert(p); + assert(options); + assert(typeof cb === "function"); + options.rmdir(p, (er) => { + if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) + rmkids(p, options, cb); + else if (er && er.code === "ENOTDIR") + cb(originalEr); + else + cb(er); + }); + }; + var rmkids = (p, options, cb) => { + assert(p); + assert(options); + assert(typeof cb === "function"); + options.readdir(p, (er, files) => { + if (er) + return cb(er); + let n = files.length; + if (n === 0) + return options.rmdir(p, cb); + let errState; + files.forEach((f) => { + rimraf(path.join(p, f), options, (er2) => { + if (errState) + return; + if (er2) + return cb(errState = er2); + if (--n === 0) + options.rmdir(p, cb); + }); + }); + }); + }; + var rimrafSync = (p, options) => { + options = options || {}; + defaults(options); + assert(p, "rimraf: missing path"); + assert.equal(typeof p, "string", "rimraf: path should be a string"); + assert(options, "rimraf: missing options"); + assert.equal(typeof options, "object", "rimraf: options should be object"); + let results; + if (options.disableGlob || !glob.hasMagic(p)) { + results = [p]; + } else { + try { + options.lstatSync(p); + results = [p]; + } catch (er) { + results = glob.sync(p, options.glob); + } + } + if (!results.length) + return; + for (let i = 0; i < results.length; i++) { + const p2 = results[i]; + let st; + try { + st = options.lstatSync(p2); + } catch (er) { + if (er.code === "ENOENT") + return; + if (er.code === "EPERM" && isWindows) + fixWinEPERMSync(p2, options, er); + } + try { + if (st && st.isDirectory()) + rmdirSync(p2, options, null); + else + options.unlinkSync(p2); + } catch (er) { + if (er.code === "ENOENT") + return; + if (er.code === "EPERM") + return isWindows ? fixWinEPERMSync(p2, options, er) : rmdirSync(p2, options, er); + if (er.code !== "EISDIR") + throw er; + rmdirSync(p2, options, er); + } + } + }; + var rmdirSync = (p, options, originalEr) => { + assert(p); + assert(options); + try { + options.rmdirSync(p); + } catch (er) { + if (er.code === "ENOENT") + return; + if (er.code === "ENOTDIR") + throw originalEr; + if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") + rmkidsSync(p, options); + } + }; + var rmkidsSync = (p, options) => { + assert(p); + assert(options); + options.readdirSync(p).forEach((f) => rimrafSync(path.join(p, f), options)); + const retries = isWindows ? 100 : 1; + let i = 0; + do { + let threw = true; + try { + const ret2 = options.rmdirSync(p, options); + threw = false; + return ret2; + } finally { + if (++i < retries && threw) + continue; + } + } while (true); + }; + module2.exports = rimraf; + rimraf.sync = rimrafSync; +}); + +// node_modules/semver/internal/constants.js +var require_constants2 = __commonJS((exports2, module2) => { + var SEMVER_SPEC_VERSION = "2.0.0"; + var MAX_LENGTH = 256; + var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; + var MAX_SAFE_COMPONENT_LENGTH = 16; + module2.exports = { + SEMVER_SPEC_VERSION, + MAX_LENGTH, + MAX_SAFE_INTEGER, + MAX_SAFE_COMPONENT_LENGTH + }; +}); + +// node_modules/semver/internal/debug.js +var require_debug = __commonJS((exports2, module2) => { + var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => { + }; + module2.exports = debug; +}); + +// node_modules/semver/internal/re.js +var require_re = __commonJS((exports2, module2) => { + var {MAX_SAFE_COMPONENT_LENGTH} = require_constants2(); + var debug = require_debug(); + exports2 = module2.exports = {}; + var re = exports2.re = []; + var src = exports2.src = []; + var t = exports2.t = {}; + var R = 0; + var createToken = (name, value, isGlobal) => { + const index = R++; + debug(index, value); + t[name] = index; + src[index] = value; + re[index] = new RegExp(value, isGlobal ? "g" : void 0); + }; + createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*"); + createToken("NUMERICIDENTIFIERLOOSE", "[0-9]+"); + createToken("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*"); + createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`); + createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`); + createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`); + createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`); + createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); + createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); + createToken("BUILDIDENTIFIER", "[0-9A-Za-z-]+"); + createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`); + createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`); + createToken("FULL", `^${src[t.FULLPLAIN]}$`); + createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`); + createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`); + createToken("GTLT", "((?:<|>)?=?)"); + createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); + createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); + createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`); + createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`); + createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); + createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); + createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`); + createToken("COERCERTL", src[t.COERCE], true); + createToken("LONETILDE", "(?:~>?)"); + createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true); + exports2.tildeTrimReplace = "$1~"; + createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); + createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); + createToken("LONECARET", "(?:\\^)"); + createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true); + exports2.caretTrimReplace = "$1^"; + createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); + createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); + createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); + createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); + createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); + exports2.comparatorTrimReplace = "$1$2$3"; + createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`); + createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`); + createToken("STAR", "(<|>)?=?\\s*\\*"); + createToken("GTE0", "^\\s*>=\\s*0.0.0\\s*$"); + createToken("GTE0PRE", "^\\s*>=\\s*0.0.0-0\\s*$"); +}); + +// node_modules/semver/internal/parse-options.js +var require_parse_options = __commonJS((exports2, module2) => { + var opts = ["includePrerelease", "loose", "rtl"]; + var parseOptions = (options) => !options ? {} : typeof options !== "object" ? {loose: true} : opts.filter((k) => options[k]).reduce((options2, k) => { + options2[k] = true; + return options2; + }, {}); + module2.exports = parseOptions; +}); + +// node_modules/semver/internal/identifiers.js +var require_identifiers = __commonJS((exports2, module2) => { + var numeric = /^[0-9]+$/; + var compareIdentifiers = (a, b) => { + const anum = numeric.test(a); + const bnum = numeric.test(b); + if (anum && bnum) { + a = +a; + b = +b; + } + return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; + }; + var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a); + module2.exports = { + compareIdentifiers, + rcompareIdentifiers + }; +}); + +// node_modules/semver/classes/semver.js +var require_semver = __commonJS((exports2, module2) => { + var debug = require_debug(); + var {MAX_LENGTH, MAX_SAFE_INTEGER} = require_constants2(); + var {re, t} = require_re(); + var parseOptions = require_parse_options(); + var {compareIdentifiers} = require_identifiers(); + var SemVer = class { + constructor(version, options) { + options = parseOptions(options); + if (version instanceof SemVer) { + if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) { + return version; + } else { + version = version.version; + } + } else if (typeof version !== "string") { + throw new TypeError(`Invalid Version: ${version}`); + } + if (version.length > MAX_LENGTH) { + throw new TypeError(`version is longer than ${MAX_LENGTH} characters`); + } + debug("SemVer", version, options); + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]); + if (!m) { + throw new TypeError(`Invalid Version: ${version}`); + } + this.raw = version; + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError("Invalid major version"); + } + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError("Invalid minor version"); + } + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError("Invalid patch version"); + } + if (!m[4]) { + this.prerelease = []; + } else { + this.prerelease = m[4].split(".").map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id; + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num; + } + } + return id; + }); + } + this.build = m[5] ? m[5].split(".") : []; + this.format(); + } + format() { + this.version = `${this.major}.${this.minor}.${this.patch}`; + if (this.prerelease.length) { + this.version += `-${this.prerelease.join(".")}`; + } + return this.version; + } + toString() { + return this.version; + } + compare(other) { + debug("SemVer.compare", this.version, this.options, other); + if (!(other instanceof SemVer)) { + if (typeof other === "string" && other === this.version) { + return 0; + } + other = new SemVer(other, this.options); + } + if (other.version === this.version) { + return 0; + } + return this.compareMain(other) || this.comparePre(other); + } + compareMain(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch); + } + comparePre(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + if (this.prerelease.length && !other.prerelease.length) { + return -1; + } else if (!this.prerelease.length && other.prerelease.length) { + return 1; + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0; + } + let i = 0; + do { + const a = this.prerelease[i]; + const b = other.prerelease[i]; + debug("prerelease compare", i, a, b); + if (a === void 0 && b === void 0) { + return 0; + } else if (b === void 0) { + return 1; + } else if (a === void 0) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + } + compareBuild(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + let i = 0; + do { + const a = this.build[i]; + const b = other.build[i]; + debug("prerelease compare", i, a, b); + if (a === void 0 && b === void 0) { + return 0; + } else if (b === void 0) { + return 1; + } else if (a === void 0) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + } + inc(release, identifier) { + switch (release) { + case "premajor": + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc("pre", identifier); + break; + case "preminor": + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc("pre", identifier); + break; + case "prepatch": + this.prerelease.length = 0; + this.inc("patch", identifier); + this.inc("pre", identifier); + break; + case "prerelease": + if (this.prerelease.length === 0) { + this.inc("patch", identifier); + } + this.inc("pre", identifier); + break; + case "major": + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { + this.major++; + } + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + case "minor": + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++; + } + this.patch = 0; + this.prerelease = []; + break; + case "patch": + if (this.prerelease.length === 0) { + this.patch++; + } + this.prerelease = []; + break; + case "pre": + if (this.prerelease.length === 0) { + this.prerelease = [0]; + } else { + let i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === "number") { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) { + this.prerelease.push(0); + } + } + if (identifier) { + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0]; + } + } else { + this.prerelease = [identifier, 0]; + } + } + break; + default: + throw new Error(`invalid increment argument: ${release}`); + } + this.format(); + this.raw = this.version; + return this; + } + }; + module2.exports = SemVer; +}); + +// node_modules/semver/functions/parse.js +var require_parse2 = __commonJS((exports2, module2) => { + var {MAX_LENGTH} = require_constants2(); + var {re, t} = require_re(); + var SemVer = require_semver(); + var parseOptions = require_parse_options(); + var parse = (version, options) => { + options = parseOptions(options); + if (version instanceof SemVer) { + return version; + } + if (typeof version !== "string") { + return null; + } + if (version.length > MAX_LENGTH) { + return null; + } + const r = options.loose ? re[t.LOOSE] : re[t.FULL]; + if (!r.test(version)) { + return null; + } + try { + return new SemVer(version, options); + } catch (er) { + return null; + } + }; + module2.exports = parse; +}); + +// node_modules/semver/functions/valid.js +var require_valid = __commonJS((exports2, module2) => { + var parse = require_parse2(); + var valid = (version, options) => { + const v = parse(version, options); + return v ? v.version : null; + }; + module2.exports = valid; +}); + +// node_modules/semver/functions/clean.js +var require_clean = __commonJS((exports2, module2) => { + var parse = require_parse2(); + var clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ""), options); + return s ? s.version : null; + }; + module2.exports = clean; +}); + +// node_modules/semver/functions/inc.js +var require_inc = __commonJS((exports2, module2) => { + var SemVer = require_semver(); + var inc = (version, release, options, identifier) => { + if (typeof options === "string") { + identifier = options; + options = void 0; + } + try { + return new SemVer(version, options).inc(release, identifier).version; + } catch (er) { + return null; + } + }; + module2.exports = inc; +}); + +// node_modules/semver/functions/compare.js +var require_compare = __commonJS((exports2, module2) => { + var SemVer = require_semver(); + var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)); + module2.exports = compare; +}); + +// node_modules/semver/functions/eq.js +var require_eq = __commonJS((exports2, module2) => { + var compare = require_compare(); + var eq = (a, b, loose) => compare(a, b, loose) === 0; + module2.exports = eq; +}); + +// node_modules/semver/functions/diff.js +var require_diff = __commonJS((exports2, module2) => { + var parse = require_parse2(); + var eq = require_eq(); + var diff = (version1, version2) => { + if (eq(version1, version2)) { + return null; + } else { + const v1 = parse(version1); + const v2 = parse(version2); + const hasPre = v1.prerelease.length || v2.prerelease.length; + const prefix = hasPre ? "pre" : ""; + const defaultResult = hasPre ? "prerelease" : ""; + for (const key in v1) { + if (key === "major" || key === "minor" || key === "patch") { + if (v1[key] !== v2[key]) { + return prefix + key; + } + } + } + return defaultResult; + } + }; + module2.exports = diff; +}); + +// node_modules/semver/functions/major.js +var require_major = __commonJS((exports2, module2) => { + var SemVer = require_semver(); + var major = (a, loose) => new SemVer(a, loose).major; + module2.exports = major; +}); + +// node_modules/semver/functions/minor.js +var require_minor = __commonJS((exports2, module2) => { + var SemVer = require_semver(); + var minor = (a, loose) => new SemVer(a, loose).minor; + module2.exports = minor; +}); + +// node_modules/semver/functions/patch.js +var require_patch = __commonJS((exports2, module2) => { + var SemVer = require_semver(); + var patch = (a, loose) => new SemVer(a, loose).patch; + module2.exports = patch; +}); + +// node_modules/semver/functions/prerelease.js +var require_prerelease = __commonJS((exports2, module2) => { + var parse = require_parse2(); + var prerelease = (version, options) => { + const parsed = parse(version, options); + return parsed && parsed.prerelease.length ? parsed.prerelease : null; + }; + module2.exports = prerelease; +}); + +// node_modules/semver/functions/rcompare.js +var require_rcompare = __commonJS((exports2, module2) => { + var compare = require_compare(); + var rcompare = (a, b, loose) => compare(b, a, loose); + module2.exports = rcompare; +}); + +// node_modules/semver/functions/compare-loose.js +var require_compare_loose = __commonJS((exports2, module2) => { + var compare = require_compare(); + var compareLoose = (a, b) => compare(a, b, true); + module2.exports = compareLoose; +}); + +// node_modules/semver/functions/compare-build.js +var require_compare_build = __commonJS((exports2, module2) => { + var SemVer = require_semver(); + var compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose); + const versionB = new SemVer(b, loose); + return versionA.compare(versionB) || versionA.compareBuild(versionB); + }; + module2.exports = compareBuild; +}); + +// node_modules/semver/functions/sort.js +var require_sort = __commonJS((exports2, module2) => { + var compareBuild = require_compare_build(); + var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)); + module2.exports = sort; +}); + +// node_modules/semver/functions/rsort.js +var require_rsort = __commonJS((exports2, module2) => { + var compareBuild = require_compare_build(); + var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)); + module2.exports = rsort; +}); + +// node_modules/semver/functions/gt.js +var require_gt = __commonJS((exports2, module2) => { + var compare = require_compare(); + var gt = (a, b, loose) => compare(a, b, loose) > 0; + module2.exports = gt; +}); + +// node_modules/semver/functions/lt.js +var require_lt = __commonJS((exports2, module2) => { + var compare = require_compare(); + var lt = (a, b, loose) => compare(a, b, loose) < 0; + module2.exports = lt; +}); + +// node_modules/semver/functions/neq.js +var require_neq = __commonJS((exports2, module2) => { + var compare = require_compare(); + var neq = (a, b, loose) => compare(a, b, loose) !== 0; + module2.exports = neq; +}); + +// node_modules/semver/functions/gte.js +var require_gte = __commonJS((exports2, module2) => { + var compare = require_compare(); + var gte = (a, b, loose) => compare(a, b, loose) >= 0; + module2.exports = gte; +}); + +// node_modules/semver/functions/lte.js +var require_lte = __commonJS((exports2, module2) => { + var compare = require_compare(); + var lte = (a, b, loose) => compare(a, b, loose) <= 0; + module2.exports = lte; +}); + +// node_modules/semver/functions/cmp.js +var require_cmp = __commonJS((exports2, module2) => { + var eq = require_eq(); + var neq = require_neq(); + var gt = require_gt(); + var gte = require_gte(); + var lt = require_lt(); + var lte = require_lte(); + var cmp = (a, op, b, loose) => { + switch (op) { + case "===": + if (typeof a === "object") + a = a.version; + if (typeof b === "object") + b = b.version; + return a === b; + case "!==": + if (typeof a === "object") + a = a.version; + if (typeof b === "object") + b = b.version; + return a !== b; + case "": + case "=": + case "==": + return eq(a, b, loose); + case "!=": + return neq(a, b, loose); + case ">": + return gt(a, b, loose); + case ">=": + return gte(a, b, loose); + case "<": + return lt(a, b, loose); + case "<=": + return lte(a, b, loose); + default: + throw new TypeError(`Invalid operator: ${op}`); + } + }; + module2.exports = cmp; +}); + +// node_modules/semver/functions/coerce.js +var require_coerce = __commonJS((exports2, module2) => { + var SemVer = require_semver(); + var parse = require_parse2(); + var {re, t} = require_re(); + var coerce = (version, options) => { + if (version instanceof SemVer) { + return version; + } + if (typeof version === "number") { + version = String(version); + } + if (typeof version !== "string") { + return null; + } + options = options || {}; + let match = null; + if (!options.rtl) { + match = version.match(re[t.COERCE]); + } else { + let next; + while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) { + if (!match || next.index + next[0].length !== match.index + match[0].length) { + match = next; + } + re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length; + } + re[t.COERCERTL].lastIndex = -1; + } + if (match === null) + return null; + return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options); + }; + module2.exports = coerce; +}); + +// node_modules/yallist/iterator.js +var require_iterator = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Yallist) { + Yallist.prototype[Symbol.iterator] = function* () { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value; + } + }; + }; +}); + +// node_modules/yallist/yallist.js +var require_yallist = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = Yallist; + Yallist.Node = Node; + Yallist.create = Yallist; + function Yallist(list) { + var self2 = this; + if (!(self2 instanceof Yallist)) { + self2 = new Yallist(); + } + self2.tail = null; + self2.head = null; + self2.length = 0; + if (list && typeof list.forEach === "function") { + list.forEach(function(item) { + self2.push(item); + }); + } else if (arguments.length > 0) { + for (var i = 0, l = arguments.length; i < l; i++) { + self2.push(arguments[i]); + } + } + return self2; + } + Yallist.prototype.removeNode = function(node) { + if (node.list !== this) { + throw new Error("removing node which does not belong to this list"); + } + var next = node.next; + var prev = node.prev; + if (next) { + next.prev = prev; + } + if (prev) { + prev.next = next; + } + if (node === this.head) { + this.head = next; + } + if (node === this.tail) { + this.tail = prev; + } + node.list.length--; + node.next = null; + node.prev = null; + node.list = null; + return next; + }; + Yallist.prototype.unshiftNode = function(node) { + if (node === this.head) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + var head = this.head; + node.list = this; + node.next = head; + if (head) { + head.prev = node; + } + this.head = node; + if (!this.tail) { + this.tail = node; + } + this.length++; + }; + Yallist.prototype.pushNode = function(node) { + if (node === this.tail) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + var tail = this.tail; + node.list = this; + node.prev = tail; + if (tail) { + tail.next = node; + } + this.tail = node; + if (!this.head) { + this.head = node; + } + this.length++; + }; + Yallist.prototype.push = function() { + for (var i = 0, l = arguments.length; i < l; i++) { + push(this, arguments[i]); + } + return this.length; + }; + Yallist.prototype.unshift = function() { + for (var i = 0, l = arguments.length; i < l; i++) { + unshift(this, arguments[i]); + } + return this.length; + }; + Yallist.prototype.pop = function() { + if (!this.tail) { + return void 0; + } + var res = this.tail.value; + this.tail = this.tail.prev; + if (this.tail) { + this.tail.next = null; + } else { + this.head = null; + } + this.length--; + return res; + }; + Yallist.prototype.shift = function() { + if (!this.head) { + return void 0; + } + var res = this.head.value; + this.head = this.head.next; + if (this.head) { + this.head.prev = null; + } else { + this.tail = null; + } + this.length--; + return res; + }; + Yallist.prototype.forEach = function(fn, thisp) { + thisp = thisp || this; + for (var walker = this.head, i = 0; walker !== null; i++) { + fn.call(thisp, walker.value, i, this); + walker = walker.next; + } + }; + Yallist.prototype.forEachReverse = function(fn, thisp) { + thisp = thisp || this; + for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { + fn.call(thisp, walker.value, i, this); + walker = walker.prev; + } + }; + Yallist.prototype.get = function(n) { + for (var i = 0, walker = this.head; walker !== null && i < n; i++) { + walker = walker.next; + } + if (i === n && walker !== null) { + return walker.value; + } + }; + Yallist.prototype.getReverse = function(n) { + for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { + walker = walker.prev; + } + if (i === n && walker !== null) { + return walker.value; + } + }; + Yallist.prototype.map = function(fn, thisp) { + thisp = thisp || this; + var res = new Yallist(); + for (var walker = this.head; walker !== null; ) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.next; + } + return res; + }; + Yallist.prototype.mapReverse = function(fn, thisp) { + thisp = thisp || this; + var res = new Yallist(); + for (var walker = this.tail; walker !== null; ) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.prev; + } + return res; + }; + Yallist.prototype.reduce = function(fn, initial) { + var acc; + var walker = this.head; + if (arguments.length > 1) { + acc = initial; + } else if (this.head) { + walker = this.head.next; + acc = this.head.value; + } else { + throw new TypeError("Reduce of empty list with no initial value"); + } + for (var i = 0; walker !== null; i++) { + acc = fn(acc, walker.value, i); + walker = walker.next; + } + return acc; + }; + Yallist.prototype.reduceReverse = function(fn, initial) { + var acc; + var walker = this.tail; + if (arguments.length > 1) { + acc = initial; + } else if (this.tail) { + walker = this.tail.prev; + acc = this.tail.value; + } else { + throw new TypeError("Reduce of empty list with no initial value"); + } + for (var i = this.length - 1; walker !== null; i--) { + acc = fn(acc, walker.value, i); + walker = walker.prev; + } + return acc; + }; + Yallist.prototype.toArray = function() { + var arr = new Array(this.length); + for (var i = 0, walker = this.head; walker !== null; i++) { + arr[i] = walker.value; + walker = walker.next; + } + return arr; + }; + Yallist.prototype.toArrayReverse = function() { + var arr = new Array(this.length); + for (var i = 0, walker = this.tail; walker !== null; i++) { + arr[i] = walker.value; + walker = walker.prev; + } + return arr; + }; + Yallist.prototype.slice = function(from, to) { + to = to || this.length; + if (to < 0) { + to += this.length; + } + from = from || 0; + if (from < 0) { + from += this.length; + } + var ret2 = new Yallist(); + if (to < from || to < 0) { + return ret2; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + for (var i = 0, walker = this.head; walker !== null && i < from; i++) { + walker = walker.next; + } + for (; walker !== null && i < to; i++, walker = walker.next) { + ret2.push(walker.value); + } + return ret2; + }; + Yallist.prototype.sliceReverse = function(from, to) { + to = to || this.length; + if (to < 0) { + to += this.length; + } + from = from || 0; + if (from < 0) { + from += this.length; + } + var ret2 = new Yallist(); + if (to < from || to < 0) { + return ret2; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { + walker = walker.prev; + } + for (; walker !== null && i > from; i--, walker = walker.prev) { + ret2.push(walker.value); + } + return ret2; + }; + Yallist.prototype.splice = function(start, deleteCount, ...nodes) { + if (start > this.length) { + start = this.length - 1; + } + if (start < 0) { + start = this.length + start; + } + for (var i = 0, walker = this.head; walker !== null && i < start; i++) { + walker = walker.next; + } + var ret2 = []; + for (var i = 0; walker && i < deleteCount; i++) { + ret2.push(walker.value); + walker = this.removeNode(walker); + } + if (walker === null) { + walker = this.tail; + } + if (walker !== this.head && walker !== this.tail) { + walker = walker.prev; + } + for (var i = 0; i < nodes.length; i++) { + walker = insert(this, walker, nodes[i]); + } + return ret2; + }; + Yallist.prototype.reverse = function() { + var head = this.head; + var tail = this.tail; + for (var walker = head; walker !== null; walker = walker.prev) { + var p = walker.prev; + walker.prev = walker.next; + walker.next = p; + } + this.head = tail; + this.tail = head; + return this; + }; + function insert(self2, node, value) { + var inserted = node === self2.head ? new Node(value, null, node, self2) : new Node(value, node, node.next, self2); + if (inserted.next === null) { + self2.tail = inserted; + } + if (inserted.prev === null) { + self2.head = inserted; + } + self2.length++; + return inserted; + } + function push(self2, item) { + self2.tail = new Node(item, self2.tail, null, self2); + if (!self2.head) { + self2.head = self2.tail; + } + self2.length++; + } + function unshift(self2, item) { + self2.head = new Node(item, null, self2.head, self2); + if (!self2.tail) { + self2.tail = self2.head; + } + self2.length++; + } + function Node(value, prev, next, list) { + if (!(this instanceof Node)) { + return new Node(value, prev, next, list); + } + this.list = list; + this.value = value; + if (prev) { + prev.next = this; + this.prev = prev; + } else { + this.prev = null; + } + if (next) { + next.prev = this; + this.next = next; + } else { + this.next = null; + } + } + try { + require_iterator()(Yallist); + } catch (er) { + } +}); + +// node_modules/lru-cache/index.js +var require_lru_cache = __commonJS((exports2, module2) => { + "use strict"; + var Yallist = require_yallist(); + var MAX = Symbol("max"); + var LENGTH = Symbol("length"); + var LENGTH_CALCULATOR = Symbol("lengthCalculator"); + var ALLOW_STALE = Symbol("allowStale"); + var MAX_AGE = Symbol("maxAge"); + var DISPOSE = Symbol("dispose"); + var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet"); + var LRU_LIST = Symbol("lruList"); + var CACHE = Symbol("cache"); + var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet"); + var naiveLength = () => 1; + var LRUCache = class { + constructor(options) { + if (typeof options === "number") + options = {max: options}; + if (!options) + options = {}; + if (options.max && (typeof options.max !== "number" || options.max < 0)) + throw new TypeError("max must be a non-negative number"); + const max = this[MAX] = options.max || Infinity; + const lc = options.length || naiveLength; + this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc; + this[ALLOW_STALE] = options.stale || false; + if (options.maxAge && typeof options.maxAge !== "number") + throw new TypeError("maxAge must be a number"); + this[MAX_AGE] = options.maxAge || 0; + this[DISPOSE] = options.dispose; + this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false; + this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false; + this.reset(); + } + set max(mL) { + if (typeof mL !== "number" || mL < 0) + throw new TypeError("max must be a non-negative number"); + this[MAX] = mL || Infinity; + trim(this); + } + get max() { + return this[MAX]; + } + set allowStale(allowStale) { + this[ALLOW_STALE] = !!allowStale; + } + get allowStale() { + return this[ALLOW_STALE]; + } + set maxAge(mA) { + if (typeof mA !== "number") + throw new TypeError("maxAge must be a non-negative number"); + this[MAX_AGE] = mA; + trim(this); + } + get maxAge() { + return this[MAX_AGE]; + } + set lengthCalculator(lC) { + if (typeof lC !== "function") + lC = naiveLength; + if (lC !== this[LENGTH_CALCULATOR]) { + this[LENGTH_CALCULATOR] = lC; + this[LENGTH] = 0; + this[LRU_LIST].forEach((hit) => { + hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key); + this[LENGTH] += hit.length; + }); + } + trim(this); + } + get lengthCalculator() { + return this[LENGTH_CALCULATOR]; + } + get length() { + return this[LENGTH]; + } + get itemCount() { + return this[LRU_LIST].length; + } + rforEach(fn, thisp) { + thisp = thisp || this; + for (let walker = this[LRU_LIST].tail; walker !== null; ) { + const prev = walker.prev; + forEachStep(this, fn, walker, thisp); + walker = prev; + } + } + forEach(fn, thisp) { + thisp = thisp || this; + for (let walker = this[LRU_LIST].head; walker !== null; ) { + const next = walker.next; + forEachStep(this, fn, walker, thisp); + walker = next; + } + } + keys() { + return this[LRU_LIST].toArray().map((k) => k.key); + } + values() { + return this[LRU_LIST].toArray().map((k) => k.value); + } + reset() { + if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) { + this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value)); + } + this[CACHE] = new Map(); + this[LRU_LIST] = new Yallist(); + this[LENGTH] = 0; + } + dump() { + return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : { + k: hit.key, + v: hit.value, + e: hit.now + (hit.maxAge || 0) + }).toArray().filter((h) => h); + } + dumpLru() { + return this[LRU_LIST]; + } + set(key, value, maxAge) { + maxAge = maxAge || this[MAX_AGE]; + if (maxAge && typeof maxAge !== "number") + throw new TypeError("maxAge must be a number"); + const now = maxAge ? Date.now() : 0; + const len = this[LENGTH_CALCULATOR](value, key); + if (this[CACHE].has(key)) { + if (len > this[MAX]) { + del(this, this[CACHE].get(key)); + return false; + } + const node = this[CACHE].get(key); + const item = node.value; + if (this[DISPOSE]) { + if (!this[NO_DISPOSE_ON_SET]) + this[DISPOSE](key, item.value); + } + item.now = now; + item.maxAge = maxAge; + item.value = value; + this[LENGTH] += len - item.length; + item.length = len; + this.get(key); + trim(this); + return true; + } + const hit = new Entry(key, value, len, now, maxAge); + if (hit.length > this[MAX]) { + if (this[DISPOSE]) + this[DISPOSE](key, value); + return false; + } + this[LENGTH] += hit.length; + this[LRU_LIST].unshift(hit); + this[CACHE].set(key, this[LRU_LIST].head); + trim(this); + return true; + } + has(key) { + if (!this[CACHE].has(key)) + return false; + const hit = this[CACHE].get(key).value; + return !isStale(this, hit); + } + get(key) { + return get(this, key, true); + } + peek(key) { + return get(this, key, false); + } + pop() { + const node = this[LRU_LIST].tail; + if (!node) + return null; + del(this, node); + return node.value; + } + del(key) { + del(this, this[CACHE].get(key)); + } + load(arr) { + this.reset(); + const now = Date.now(); + for (let l = arr.length - 1; l >= 0; l--) { + const hit = arr[l]; + const expiresAt = hit.e || 0; + if (expiresAt === 0) + this.set(hit.k, hit.v); + else { + const maxAge = expiresAt - now; + if (maxAge > 0) { + this.set(hit.k, hit.v, maxAge); + } + } + } + } + prune() { + this[CACHE].forEach((value, key) => get(this, key, false)); + } + }; + var get = (self2, key, doUse) => { + const node = self2[CACHE].get(key); + if (node) { + const hit = node.value; + if (isStale(self2, hit)) { + del(self2, node); + if (!self2[ALLOW_STALE]) + return void 0; + } else { + if (doUse) { + if (self2[UPDATE_AGE_ON_GET]) + node.value.now = Date.now(); + self2[LRU_LIST].unshiftNode(node); + } + } + return hit.value; + } + }; + var isStale = (self2, hit) => { + if (!hit || !hit.maxAge && !self2[MAX_AGE]) + return false; + const diff = Date.now() - hit.now; + return hit.maxAge ? diff > hit.maxAge : self2[MAX_AGE] && diff > self2[MAX_AGE]; + }; + var trim = (self2) => { + if (self2[LENGTH] > self2[MAX]) { + for (let walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) { + const prev = walker.prev; + del(self2, walker); + walker = prev; + } + } + }; + var del = (self2, node) => { + if (node) { + const hit = node.value; + if (self2[DISPOSE]) + self2[DISPOSE](hit.key, hit.value); + self2[LENGTH] -= hit.length; + self2[CACHE].delete(hit.key); + self2[LRU_LIST].removeNode(node); + } + }; + var Entry = class { + constructor(key, value, length, now, maxAge) { + this.key = key; + this.value = value; + this.length = length; + this.now = now; + this.maxAge = maxAge || 0; + } + }; + var forEachStep = (self2, fn, node, thisp) => { + let hit = node.value; + if (isStale(self2, hit)) { + del(self2, node); + if (!self2[ALLOW_STALE]) + hit = void 0; + } + if (hit) + fn.call(thisp, hit.value, hit.key, self2); + }; + module2.exports = LRUCache; +}); + +// node_modules/semver/classes/range.js +var require_range = __commonJS((exports2, module2) => { + var Range3 = class { + constructor(range, options) { + options = parseOptions(options); + if (range instanceof Range3) { + if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { + return range; + } else { + return new Range3(range.raw, options); + } + } + if (range instanceof Comparator) { + this.raw = range.value; + this.set = [[range]]; + this.format(); + return this; + } + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + this.raw = range; + this.set = range.split(/\s*\|\|\s*/).map((range2) => this.parseRange(range2.trim())).filter((c) => c.length); + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${range}`); + } + if (this.set.length > 1) { + const first = this.set[0]; + this.set = this.set.filter((c) => !isNullSet(c[0])); + if (this.set.length === 0) + this.set = [first]; + else if (this.set.length > 1) { + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c]; + break; + } + } + } + } + this.format(); + } + format() { + this.range = this.set.map((comps) => { + return comps.join(" ").trim(); + }).join("||").trim(); + return this.range; + } + toString() { + return this.range; + } + parseRange(range) { + range = range.trim(); + const memoOpts = Object.keys(this.options).join(","); + const memoKey = `parseRange:${memoOpts}:${range}`; + const cached = cache.get(memoKey); + if (cached) + return cached; + const loose = this.options.loose; + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]; + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)); + debug("hyphen replace", range); + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace); + debug("comparator trim", range, re[t.COMPARATORTRIM]); + range = range.replace(re[t.TILDETRIM], tildeTrimReplace); + range = range.replace(re[t.CARETTRIM], caretTrimReplace); + range = range.split(/\s+/).join(" "); + const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; + const rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)).filter(this.options.loose ? (comp) => !!comp.match(compRe) : () => true).map((comp) => new Comparator(comp, this.options)); + const l = rangeList.length; + const rangeMap = new Map(); + for (const comp of rangeList) { + if (isNullSet(comp)) + return [comp]; + rangeMap.set(comp.value, comp); + } + if (rangeMap.size > 1 && rangeMap.has("")) + rangeMap.delete(""); + const result = [...rangeMap.values()]; + cache.set(memoKey, result); + return result; + } + intersects(range, options) { + if (!(range instanceof Range3)) { + throw new TypeError("a Range is required"); + } + return this.set.some((thisComparators) => { + return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => { + return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options); + }); + }); + }); + }); + } + test(version) { + if (!version) { + return false; + } + if (typeof version === "string") { + try { + version = new SemVer(version, this.options); + } catch (er) { + return false; + } + } + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true; + } + } + return false; + } + }; + module2.exports = Range3; + var LRU = require_lru_cache(); + var cache = new LRU({max: 1e3}); + var parseOptions = require_parse_options(); + var Comparator = require_comparator(); + var debug = require_debug(); + var SemVer = require_semver(); + var { + re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace + } = require_re(); + var isNullSet = (c) => c.value === "<0.0.0-0"; + var isAny = (c) => c.value === ""; + var isSatisfiable = (comparators, options) => { + let result = true; + const remainingComparators = comparators.slice(); + let testComparator = remainingComparators.pop(); + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options); + }); + testComparator = remainingComparators.pop(); + } + return result; + }; + var parseComparator = (comp, options) => { + debug("comp", comp, options); + comp = replaceCarets(comp, options); + debug("caret", comp); + comp = replaceTildes(comp, options); + debug("tildes", comp); + comp = replaceXRanges(comp, options); + debug("xrange", comp); + comp = replaceStars(comp, options); + debug("stars", comp); + return comp; + }; + var isX = (id) => !id || id.toLowerCase() === "x" || id === "*"; + var replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((comp2) => { + return replaceTilde(comp2, options); + }).join(" "); + var replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]; + return comp.replace(r, (_, M, m, p, pr) => { + debug("tilde", comp, _, M, m, p, pr); + let ret2; + if (isX(M)) { + ret2 = ""; + } else if (isX(m)) { + ret2 = `>=${M}.0.0 <${+M + 1}.0.0-0`; + } else if (isX(p)) { + ret2 = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`; + } else if (pr) { + debug("replaceTilde pr", pr); + ret2 = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; + } else { + ret2 = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`; + } + debug("tilde return", ret2); + return ret2; + }); + }; + var replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((comp2) => { + return replaceCaret(comp2, options); + }).join(" "); + var replaceCaret = (comp, options) => { + debug("caret", comp, options); + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]; + const z = options.includePrerelease ? "-0" : ""; + return comp.replace(r, (_, M, m, p, pr) => { + debug("caret", comp, _, M, m, p, pr); + let ret2; + if (isX(M)) { + ret2 = ""; + } else if (isX(m)) { + ret2 = `>=${M}.0.0${z} <${+M + 1}.0.0-0`; + } else if (isX(p)) { + if (M === "0") { + ret2 = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`; + } else { + ret2 = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`; + } + } else if (pr) { + debug("replaceCaret pr", pr); + if (M === "0") { + if (m === "0") { + ret2 = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`; + } else { + ret2 = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; + } + } else { + ret2 = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`; + } + } else { + debug("no pr"); + if (M === "0") { + if (m === "0") { + ret2 = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`; + } else { + ret2 = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`; + } + } else { + ret2 = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`; + } + } + debug("caret return", ret2); + return ret2; + }); + }; + var replaceXRanges = (comp, options) => { + debug("replaceXRanges", comp, options); + return comp.split(/\s+/).map((comp2) => { + return replaceXRange(comp2, options); + }).join(" "); + }; + var replaceXRange = (comp, options) => { + comp = comp.trim(); + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]; + return comp.replace(r, (ret2, gtlt, M, m, p, pr) => { + debug("xRange", comp, ret2, gtlt, M, m, p, pr); + const xM = isX(M); + const xm = xM || isX(m); + const xp = xm || isX(p); + const anyX = xp; + if (gtlt === "=" && anyX) { + gtlt = ""; + } + pr = options.includePrerelease ? "-0" : ""; + if (xM) { + if (gtlt === ">" || gtlt === "<") { + ret2 = "<0.0.0-0"; + } else { + ret2 = "*"; + } + } else if (gtlt && anyX) { + if (xm) { + m = 0; + } + p = 0; + if (gtlt === ">") { + gtlt = ">="; + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else { + m = +m + 1; + p = 0; + } + } else if (gtlt === "<=") { + gtlt = "<"; + if (xm) { + M = +M + 1; + } else { + m = +m + 1; + } + } + if (gtlt === "<") + pr = "-0"; + ret2 = `${gtlt + M}.${m}.${p}${pr}`; + } else if (xm) { + ret2 = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`; + } else if (xp) { + ret2 = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`; + } + debug("xRange return", ret2); + return ret2; + }); + }; + var replaceStars = (comp, options) => { + debug("replaceStars", comp, options); + return comp.trim().replace(re[t.STAR], ""); + }; + var replaceGTE0 = (comp, options) => { + debug("replaceGTE0", comp, options); + return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], ""); + }; + var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => { + if (isX(fM)) { + from = ""; + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? "-0" : ""}`; + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`; + } else if (fpr) { + from = `>=${from}`; + } else { + from = `>=${from}${incPr ? "-0" : ""}`; + } + if (isX(tM)) { + to = ""; + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0`; + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0`; + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}`; + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0`; + } else { + to = `<=${to}`; + } + return `${from} ${to}`.trim(); + }; + var testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false; + } + } + if (version.prerelease.length && !options.includePrerelease) { + for (let i = 0; i < set.length; i++) { + debug(set[i].semver); + if (set[i].semver === Comparator.ANY) { + continue; + } + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver; + if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { + return true; + } + } + } + return false; + } + return true; + }; +}); + +// node_modules/semver/classes/comparator.js +var require_comparator = __commonJS((exports2, module2) => { + var ANY = Symbol("SemVer ANY"); + var Comparator = class { + static get ANY() { + return ANY; + } + constructor(comp, options) { + options = parseOptions(options); + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp; + } else { + comp = comp.value; + } + } + debug("comparator", comp, options); + this.options = options; + this.loose = !!options.loose; + this.parse(comp); + if (this.semver === ANY) { + this.value = ""; + } else { + this.value = this.operator + this.semver.version; + } + debug("comp", this); + } + parse(comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; + const m = comp.match(r); + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`); + } + this.operator = m[1] !== void 0 ? m[1] : ""; + if (this.operator === "=") { + this.operator = ""; + } + if (!m[2]) { + this.semver = ANY; + } else { + this.semver = new SemVer(m[2], this.options.loose); + } + } + toString() { + return this.value; + } + test(version) { + debug("Comparator.test", version, this.options.loose); + if (this.semver === ANY || version === ANY) { + return true; + } + if (typeof version === "string") { + try { + version = new SemVer(version, this.options); + } catch (er) { + return false; + } + } + return cmp(version, this.operator, this.semver, this.options); + } + intersects(comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError("a Comparator is required"); + } + if (!options || typeof options !== "object") { + options = { + loose: !!options, + includePrerelease: false + }; + } + if (this.operator === "") { + if (this.value === "") { + return true; + } + return new Range3(comp.value, options).test(this.value); + } else if (comp.operator === "") { + if (comp.value === "") { + return true; + } + return new Range3(this.value, options).test(comp.semver); + } + const sameDirectionIncreasing = (this.operator === ">=" || this.operator === ">") && (comp.operator === ">=" || comp.operator === ">"); + const sameDirectionDecreasing = (this.operator === "<=" || this.operator === "<") && (comp.operator === "<=" || comp.operator === "<"); + const sameSemVer = this.semver.version === comp.semver.version; + const differentDirectionsInclusive = (this.operator === ">=" || this.operator === "<=") && (comp.operator === ">=" || comp.operator === "<="); + const oppositeDirectionsLessThan = cmp(this.semver, "<", comp.semver, options) && (this.operator === ">=" || this.operator === ">") && (comp.operator === "<=" || comp.operator === "<"); + const oppositeDirectionsGreaterThan = cmp(this.semver, ">", comp.semver, options) && (this.operator === "<=" || this.operator === "<") && (comp.operator === ">=" || comp.operator === ">"); + return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; + } + }; + module2.exports = Comparator; + var parseOptions = require_parse_options(); + var {re, t} = require_re(); + var cmp = require_cmp(); + var debug = require_debug(); + var SemVer = require_semver(); + var Range3 = require_range(); +}); + +// node_modules/semver/functions/satisfies.js +var require_satisfies = __commonJS((exports2, module2) => { + var Range3 = require_range(); + var satisfies = (version, range, options) => { + try { + range = new Range3(range, options); + } catch (er) { + return false; + } + return range.test(version); + }; + module2.exports = satisfies; +}); + +// node_modules/semver/ranges/to-comparators.js +var require_to_comparators = __commonJS((exports2, module2) => { + var Range3 = require_range(); + var toComparators = (range, options) => new Range3(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" ")); + module2.exports = toComparators; +}); + +// node_modules/semver/ranges/max-satisfying.js +var require_max_satisfying = __commonJS((exports2, module2) => { + var SemVer = require_semver(); + var Range3 = require_range(); + var maxSatisfying = (versions, range, options) => { + let max = null; + let maxSV = null; + let rangeObj = null; + try { + rangeObj = new Range3(range, options); + } catch (er) { + return null; + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + if (!max || maxSV.compare(v) === -1) { + max = v; + maxSV = new SemVer(max, options); + } + } + }); + return max; + }; + module2.exports = maxSatisfying; +}); + +// node_modules/semver/ranges/min-satisfying.js +var require_min_satisfying = __commonJS((exports2, module2) => { + var SemVer = require_semver(); + var Range3 = require_range(); + var minSatisfying = (versions, range, options) => { + let min = null; + let minSV = null; + let rangeObj = null; + try { + rangeObj = new Range3(range, options); + } catch (er) { + return null; + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + if (!min || minSV.compare(v) === 1) { + min = v; + minSV = new SemVer(min, options); + } + } + }); + return min; + }; + module2.exports = minSatisfying; +}); + +// node_modules/semver/ranges/min-version.js +var require_min_version = __commonJS((exports2, module2) => { + var SemVer = require_semver(); + var Range3 = require_range(); + var gt = require_gt(); + var minVersion = (range, loose) => { + range = new Range3(range, loose); + let minver = new SemVer("0.0.0"); + if (range.test(minver)) { + return minver; + } + minver = new SemVer("0.0.0-0"); + if (range.test(minver)) { + return minver; + } + minver = null; + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i]; + let setMin = null; + comparators.forEach((comparator) => { + const compver = new SemVer(comparator.semver.version); + switch (comparator.operator) { + case ">": + if (compver.prerelease.length === 0) { + compver.patch++; + } else { + compver.prerelease.push(0); + } + compver.raw = compver.format(); + case "": + case ">=": + if (!setMin || gt(compver, setMin)) { + setMin = compver; + } + break; + case "<": + case "<=": + break; + default: + throw new Error(`Unexpected operation: ${comparator.operator}`); + } + }); + if (setMin && (!minver || gt(minver, setMin))) + minver = setMin; + } + if (minver && range.test(minver)) { + return minver; + } + return null; + }; + module2.exports = minVersion; +}); + +// node_modules/semver/ranges/valid.js +var require_valid2 = __commonJS((exports2, module2) => { + var Range3 = require_range(); + var validRange = (range, options) => { + try { + return new Range3(range, options).range || "*"; + } catch (er) { + return null; + } + }; + module2.exports = validRange; +}); + +// node_modules/semver/ranges/outside.js +var require_outside = __commonJS((exports2, module2) => { + var SemVer = require_semver(); + var Comparator = require_comparator(); + var {ANY} = Comparator; + var Range3 = require_range(); + var satisfies = require_satisfies(); + var gt = require_gt(); + var lt = require_lt(); + var lte = require_lte(); + var gte = require_gte(); + var outside = (version, range, hilo, options) => { + version = new SemVer(version, options); + range = new Range3(range, options); + let gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case ">": + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = ">"; + ecomp = ">="; + break; + case "<": + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = "<"; + ecomp = "<="; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + if (satisfies(version, range, options)) { + return false; + } + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i]; + let high = null; + let low = null; + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator(">=0.0.0"); + } + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator; + } + }); + if (high.operator === comp || high.operator === ecomp) { + return false; + } + if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } + return true; + }; + module2.exports = outside; +}); + +// node_modules/semver/ranges/gtr.js +var require_gtr = __commonJS((exports2, module2) => { + var outside = require_outside(); + var gtr = (version, range, options) => outside(version, range, ">", options); + module2.exports = gtr; +}); + +// node_modules/semver/ranges/ltr.js +var require_ltr = __commonJS((exports2, module2) => { + var outside = require_outside(); + var ltr = (version, range, options) => outside(version, range, "<", options); + module2.exports = ltr; +}); + +// node_modules/semver/ranges/intersects.js +var require_intersects = __commonJS((exports2, module2) => { + var Range3 = require_range(); + var intersects = (r1, r2, options) => { + r1 = new Range3(r1, options); + r2 = new Range3(r2, options); + return r1.intersects(r2); + }; + module2.exports = intersects; +}); + +// node_modules/semver/ranges/simplify.js +var require_simplify = __commonJS((exports2, module2) => { + var satisfies = require_satisfies(); + var compare = require_compare(); + module2.exports = (versions, range, options) => { + const set = []; + let min = null; + let prev = null; + const v = versions.sort((a, b) => compare(a, b, options)); + for (const version of v) { + const included = satisfies(version, range, options); + if (included) { + prev = version; + if (!min) + min = version; + } else { + if (prev) { + set.push([min, prev]); + } + prev = null; + min = null; + } + } + if (min) + set.push([min, null]); + const ranges = []; + for (const [min2, max] of set) { + if (min2 === max) + ranges.push(min2); + else if (!max && min2 === v[0]) + ranges.push("*"); + else if (!max) + ranges.push(`>=${min2}`); + else if (min2 === v[0]) + ranges.push(`<=${max}`); + else + ranges.push(`${min2} - ${max}`); + } + const simplified = ranges.join(" || "); + const original = typeof range.raw === "string" ? range.raw : String(range); + return simplified.length < original.length ? simplified : range; + }; +}); + +// node_modules/semver/ranges/subset.js +var require_subset = __commonJS((exports2, module2) => { + var Range3 = require_range(); + var {ANY} = require_comparator(); + var satisfies = require_satisfies(); + var compare = require_compare(); + var subset = (sub, dom, options) => { + if (sub === dom) + return true; + sub = new Range3(sub, options); + dom = new Range3(dom, options); + let sawNonNull = false; + OUTER: + for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options); + sawNonNull = sawNonNull || isSub !== null; + if (isSub) + continue OUTER; + } + if (sawNonNull) + return false; + } + return true; + }; + var simpleSubset = (sub, dom, options) => { + if (sub === dom) + return true; + if (sub.length === 1 && sub[0].semver === ANY) + return dom.length === 1 && dom[0].semver === ANY; + const eqSet = new Set(); + let gt, lt; + for (const c of sub) { + if (c.operator === ">" || c.operator === ">=") + gt = higherGT(gt, c, options); + else if (c.operator === "<" || c.operator === "<=") + lt = lowerLT(lt, c, options); + else + eqSet.add(c.semver); + } + if (eqSet.size > 1) + return null; + let gtltComp; + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options); + if (gtltComp > 0) + return null; + else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) + return null; + } + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) + return null; + if (lt && !satisfies(eq, String(lt), options)) + return null; + for (const c of dom) { + if (!satisfies(eq, String(c), options)) + return false; + } + return true; + } + let higher, lower; + let hasDomLT, hasDomGT; + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">="; + hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<="; + if (gt) { + if (c.operator === ">" || c.operator === ">=") { + higher = higherGT(gt, c, options); + if (higher === c && higher !== gt) + return false; + } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) + return false; + } + if (lt) { + if (c.operator === "<" || c.operator === "<=") { + lower = lowerLT(lt, c, options); + if (lower === c && lower !== lt) + return false; + } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) + return false; + } + if (!c.operator && (lt || gt) && gtltComp !== 0) + return false; + } + if (gt && hasDomLT && !lt && gtltComp !== 0) + return false; + if (lt && hasDomGT && !gt && gtltComp !== 0) + return false; + return true; + }; + var higherGT = (a, b, options) => { + if (!a) + return b; + const comp = compare(a.semver, b.semver, options); + return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a; + }; + var lowerLT = (a, b, options) => { + if (!a) + return b; + const comp = compare(a.semver, b.semver, options); + return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a; + }; + module2.exports = subset; +}); + +// node_modules/semver/index.js +var require_semver2 = __commonJS((exports2, module2) => { + var internalRe = require_re(); + module2.exports = { + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: require_constants2().SEMVER_SPEC_VERSION, + SemVer: require_semver(), + compareIdentifiers: require_identifiers().compareIdentifiers, + rcompareIdentifiers: require_identifiers().rcompareIdentifiers, + parse: require_parse2(), + valid: require_valid(), + clean: require_clean(), + inc: require_inc(), + diff: require_diff(), + major: require_major(), + minor: require_minor(), + patch: require_patch(), + prerelease: require_prerelease(), + compare: require_compare(), + rcompare: require_rcompare(), + compareLoose: require_compare_loose(), + compareBuild: require_compare_build(), + sort: require_sort(), + rsort: require_rsort(), + gt: require_gt(), + lt: require_lt(), + eq: require_eq(), + neq: require_neq(), + gte: require_gte(), + lte: require_lte(), + cmp: require_cmp(), + coerce: require_coerce(), + Comparator: require_comparator(), + Range: require_range(), + satisfies: require_satisfies(), + toComparators: require_to_comparators(), + maxSatisfying: require_max_satisfying(), + minSatisfying: require_min_satisfying(), + minVersion: require_min_version(), + validRange: require_valid2(), + outside: require_outside(), + gtr: require_gtr(), + ltr: require_ltr(), + intersects: require_intersects(), + simplifyRange: require_simplify(), + subset: require_subset() + }; +}); + +// node_modules/listenercount/index.js +var require_listenercount = __commonJS((exports2, module2) => { + "use strict"; + var listenerCount = require("events").listenerCount; + listenerCount = listenerCount || function(ee, event) { + var listeners = ee && ee._events && ee._events[event]; + if (Array.isArray(listeners)) { + return listeners.length; + } else if (typeof listeners === "function") { + return 1; + } else { + return 0; + } + }; + module2.exports = listenerCount; +}); + +// node_modules/buffer-indexof-polyfill/index.js +var require_buffer_indexof_polyfill = __commonJS(() => { + "use strict"; + if (!Buffer.prototype.indexOf) { + Buffer.prototype.indexOf = function(value, offset) { + offset = offset || 0; + if (typeof value === "string" || value instanceof String) { + value = new Buffer(value); + } else if (typeof value === "number" || value instanceof Number) { + value = new Buffer([value]); + } + var len = value.length; + for (var i = offset; i <= this.length - len; i++) { + var mismatch = false; + for (var j = 0; j < len; j++) { + if (this[i + j] != value[j]) { + mismatch = true; + break; + } + } + if (!mismatch) { + return i; + } + } + return -1; + }; + } + function bufferLastIndexOf(value, offset) { + if (typeof value === "string" || value instanceof String) { + value = new Buffer(value); + } else if (typeof value === "number" || value instanceof Number) { + value = new Buffer([value]); + } + var len = value.length; + offset = offset || this.length - len; + for (var i = offset; i >= 0; i--) { + var mismatch = false; + for (var j = 0; j < len; j++) { + if (this[i + j] != value[j]) { + mismatch = true; + break; + } + } + if (!mismatch) { + return i; + } + } + return -1; + } + if (Buffer.prototype.lastIndexOf) { + if (new Buffer("ABC").lastIndexOf("ABC") === -1) + Buffer.prototype.lastIndexOf = bufferLastIndexOf; + } else { + Buffer.prototype.lastIndexOf = bufferLastIndexOf; + } +}); + +// node_modules/setimmediate/setImmediate.js +var require_setImmediate = __commonJS((exports2) => { + (function(global2, undefined2) { + "use strict"; + if (global2.setImmediate) { + return; + } + var nextHandle = 1; + var tasksByHandle = {}; + var currentlyRunningATask = false; + var doc = global2.document; + var registerImmediate; + function setImmediate2(callback) { + if (typeof callback !== "function") { + callback = new Function("" + callback); + } + var args = new Array(arguments.length - 1); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i + 1]; + } + var task = {callback, args}; + tasksByHandle[nextHandle] = task; + registerImmediate(nextHandle); + return nextHandle++; + } + function clearImmediate2(handle) { + delete tasksByHandle[handle]; + } + function run(task) { + var callback = task.callback; + var args = task.args; + switch (args.length) { + case 0: + callback(); + break; + case 1: + callback(args[0]); + break; + case 2: + callback(args[0], args[1]); + break; + case 3: + callback(args[0], args[1], args[2]); + break; + default: + callback.apply(undefined2, args); + break; + } + } + function runIfPresent(handle) { + if (currentlyRunningATask) { + setTimeout(runIfPresent, 0, handle); + } else { + var task = tasksByHandle[handle]; + if (task) { + currentlyRunningATask = true; + try { + run(task); + } finally { + clearImmediate2(handle); + currentlyRunningATask = false; + } + } + } + } + function installNextTickImplementation() { + registerImmediate = function(handle) { + process.nextTick(function() { + runIfPresent(handle); + }); + }; + } + function canUsePostMessage() { + if (global2.postMessage && !global2.importScripts) { + var postMessageIsAsynchronous = true; + var oldOnMessage = global2.onmessage; + global2.onmessage = function() { + postMessageIsAsynchronous = false; + }; + global2.postMessage("", "*"); + global2.onmessage = oldOnMessage; + return postMessageIsAsynchronous; + } + } + function installPostMessageImplementation() { + var messagePrefix = "setImmediate$" + Math.random() + "$"; + var onGlobalMessage = function(event) { + if (event.source === global2 && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) { + runIfPresent(+event.data.slice(messagePrefix.length)); + } + }; + if (global2.addEventListener) { + global2.addEventListener("message", onGlobalMessage, false); + } else { + global2.attachEvent("onmessage", onGlobalMessage); + } + registerImmediate = function(handle) { + global2.postMessage(messagePrefix + handle, "*"); + }; + } + function installMessageChannelImplementation() { + var channel = new MessageChannel(); + channel.port1.onmessage = function(event) { + var handle = event.data; + runIfPresent(handle); + }; + registerImmediate = function(handle) { + channel.port2.postMessage(handle); + }; + } + function installReadyStateChangeImplementation() { + var html = doc.documentElement; + registerImmediate = function(handle) { + var script = doc.createElement("script"); + script.onreadystatechange = function() { + runIfPresent(handle); + script.onreadystatechange = null; + html.removeChild(script); + script = null; + }; + html.appendChild(script); + }; + } + function installSetTimeoutImplementation() { + registerImmediate = function(handle) { + setTimeout(runIfPresent, 0, handle); + }; + } + var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global2); + attachTo = attachTo && attachTo.setTimeout ? attachTo : global2; + if ({}.toString.call(global2.process) === "[object process]") { + installNextTickImplementation(); + } else if (canUsePostMessage()) { + installPostMessageImplementation(); + } else if (global2.MessageChannel) { + installMessageChannelImplementation(); + } else if (doc && "onreadystatechange" in doc.createElement("script")) { + installReadyStateChangeImplementation(); + } else { + installSetTimeoutImplementation(); + } + attachTo.setImmediate = setImmediate2; + attachTo.clearImmediate = clearImmediate2; + })(typeof self === "undefined" ? typeof global === "undefined" ? exports2 : global : self); +}); + +// node_modules/traverse/index.js +var require_traverse = __commonJS((exports2, module2) => { + module2.exports = Traverse; + function Traverse(obj) { + if (!(this instanceof Traverse)) + return new Traverse(obj); + this.value = obj; + } + Traverse.prototype.get = function(ps) { + var node = this.value; + for (var i = 0; i < ps.length; i++) { + var key = ps[i]; + if (!Object.hasOwnProperty.call(node, key)) { + node = void 0; + break; + } + node = node[key]; + } + return node; + }; + Traverse.prototype.set = function(ps, value) { + var node = this.value; + for (var i = 0; i < ps.length - 1; i++) { + var key = ps[i]; + if (!Object.hasOwnProperty.call(node, key)) + node[key] = {}; + node = node[key]; + } + node[ps[i]] = value; + return value; + }; + Traverse.prototype.map = function(cb) { + return walk(this.value, cb, true); + }; + Traverse.prototype.forEach = function(cb) { + this.value = walk(this.value, cb, false); + return this.value; + }; + Traverse.prototype.reduce = function(cb, init) { + var skip = arguments.length === 1; + var acc = skip ? this.value : init; + this.forEach(function(x) { + if (!this.isRoot || !skip) { + acc = cb.call(this, acc, x); + } + }); + return acc; + }; + Traverse.prototype.deepEqual = function(obj) { + if (arguments.length !== 1) { + throw new Error("deepEqual requires exactly one object to compare against"); + } + var equal = true; + var node = obj; + this.forEach(function(y) { + var notEqual = function() { + equal = false; + return void 0; + }.bind(this); + if (!this.isRoot) { + if (typeof node !== "object") + return notEqual(); + node = node[this.key]; + } + var x = node; + this.post(function() { + node = x; + }); + var toS = function(o) { + return Object.prototype.toString.call(o); + }; + if (this.circular) { + if (Traverse(obj).get(this.circular.path) !== x) + notEqual(); + } else if (typeof x !== typeof y) { + notEqual(); + } else if (x === null || y === null || x === void 0 || y === void 0) { + if (x !== y) + notEqual(); + } else if (x.__proto__ !== y.__proto__) { + notEqual(); + } else if (x === y) { + } else if (typeof x === "function") { + if (x instanceof RegExp) { + if (x.toString() != y.toString()) + notEqual(); + } else if (x !== y) + notEqual(); + } else if (typeof x === "object") { + if (toS(y) === "[object Arguments]" || toS(x) === "[object Arguments]") { + if (toS(x) !== toS(y)) { + notEqual(); + } + } else if (x instanceof Date || y instanceof Date) { + if (!(x instanceof Date) || !(y instanceof Date) || x.getTime() !== y.getTime()) { + notEqual(); + } + } else { + var kx = Object.keys(x); + var ky = Object.keys(y); + if (kx.length !== ky.length) + return notEqual(); + for (var i = 0; i < kx.length; i++) { + var k = kx[i]; + if (!Object.hasOwnProperty.call(y, k)) { + notEqual(); + } + } + } + } + }); + return equal; + }; + Traverse.prototype.paths = function() { + var acc = []; + this.forEach(function(x) { + acc.push(this.path); + }); + return acc; + }; + Traverse.prototype.nodes = function() { + var acc = []; + this.forEach(function(x) { + acc.push(this.node); + }); + return acc; + }; + Traverse.prototype.clone = function() { + var parents = [], nodes = []; + return function clone(src) { + for (var i = 0; i < parents.length; i++) { + if (parents[i] === src) { + return nodes[i]; + } + } + if (typeof src === "object" && src !== null) { + var dst = copy(src); + parents.push(src); + nodes.push(dst); + Object.keys(src).forEach(function(key) { + dst[key] = clone(src[key]); + }); + parents.pop(); + nodes.pop(); + return dst; + } else { + return src; + } + }(this.value); + }; + function walk(root, cb, immutable) { + var path = []; + var parents = []; + var alive = true; + return function walker(node_) { + var node = immutable ? copy(node_) : node_; + var modifiers = {}; + var state = { + node, + node_, + path: [].concat(path), + parent: parents.slice(-1)[0], + key: path.slice(-1)[0], + isRoot: path.length === 0, + level: path.length, + circular: null, + update: function(x) { + if (!state.isRoot) { + state.parent.node[state.key] = x; + } + state.node = x; + }, + delete: function() { + delete state.parent.node[state.key]; + }, + remove: function() { + if (Array.isArray(state.parent.node)) { + state.parent.node.splice(state.key, 1); + } else { + delete state.parent.node[state.key]; + } + }, + before: function(f) { + modifiers.before = f; + }, + after: function(f) { + modifiers.after = f; + }, + pre: function(f) { + modifiers.pre = f; + }, + post: function(f) { + modifiers.post = f; + }, + stop: function() { + alive = false; + } + }; + if (!alive) + return state; + if (typeof node === "object" && node !== null) { + state.isLeaf = Object.keys(node).length == 0; + for (var i = 0; i < parents.length; i++) { + if (parents[i].node_ === node_) { + state.circular = parents[i]; + break; + } + } + } else { + state.isLeaf = true; + } + state.notLeaf = !state.isLeaf; + state.notRoot = !state.isRoot; + var ret2 = cb.call(state, state.node); + if (ret2 !== void 0 && state.update) + state.update(ret2); + if (modifiers.before) + modifiers.before.call(state, state.node); + if (typeof state.node == "object" && state.node !== null && !state.circular) { + parents.push(state); + var keys = Object.keys(state.node); + keys.forEach(function(key, i2) { + path.push(key); + if (modifiers.pre) + modifiers.pre.call(state, state.node[key], key); + var child = walker(state.node[key]); + if (immutable && Object.hasOwnProperty.call(state.node, key)) { + state.node[key] = child.node; + } + child.isLast = i2 == keys.length - 1; + child.isFirst = i2 == 0; + if (modifiers.post) + modifiers.post.call(state, child); + path.pop(); + }); + parents.pop(); + } + if (modifiers.after) + modifiers.after.call(state, state.node); + return state; + }(root).node; + } + Object.keys(Traverse.prototype).forEach(function(key) { + Traverse[key] = function(obj) { + var args = [].slice.call(arguments, 1); + var t = Traverse(obj); + return t[key].apply(t, args); + }; + }); + function copy(src) { + if (typeof src === "object" && src !== null) { + var dst; + if (Array.isArray(src)) { + dst = []; + } else if (src instanceof Date) { + dst = new Date(src); + } else if (src instanceof Boolean) { + dst = new Boolean(src); + } else if (src instanceof Number) { + dst = new Number(src); + } else if (src instanceof String) { + dst = new String(src); + } else { + dst = Object.create(Object.getPrototypeOf(src)); + } + Object.keys(src).forEach(function(key) { + dst[key] = src[key]; + }); + return dst; + } else + return src; + } +}); + +// node_modules/chainsaw/index.js +var require_chainsaw = __commonJS((exports2, module2) => { + var Traverse = require_traverse(); + var EventEmitter = require("events").EventEmitter; + module2.exports = Chainsaw; + function Chainsaw(builder) { + var saw = Chainsaw.saw(builder, {}); + var r = builder.call(saw.handlers, saw); + if (r !== void 0) + saw.handlers = r; + saw.record(); + return saw.chain(); + } + Chainsaw.light = function ChainsawLight(builder) { + var saw = Chainsaw.saw(builder, {}); + var r = builder.call(saw.handlers, saw); + if (r !== void 0) + saw.handlers = r; + return saw.chain(); + }; + Chainsaw.saw = function(builder, handlers) { + var saw = new EventEmitter(); + saw.handlers = handlers; + saw.actions = []; + saw.chain = function() { + var ch = Traverse(saw.handlers).map(function(node) { + if (this.isRoot) + return node; + var ps = this.path; + if (typeof node === "function") { + this.update(function() { + saw.actions.push({ + path: ps, + args: [].slice.call(arguments) + }); + return ch; + }); + } + }); + process.nextTick(function() { + saw.emit("begin"); + saw.next(); + }); + return ch; + }; + saw.pop = function() { + return saw.actions.shift(); + }; + saw.next = function() { + var action = saw.pop(); + if (!action) { + saw.emit("end"); + } else if (!action.trap) { + var node = saw.handlers; + action.path.forEach(function(key) { + node = node[key]; + }); + node.apply(saw.handlers, action.args); + } + }; + saw.nest = function(cb) { + var args = [].slice.call(arguments, 1); + var autonext = true; + if (typeof cb === "boolean") { + var autonext = cb; + cb = args.shift(); + } + var s = Chainsaw.saw(builder, {}); + var r = builder.call(s.handlers, s); + if (r !== void 0) + s.handlers = r; + if (typeof saw.step !== "undefined") { + s.record(); + } + cb.apply(s.chain(), args); + if (autonext !== false) + s.on("end", saw.next); + }; + saw.record = function() { + upgradeChainsaw(saw); + }; + ["trap", "down", "jump"].forEach(function(method) { + saw[method] = function() { + throw new Error("To use the trap, down and jump features, please call record() first to start recording actions."); + }; + }); + return saw; + }; + function upgradeChainsaw(saw) { + saw.step = 0; + saw.pop = function() { + return saw.actions[saw.step++]; + }; + saw.trap = function(name, cb) { + var ps = Array.isArray(name) ? name : [name]; + saw.actions.push({ + path: ps, + step: saw.step, + cb, + trap: true + }); + }; + saw.down = function(name) { + var ps = (Array.isArray(name) ? name : [name]).join("/"); + var i = saw.actions.slice(saw.step).map(function(x) { + if (x.trap && x.step <= saw.step) + return false; + return x.path.join("/") == ps; + }).indexOf(true); + if (i >= 0) + saw.step += i; + else + saw.step = saw.actions.length; + var act = saw.actions[saw.step - 1]; + if (act && act.trap) { + saw.step = act.step; + act.cb(); + } else + saw.next(); + }; + saw.jump = function(step) { + saw.step = step; + saw.next(); + }; + } +}); + +// node_modules/buffers/index.js +var require_buffers = __commonJS((exports2, module2) => { + module2.exports = Buffers; + function Buffers(bufs) { + if (!(this instanceof Buffers)) + return new Buffers(bufs); + this.buffers = bufs || []; + this.length = this.buffers.reduce(function(size, buf) { + return size + buf.length; + }, 0); + } + Buffers.prototype.push = function() { + for (var i = 0; i < arguments.length; i++) { + if (!Buffer.isBuffer(arguments[i])) { + throw new TypeError("Tried to push a non-buffer"); + } + } + for (var i = 0; i < arguments.length; i++) { + var buf = arguments[i]; + this.buffers.push(buf); + this.length += buf.length; + } + return this.length; + }; + Buffers.prototype.unshift = function() { + for (var i = 0; i < arguments.length; i++) { + if (!Buffer.isBuffer(arguments[i])) { + throw new TypeError("Tried to unshift a non-buffer"); + } + } + for (var i = 0; i < arguments.length; i++) { + var buf = arguments[i]; + this.buffers.unshift(buf); + this.length += buf.length; + } + return this.length; + }; + Buffers.prototype.copy = function(dst, dStart, start, end) { + return this.slice(start, end).copy(dst, dStart, 0, end - start); + }; + Buffers.prototype.splice = function(i, howMany) { + var buffers = this.buffers; + var index = i >= 0 ? i : this.length - i; + var reps = [].slice.call(arguments, 2); + if (howMany === void 0) { + howMany = this.length - index; + } else if (howMany > this.length - index) { + howMany = this.length - index; + } + for (var i = 0; i < reps.length; i++) { + this.length += reps[i].length; + } + var removed = new Buffers(); + var bytes = 0; + var startBytes = 0; + for (var ii = 0; ii < buffers.length && startBytes + buffers[ii].length < index; ii++) { + startBytes += buffers[ii].length; + } + if (index - startBytes > 0) { + var start = index - startBytes; + if (start + howMany < buffers[ii].length) { + removed.push(buffers[ii].slice(start, start + howMany)); + var orig = buffers[ii]; + var buf0 = new Buffer(start); + for (var i = 0; i < start; i++) { + buf0[i] = orig[i]; + } + var buf1 = new Buffer(orig.length - start - howMany); + for (var i = start + howMany; i < orig.length; i++) { + buf1[i - howMany - start] = orig[i]; + } + if (reps.length > 0) { + var reps_ = reps.slice(); + reps_.unshift(buf0); + reps_.push(buf1); + buffers.splice.apply(buffers, [ii, 1].concat(reps_)); + ii += reps_.length; + reps = []; + } else { + buffers.splice(ii, 1, buf0, buf1); + ii += 2; + } + } else { + removed.push(buffers[ii].slice(start)); + buffers[ii] = buffers[ii].slice(0, start); + ii++; + } + } + if (reps.length > 0) { + buffers.splice.apply(buffers, [ii, 0].concat(reps)); + ii += reps.length; + } + while (removed.length < howMany) { + var buf = buffers[ii]; + var len = buf.length; + var take = Math.min(len, howMany - removed.length); + if (take === len) { + removed.push(buf); + buffers.splice(ii, 1); + } else { + removed.push(buf.slice(0, take)); + buffers[ii] = buffers[ii].slice(take); + } + } + this.length -= removed.length; + return removed; + }; + Buffers.prototype.slice = function(i, j) { + var buffers = this.buffers; + if (j === void 0) + j = this.length; + if (i === void 0) + i = 0; + if (j > this.length) + j = this.length; + var startBytes = 0; + for (var si = 0; si < buffers.length && startBytes + buffers[si].length <= i; si++) { + startBytes += buffers[si].length; + } + var target = new Buffer(j - i); + var ti = 0; + for (var ii = si; ti < j - i && ii < buffers.length; ii++) { + var len = buffers[ii].length; + var start = ti === 0 ? i - startBytes : 0; + var end = ti + len >= j - i ? Math.min(start + (j - i) - ti, len) : len; + buffers[ii].copy(target, ti, start, end); + ti += end - start; + } + return target; + }; + Buffers.prototype.pos = function(i) { + if (i < 0 || i >= this.length) + throw new Error("oob"); + var l = i, bi = 0, bu = null; + for (; ; ) { + bu = this.buffers[bi]; + if (l < bu.length) { + return {buf: bi, offset: l}; + } else { + l -= bu.length; + } + bi++; + } + }; + Buffers.prototype.get = function get(i) { + var pos = this.pos(i); + return this.buffers[pos.buf].get(pos.offset); + }; + Buffers.prototype.set = function set(i, b) { + var pos = this.pos(i); + return this.buffers[pos.buf].set(pos.offset, b); + }; + Buffers.prototype.indexOf = function(needle, offset) { + if (typeof needle === "string") { + needle = new Buffer(needle); + } else if (needle instanceof Buffer) { + } else { + throw new Error("Invalid type for a search string"); + } + if (!needle.length) { + return 0; + } + if (!this.length) { + return -1; + } + var i = 0, j = 0, match = 0, mstart, pos = 0; + if (offset) { + var p = this.pos(offset); + i = p.buf; + j = p.offset; + pos = offset; + } + for (; ; ) { + while (j >= this.buffers[i].length) { + j = 0; + i++; + if (i >= this.buffers.length) { + return -1; + } + } + var char = this.buffers[i][j]; + if (char == needle[match]) { + if (match == 0) { + mstart = { + i, + j, + pos + }; + } + match++; + if (match == needle.length) { + return mstart.pos; + } + } else if (match != 0) { + i = mstart.i; + j = mstart.j; + pos = mstart.pos; + match = 0; + } + j++; + pos++; + } + }; + Buffers.prototype.toBuffer = function() { + return this.slice(); + }; + Buffers.prototype.toString = function(encoding, start, end) { + return this.slice(start, end).toString(encoding); + }; +}); + +// node_modules/binary/lib/vars.js +var require_vars = __commonJS((exports2, module2) => { + module2.exports = function(store) { + function getset(name, value) { + var node = vars.store; + var keys = name.split("."); + keys.slice(0, -1).forEach(function(k) { + if (node[k] === void 0) + node[k] = {}; + node = node[k]; + }); + var key = keys[keys.length - 1]; + if (arguments.length == 1) { + return node[key]; + } else { + return node[key] = value; + } + } + var vars = { + get: function(name) { + return getset(name); + }, + set: function(name, value) { + return getset(name, value); + }, + store: store || {} + }; + return vars; + }; +}); + +// node_modules/binary/index.js +var require_binary = __commonJS((exports2, module2) => { + var Chainsaw = require_chainsaw(); + var EventEmitter = require("events").EventEmitter; + var Buffers = require_buffers(); + var Vars = require_vars(); + var Stream = require("stream").Stream; + exports2 = module2.exports = function(bufOrEm, eventName) { + if (Buffer.isBuffer(bufOrEm)) { + return exports2.parse(bufOrEm); + } + var s = exports2.stream(); + if (bufOrEm && bufOrEm.pipe) { + bufOrEm.pipe(s); + } else if (bufOrEm) { + bufOrEm.on(eventName || "data", function(buf) { + s.write(buf); + }); + bufOrEm.on("end", function() { + s.end(); + }); + } + return s; + }; + exports2.stream = function(input) { + if (input) + return exports2.apply(null, arguments); + var pending = null; + function getBytes(bytes, cb, skip) { + pending = { + bytes, + skip, + cb: function(buf) { + pending = null; + cb(buf); + } + }; + dispatch(); + } + var offset = null; + function dispatch() { + if (!pending) { + if (caughtEnd) + done = true; + return; + } + if (typeof pending === "function") { + pending(); + } else { + var bytes = offset + pending.bytes; + if (buffers.length >= bytes) { + var buf; + if (offset == null) { + buf = buffers.splice(0, bytes); + if (!pending.skip) { + buf = buf.slice(); + } + } else { + if (!pending.skip) { + buf = buffers.slice(offset, bytes); + } + offset = bytes; + } + if (pending.skip) { + pending.cb(); + } else { + pending.cb(buf); + } + } + } + } + function builder(saw) { + function next() { + if (!done) + saw.next(); + } + var self2 = words(function(bytes, cb) { + return function(name) { + getBytes(bytes, function(buf) { + vars.set(name, cb(buf)); + next(); + }); + }; + }); + self2.tap = function(cb) { + saw.nest(cb, vars.store); + }; + self2.into = function(key, cb) { + if (!vars.get(key)) + vars.set(key, {}); + var parent = vars; + vars = Vars(parent.get(key)); + saw.nest(function() { + cb.apply(this, arguments); + this.tap(function() { + vars = parent; + }); + }, vars.store); + }; + self2.flush = function() { + vars.store = {}; + next(); + }; + self2.loop = function(cb) { + var end = false; + saw.nest(false, function loop() { + this.vars = vars.store; + cb.call(this, function() { + end = true; + next(); + }, vars.store); + this.tap(function() { + if (end) + saw.next(); + else + loop.call(this); + }.bind(this)); + }, vars.store); + }; + self2.buffer = function(name, bytes) { + if (typeof bytes === "string") { + bytes = vars.get(bytes); + } + getBytes(bytes, function(buf) { + vars.set(name, buf); + next(); + }); + }; + self2.skip = function(bytes) { + if (typeof bytes === "string") { + bytes = vars.get(bytes); + } + getBytes(bytes, function() { + next(); + }); + }; + self2.scan = function find(name, search) { + if (typeof search === "string") { + search = new Buffer(search); + } else if (!Buffer.isBuffer(search)) { + throw new Error("search must be a Buffer or a string"); + } + var taken = 0; + pending = function() { + var pos = buffers.indexOf(search, offset + taken); + var i = pos - offset - taken; + if (pos !== -1) { + pending = null; + if (offset != null) { + vars.set(name, buffers.slice(offset, offset + taken + i)); + offset += taken + i + search.length; + } else { + vars.set(name, buffers.slice(0, taken + i)); + buffers.splice(0, taken + i + search.length); + } + next(); + dispatch(); + } else { + i = Math.max(buffers.length - search.length - offset - taken, 0); + } + taken += i; + }; + dispatch(); + }; + self2.peek = function(cb) { + offset = 0; + saw.nest(function() { + cb.call(this, vars.store); + this.tap(function() { + offset = null; + }); + }); + }; + return self2; + } + ; + var stream = Chainsaw.light(builder); + stream.writable = true; + var buffers = Buffers(); + stream.write = function(buf) { + buffers.push(buf); + dispatch(); + }; + var vars = Vars(); + var done = false, caughtEnd = false; + stream.end = function() { + caughtEnd = true; + }; + stream.pipe = Stream.prototype.pipe; + Object.getOwnPropertyNames(EventEmitter.prototype).forEach(function(name) { + stream[name] = EventEmitter.prototype[name]; + }); + return stream; + }; + exports2.parse = function parse(buffer) { + var self2 = words(function(bytes, cb) { + return function(name) { + if (offset + bytes <= buffer.length) { + var buf = buffer.slice(offset, offset + bytes); + offset += bytes; + vars.set(name, cb(buf)); + } else { + vars.set(name, null); + } + return self2; + }; + }); + var offset = 0; + var vars = Vars(); + self2.vars = vars.store; + self2.tap = function(cb) { + cb.call(self2, vars.store); + return self2; + }; + self2.into = function(key, cb) { + if (!vars.get(key)) { + vars.set(key, {}); + } + var parent = vars; + vars = Vars(parent.get(key)); + cb.call(self2, vars.store); + vars = parent; + return self2; + }; + self2.loop = function(cb) { + var end = false; + var ender = function() { + end = true; + }; + while (end === false) { + cb.call(self2, ender, vars.store); + } + return self2; + }; + self2.buffer = function(name, size) { + if (typeof size === "string") { + size = vars.get(size); + } + var buf = buffer.slice(offset, Math.min(buffer.length, offset + size)); + offset += size; + vars.set(name, buf); + return self2; + }; + self2.skip = function(bytes) { + if (typeof bytes === "string") { + bytes = vars.get(bytes); + } + offset += bytes; + return self2; + }; + self2.scan = function(name, search) { + if (typeof search === "string") { + search = new Buffer(search); + } else if (!Buffer.isBuffer(search)) { + throw new Error("search must be a Buffer or a string"); + } + vars.set(name, null); + for (var i = 0; i + offset <= buffer.length - search.length + 1; i++) { + for (var j = 0; j < search.length && buffer[offset + i + j] === search[j]; j++) + ; + if (j === search.length) + break; + } + vars.set(name, buffer.slice(offset, offset + i)); + offset += i + search.length; + return self2; + }; + self2.peek = function(cb) { + var was = offset; + cb.call(self2, vars.store); + offset = was; + return self2; + }; + self2.flush = function() { + vars.store = {}; + return self2; + }; + self2.eof = function() { + return offset >= buffer.length; + }; + return self2; + }; + function decodeLEu(bytes) { + var acc = 0; + for (var i = 0; i < bytes.length; i++) { + acc += Math.pow(256, i) * bytes[i]; + } + return acc; + } + function decodeBEu(bytes) { + var acc = 0; + for (var i = 0; i < bytes.length; i++) { + acc += Math.pow(256, bytes.length - i - 1) * bytes[i]; + } + return acc; + } + function decodeBEs(bytes) { + var val = decodeBEu(bytes); + if ((bytes[0] & 128) == 128) { + val -= Math.pow(256, bytes.length); + } + return val; + } + function decodeLEs(bytes) { + var val = decodeLEu(bytes); + if ((bytes[bytes.length - 1] & 128) == 128) { + val -= Math.pow(256, bytes.length); + } + return val; + } + function words(decode) { + var self2 = {}; + [1, 2, 4, 8].forEach(function(bytes) { + var bits = bytes * 8; + self2["word" + bits + "le"] = self2["word" + bits + "lu"] = decode(bytes, decodeLEu); + self2["word" + bits + "ls"] = decode(bytes, decodeLEs); + self2["word" + bits + "be"] = self2["word" + bits + "bu"] = decode(bytes, decodeBEu); + self2["word" + bits + "bs"] = decode(bytes, decodeBEs); + }); + self2.word8 = self2.word8u = self2.word8be; + self2.word8s = self2.word8bs; + return self2; + } +}); + +// node_modules/bluebird/js/release/es5.js +var require_es5 = __commonJS((exports2, module2) => { + var isES5 = function() { + "use strict"; + return this === void 0; + }(); + if (isES5) { + module2.exports = { + freeze: Object.freeze, + defineProperty: Object.defineProperty, + getDescriptor: Object.getOwnPropertyDescriptor, + keys: Object.keys, + names: Object.getOwnPropertyNames, + getPrototypeOf: Object.getPrototypeOf, + isArray: Array.isArray, + isES5, + propertyIsWritable: function(obj, prop) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop); + return !!(!descriptor || descriptor.writable || descriptor.set); + } + }; + } else { + has = {}.hasOwnProperty; + str = {}.toString; + proto = {}.constructor.prototype; + ObjectKeys = function(o) { + var ret2 = []; + for (var key in o) { + if (has.call(o, key)) { + ret2.push(key); + } + } + return ret2; + }; + ObjectGetDescriptor = function(o, key) { + return {value: o[key]}; + }; + ObjectDefineProperty = function(o, key, desc) { + o[key] = desc.value; + return o; + }; + ObjectFreeze = function(obj) { + return obj; + }; + ObjectGetPrototypeOf = function(obj) { + try { + return Object(obj).constructor.prototype; + } catch (e) { + return proto; + } + }; + ArrayIsArray = function(obj) { + try { + return str.call(obj) === "[object Array]"; + } catch (e) { + return false; + } + }; + module2.exports = { + isArray: ArrayIsArray, + keys: ObjectKeys, + names: ObjectKeys, + defineProperty: ObjectDefineProperty, + getDescriptor: ObjectGetDescriptor, + freeze: ObjectFreeze, + getPrototypeOf: ObjectGetPrototypeOf, + isES5, + propertyIsWritable: function() { + return true; + } + }; + } + var has; + var str; + var proto; + var ObjectKeys; + var ObjectGetDescriptor; + var ObjectDefineProperty; + var ObjectFreeze; + var ObjectGetPrototypeOf; + var ArrayIsArray; +}); + +// node_modules/bluebird/js/release/util.js +var require_util = __commonJS((exports, module) => { + "use strict"; + var es5 = require_es5(); + var canEvaluate = typeof navigator == "undefined"; + var errorObj = {e: {}}; + var tryCatchTarget; + var globalObject = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : exports !== void 0 ? exports : null; + function tryCatcher() { + try { + var target = tryCatchTarget; + tryCatchTarget = null; + return target.apply(this, arguments); + } catch (e) { + errorObj.e = e; + return errorObj; + } + } + function tryCatch(fn) { + tryCatchTarget = fn; + return tryCatcher; + } + var inherits = function(Child, Parent) { + var hasProp = {}.hasOwnProperty; + function T() { + this.constructor = Child; + this.constructor$ = Parent; + for (var propertyName in Parent.prototype) { + if (hasProp.call(Parent.prototype, propertyName) && propertyName.charAt(propertyName.length - 1) !== "$") { + this[propertyName + "$"] = Parent.prototype[propertyName]; + } + } + } + T.prototype = Parent.prototype; + Child.prototype = new T(); + return Child.prototype; + }; + function isPrimitive(val) { + return val == null || val === true || val === false || typeof val === "string" || typeof val === "number"; + } + function isObject(value) { + return typeof value === "function" || typeof value === "object" && value !== null; + } + function maybeWrapAsError(maybeError) { + if (!isPrimitive(maybeError)) + return maybeError; + return new Error(safeToString(maybeError)); + } + function withAppended(target, appendee) { + var len = target.length; + var ret2 = new Array(len + 1); + var i; + for (i = 0; i < len; ++i) { + ret2[i] = target[i]; + } + ret2[i] = appendee; + return ret2; + } + function getDataPropertyOrDefault(obj, key, defaultValue) { + if (es5.isES5) { + var desc = Object.getOwnPropertyDescriptor(obj, key); + if (desc != null) { + return desc.get == null && desc.set == null ? desc.value : defaultValue; + } + } else { + return {}.hasOwnProperty.call(obj, key) ? obj[key] : void 0; + } + } + function notEnumerableProp(obj, name, value) { + if (isPrimitive(obj)) + return obj; + var descriptor = { + value, + configurable: true, + enumerable: false, + writable: true + }; + es5.defineProperty(obj, name, descriptor); + return obj; + } + function thrower(r) { + throw r; + } + var inheritedDataKeys = function() { + var excludedPrototypes = [ + Array.prototype, + Object.prototype, + Function.prototype + ]; + var isExcludedProto = function(val) { + for (var i = 0; i < excludedPrototypes.length; ++i) { + if (excludedPrototypes[i] === val) { + return true; + } + } + return false; + }; + if (es5.isES5) { + var getKeys = Object.getOwnPropertyNames; + return function(obj) { + var ret2 = []; + var visitedKeys = Object.create(null); + while (obj != null && !isExcludedProto(obj)) { + var keys; + try { + keys = getKeys(obj); + } catch (e) { + return ret2; + } + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (visitedKeys[key]) + continue; + visitedKeys[key] = true; + var desc = Object.getOwnPropertyDescriptor(obj, key); + if (desc != null && desc.get == null && desc.set == null) { + ret2.push(key); + } + } + obj = es5.getPrototypeOf(obj); + } + return ret2; + }; + } else { + var hasProp = {}.hasOwnProperty; + return function(obj) { + if (isExcludedProto(obj)) + return []; + var ret2 = []; + enumeration: + for (var key in obj) { + if (hasProp.call(obj, key)) { + ret2.push(key); + } else { + for (var i = 0; i < excludedPrototypes.length; ++i) { + if (hasProp.call(excludedPrototypes[i], key)) { + continue enumeration; + } + } + ret2.push(key); + } + } + return ret2; + }; + } + }(); + var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/; + function isClass(fn) { + try { + if (typeof fn === "function") { + var keys = es5.names(fn.prototype); + var hasMethods = es5.isES5 && keys.length > 1; + var hasMethodsOtherThanConstructor = keys.length > 0 && !(keys.length === 1 && keys[0] === "constructor"); + var hasThisAssignmentAndStaticMethods = thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; + if (hasMethods || hasMethodsOtherThanConstructor || hasThisAssignmentAndStaticMethods) { + return true; + } + } + return false; + } catch (e) { + return false; + } + } + function toFastProperties(obj) { + function FakeConstructor() { + } + FakeConstructor.prototype = obj; + var l = 8; + while (l--) + new FakeConstructor(); + return obj; + eval(obj); + } + var rident = /^[a-z$_][a-z$_0-9]*$/i; + function isIdentifier(str) { + return rident.test(str); + } + function filledRange(count, prefix, suffix) { + var ret2 = new Array(count); + for (var i = 0; i < count; ++i) { + ret2[i] = prefix + i + suffix; + } + return ret2; + } + function safeToString(obj) { + try { + return obj + ""; + } catch (e) { + return "[no string representation]"; + } + } + function isError(obj) { + return obj !== null && typeof obj === "object" && typeof obj.message === "string" && typeof obj.name === "string"; + } + function markAsOriginatingFromRejection(e) { + try { + notEnumerableProp(e, "isOperational", true); + } catch (ignore) { + } + } + function originatesFromRejection(e) { + if (e == null) + return false; + return e instanceof Error["__BluebirdErrorTypes__"].OperationalError || e["isOperational"] === true; + } + function canAttachTrace(obj) { + return isError(obj) && es5.propertyIsWritable(obj, "stack"); + } + var ensureErrorObject = function() { + if (!("stack" in new Error())) { + return function(value) { + if (canAttachTrace(value)) + return value; + try { + throw new Error(safeToString(value)); + } catch (err) { + return err; + } + }; + } else { + return function(value) { + if (canAttachTrace(value)) + return value; + return new Error(safeToString(value)); + }; + } + }(); + function classString(obj) { + return {}.toString.call(obj); + } + function copyDescriptors(from, to, filter) { + var keys = es5.names(from); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (filter(key)) { + try { + es5.defineProperty(to, key, es5.getDescriptor(from, key)); + } catch (ignore) { + } + } + } + } + var asArray = function(v) { + if (es5.isArray(v)) { + return v; + } + return null; + }; + if (typeof Symbol !== "undefined" && Symbol.iterator) { + ArrayFrom = typeof Array.from === "function" ? function(v) { + return Array.from(v); + } : function(v) { + var ret2 = []; + var it = v[Symbol.iterator](); + var itResult; + while (!(itResult = it.next()).done) { + ret2.push(itResult.value); + } + return ret2; + }; + asArray = function(v) { + if (es5.isArray(v)) { + return v; + } else if (v != null && typeof v[Symbol.iterator] === "function") { + return ArrayFrom(v); + } + return null; + }; + } + var ArrayFrom; + var isNode = typeof process !== "undefined" && classString(process).toLowerCase() === "[object process]"; + var hasEnvVariables = typeof process !== "undefined" && typeof process.env !== "undefined"; + function env(key) { + return hasEnvVariables ? process.env[key] : void 0; + } + function getNativePromise() { + if (typeof Promise === "function") { + try { + var promise = new Promise(function() { + }); + if ({}.toString.call(promise) === "[object Promise]") { + return Promise; + } + } catch (e) { + } + } + } + function domainBind(self2, cb) { + return self2.bind(cb); + } + var ret = { + isClass, + isIdentifier, + inheritedDataKeys, + getDataPropertyOrDefault, + thrower, + isArray: es5.isArray, + asArray, + notEnumerableProp, + isPrimitive, + isObject, + isError, + canEvaluate, + errorObj, + tryCatch, + inherits, + withAppended, + maybeWrapAsError, + toFastProperties, + filledRange, + toString: safeToString, + canAttachTrace, + ensureErrorObject, + originatesFromRejection, + markAsOriginatingFromRejection, + classString, + copyDescriptors, + hasDevTools: typeof chrome !== "undefined" && chrome && typeof chrome.loadTimes === "function", + isNode, + hasEnvVariables, + env, + global: globalObject, + getNativePromise, + domainBind + }; + ret.isRecentNode = ret.isNode && function() { + var version = process.versions.node.split(".").map(Number); + return version[0] === 0 && version[1] > 10 || version[0] > 0; + }(); + if (ret.isNode) + ret.toFastProperties(process); + try { + throw new Error(); + } catch (e) { + ret.lastLineError = e; + } + module.exports = ret; +}); + +// node_modules/bluebird/js/release/schedule.js +var require_schedule = __commonJS((exports2, module2) => { + "use strict"; + var util = require_util(); + var schedule; + var noAsyncScheduler = function() { + throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n"); + }; + var NativePromise = util.getNativePromise(); + if (util.isNode && typeof MutationObserver === "undefined") { + GlobalSetImmediate = global.setImmediate; + ProcessNextTick = process.nextTick; + schedule = util.isRecentNode ? function(fn) { + GlobalSetImmediate.call(global, fn); + } : function(fn) { + ProcessNextTick.call(process, fn); + }; + } else if (typeof NativePromise === "function" && typeof NativePromise.resolve === "function") { + nativePromise = NativePromise.resolve(); + schedule = function(fn) { + nativePromise.then(fn); + }; + } else if (typeof MutationObserver !== "undefined" && !(typeof window !== "undefined" && window.navigator && (window.navigator.standalone || window.cordova))) { + schedule = function() { + var div = document.createElement("div"); + var opts = {attributes: true}; + var toggleScheduled = false; + var div2 = document.createElement("div"); + var o2 = new MutationObserver(function() { + div.classList.toggle("foo"); + toggleScheduled = false; + }); + o2.observe(div2, opts); + var scheduleToggle = function() { + if (toggleScheduled) + return; + toggleScheduled = true; + div2.classList.toggle("foo"); + }; + return function schedule2(fn) { + var o = new MutationObserver(function() { + o.disconnect(); + fn(); + }); + o.observe(div, opts); + scheduleToggle(); + }; + }(); + } else if (typeof setImmediate !== "undefined") { + schedule = function(fn) { + setImmediate(fn); + }; + } else if (typeof setTimeout !== "undefined") { + schedule = function(fn) { + setTimeout(fn, 0); + }; + } else { + schedule = noAsyncScheduler; + } + var GlobalSetImmediate; + var ProcessNextTick; + var nativePromise; + module2.exports = schedule; +}); + +// node_modules/bluebird/js/release/queue.js +var require_queue = __commonJS((exports2, module2) => { + "use strict"; + function arrayMove(src, srcIndex, dst, dstIndex, len) { + for (var j = 0; j < len; ++j) { + dst[j + dstIndex] = src[j + srcIndex]; + src[j + srcIndex] = void 0; + } + } + function Queue(capacity) { + this._capacity = capacity; + this._length = 0; + this._front = 0; + } + Queue.prototype._willBeOverCapacity = function(size) { + return this._capacity < size; + }; + Queue.prototype._pushOne = function(arg) { + var length = this.length(); + this._checkCapacity(length + 1); + var i = this._front + length & this._capacity - 1; + this[i] = arg; + this._length = length + 1; + }; + Queue.prototype.push = function(fn, receiver, arg) { + var length = this.length() + 3; + if (this._willBeOverCapacity(length)) { + this._pushOne(fn); + this._pushOne(receiver); + this._pushOne(arg); + return; + } + var j = this._front + length - 3; + this._checkCapacity(length); + var wrapMask = this._capacity - 1; + this[j + 0 & wrapMask] = fn; + this[j + 1 & wrapMask] = receiver; + this[j + 2 & wrapMask] = arg; + this._length = length; + }; + Queue.prototype.shift = function() { + var front = this._front, ret2 = this[front]; + this[front] = void 0; + this._front = front + 1 & this._capacity - 1; + this._length--; + return ret2; + }; + Queue.prototype.length = function() { + return this._length; + }; + Queue.prototype._checkCapacity = function(size) { + if (this._capacity < size) { + this._resizeTo(this._capacity << 1); + } + }; + Queue.prototype._resizeTo = function(capacity) { + var oldCapacity = this._capacity; + this._capacity = capacity; + var front = this._front; + var length = this._length; + var moveItemsCount = front + length & oldCapacity - 1; + arrayMove(this, 0, this, oldCapacity, moveItemsCount); + }; + module2.exports = Queue; +}); + +// node_modules/bluebird/js/release/async.js +var require_async = __commonJS((exports2, module2) => { + "use strict"; + var firstLineError; + try { + throw new Error(); + } catch (e) { + firstLineError = e; + } + var schedule = require_schedule(); + var Queue = require_queue(); + var util = require_util(); + function Async() { + this._customScheduler = false; + this._isTickUsed = false; + this._lateQueue = new Queue(16); + this._normalQueue = new Queue(16); + this._haveDrainedQueues = false; + this._trampolineEnabled = true; + var self2 = this; + this.drainQueues = function() { + self2._drainQueues(); + }; + this._schedule = schedule; + } + Async.prototype.setScheduler = function(fn) { + var prev = this._schedule; + this._schedule = fn; + this._customScheduler = true; + return prev; + }; + Async.prototype.hasCustomScheduler = function() { + return this._customScheduler; + }; + Async.prototype.enableTrampoline = function() { + this._trampolineEnabled = true; + }; + Async.prototype.disableTrampolineIfNecessary = function() { + if (util.hasDevTools) { + this._trampolineEnabled = false; + } + }; + Async.prototype.haveItemsQueued = function() { + return this._isTickUsed || this._haveDrainedQueues; + }; + Async.prototype.fatalError = function(e, isNode2) { + if (isNode2) { + process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) + "\n"); + process.exit(2); + } else { + this.throwLater(e); + } + }; + Async.prototype.throwLater = function(fn, arg) { + if (arguments.length === 1) { + arg = fn; + fn = function() { + throw arg; + }; + } + if (typeof setTimeout !== "undefined") { + setTimeout(function() { + fn(arg); + }, 0); + } else + try { + this._schedule(function() { + fn(arg); + }); + } catch (e) { + throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n"); + } + }; + function AsyncInvokeLater(fn, receiver, arg) { + this._lateQueue.push(fn, receiver, arg); + this._queueTick(); + } + function AsyncInvoke(fn, receiver, arg) { + this._normalQueue.push(fn, receiver, arg); + this._queueTick(); + } + function AsyncSettlePromises(promise) { + this._normalQueue._pushOne(promise); + this._queueTick(); + } + if (!util.hasDevTools) { + Async.prototype.invokeLater = AsyncInvokeLater; + Async.prototype.invoke = AsyncInvoke; + Async.prototype.settlePromises = AsyncSettlePromises; + } else { + Async.prototype.invokeLater = function(fn, receiver, arg) { + if (this._trampolineEnabled) { + AsyncInvokeLater.call(this, fn, receiver, arg); + } else { + this._schedule(function() { + setTimeout(function() { + fn.call(receiver, arg); + }, 100); + }); + } + }; + Async.prototype.invoke = function(fn, receiver, arg) { + if (this._trampolineEnabled) { + AsyncInvoke.call(this, fn, receiver, arg); + } else { + this._schedule(function() { + fn.call(receiver, arg); + }); + } + }; + Async.prototype.settlePromises = function(promise) { + if (this._trampolineEnabled) { + AsyncSettlePromises.call(this, promise); + } else { + this._schedule(function() { + promise._settlePromises(); + }); + } + }; + } + Async.prototype._drainQueue = function(queue) { + while (queue.length() > 0) { + var fn = queue.shift(); + if (typeof fn !== "function") { + fn._settlePromises(); + continue; + } + var receiver = queue.shift(); + var arg = queue.shift(); + fn.call(receiver, arg); + } + }; + Async.prototype._drainQueues = function() { + this._drainQueue(this._normalQueue); + this._reset(); + this._haveDrainedQueues = true; + this._drainQueue(this._lateQueue); + }; + Async.prototype._queueTick = function() { + if (!this._isTickUsed) { + this._isTickUsed = true; + this._schedule(this.drainQueues); + } + }; + Async.prototype._reset = function() { + this._isTickUsed = false; + }; + module2.exports = Async; + module2.exports.firstLineError = firstLineError; +}); + +// node_modules/bluebird/js/release/errors.js +var require_errors = __commonJS((exports2, module2) => { + "use strict"; + var es52 = require_es5(); + var Objectfreeze = es52.freeze; + var util = require_util(); + var inherits2 = util.inherits; + var notEnumerableProp2 = util.notEnumerableProp; + function subError(nameProperty, defaultMessage) { + function SubError(message) { + if (!(this instanceof SubError)) + return new SubError(message); + notEnumerableProp2(this, "message", typeof message === "string" ? message : defaultMessage); + notEnumerableProp2(this, "name", nameProperty); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + Error.call(this); + } + } + inherits2(SubError, Error); + return SubError; + } + var _TypeError; + var _RangeError; + var Warning = subError("Warning", "warning"); + var CancellationError = subError("CancellationError", "cancellation error"); + var TimeoutError = subError("TimeoutError", "timeout error"); + var AggregateError = subError("AggregateError", "aggregate error"); + try { + _TypeError = TypeError; + _RangeError = RangeError; + } catch (e) { + _TypeError = subError("TypeError", "type error"); + _RangeError = subError("RangeError", "range error"); + } + var methods = "join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "); + for (var i = 0; i < methods.length; ++i) { + if (typeof Array.prototype[methods[i]] === "function") { + AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; + } + } + es52.defineProperty(AggregateError.prototype, "length", { + value: 0, + configurable: false, + writable: true, + enumerable: true + }); + AggregateError.prototype["isOperational"] = true; + var level = 0; + AggregateError.prototype.toString = function() { + var indent = Array(level * 4 + 1).join(" "); + var ret2 = "\n" + indent + "AggregateError of:\n"; + level++; + indent = Array(level * 4 + 1).join(" "); + for (var i2 = 0; i2 < this.length; ++i2) { + var str = this[i2] === this ? "[Circular AggregateError]" : this[i2] + ""; + var lines = str.split("\n"); + for (var j = 0; j < lines.length; ++j) { + lines[j] = indent + lines[j]; + } + str = lines.join("\n"); + ret2 += str + "\n"; + } + level--; + return ret2; + }; + function OperationalError(message) { + if (!(this instanceof OperationalError)) + return new OperationalError(message); + notEnumerableProp2(this, "name", "OperationalError"); + notEnumerableProp2(this, "message", message); + this.cause = message; + this["isOperational"] = true; + if (message instanceof Error) { + notEnumerableProp2(this, "message", message.message); + notEnumerableProp2(this, "stack", message.stack); + } else if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + } + inherits2(OperationalError, Error); + var errorTypes = Error["__BluebirdErrorTypes__"]; + if (!errorTypes) { + errorTypes = Objectfreeze({ + CancellationError, + TimeoutError, + OperationalError, + RejectionError: OperationalError, + AggregateError + }); + es52.defineProperty(Error, "__BluebirdErrorTypes__", { + value: errorTypes, + writable: false, + enumerable: false, + configurable: false + }); + } + module2.exports = { + Error, + TypeError: _TypeError, + RangeError: _RangeError, + CancellationError: errorTypes.CancellationError, + OperationalError: errorTypes.OperationalError, + TimeoutError: errorTypes.TimeoutError, + AggregateError: errorTypes.AggregateError, + Warning + }; +}); + +// node_modules/bluebird/js/release/thenables.js +var require_thenables = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, INTERNAL) { + var util = require_util(); + var errorObj2 = util.errorObj; + var isObject3 = util.isObject; + function tryConvertToPromise(obj, context) { + if (isObject3(obj)) { + if (obj instanceof Promise2) + return obj; + var then = getThen(obj); + if (then === errorObj2) { + if (context) + context._pushContext(); + var ret2 = Promise2.reject(then.e); + if (context) + context._popContext(); + return ret2; + } else if (typeof then === "function") { + if (isAnyBluebirdPromise(obj)) { + var ret2 = new Promise2(INTERNAL); + obj._then(ret2._fulfill, ret2._reject, void 0, ret2, null); + return ret2; + } + return doThenable(obj, then, context); + } + } + return obj; + } + function doGetThen(obj) { + return obj.then; + } + function getThen(obj) { + try { + return doGetThen(obj); + } catch (e) { + errorObj2.e = e; + return errorObj2; + } + } + var hasProp = {}.hasOwnProperty; + function isAnyBluebirdPromise(obj) { + try { + return hasProp.call(obj, "_promise0"); + } catch (e) { + return false; + } + } + function doThenable(x, then, context) { + var promise = new Promise2(INTERNAL); + var ret2 = promise; + if (context) + context._pushContext(); + promise._captureStackTrace(); + if (context) + context._popContext(); + var synchronous = true; + var result = util.tryCatch(then).call(x, resolve, reject); + synchronous = false; + if (promise && result === errorObj2) { + promise._rejectCallback(result.e, true, true); + promise = null; + } + function resolve(value) { + if (!promise) + return; + promise._resolveCallback(value); + promise = null; + } + function reject(reason) { + if (!promise) + return; + promise._rejectCallback(reason, synchronous, true); + promise = null; + } + return ret2; + } + return tryConvertToPromise; + }; +}); + +// node_modules/bluebird/js/release/promise_array.js +var require_promise_array = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, INTERNAL, tryConvertToPromise, apiRejection, Proxyable) { + var util = require_util(); + var isArray = util.isArray; + function toResolutionValue(val) { + switch (val) { + case -2: + return []; + case -3: + return {}; + } + } + function PromiseArray(values) { + var promise = this._promise = new Promise2(INTERNAL); + if (values instanceof Promise2) { + promise._propagateFrom(values, 3); + } + promise._setOnCancel(this); + this._values = values; + this._length = 0; + this._totalResolved = 0; + this._init(void 0, -2); + } + util.inherits(PromiseArray, Proxyable); + PromiseArray.prototype.length = function() { + return this._length; + }; + PromiseArray.prototype.promise = function() { + return this._promise; + }; + PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { + var values = tryConvertToPromise(this._values, this._promise); + if (values instanceof Promise2) { + values = values._target(); + var bitField = values._bitField; + ; + this._values = values; + if ((bitField & 50397184) === 0) { + this._promise._setAsyncGuaranteed(); + return values._then(init, this._reject, void 0, this, resolveValueIfEmpty); + } else if ((bitField & 33554432) !== 0) { + values = values._value(); + } else if ((bitField & 16777216) !== 0) { + return this._reject(values._reason()); + } else { + return this._cancel(); + } + } + values = util.asArray(values); + if (values === null) { + var err = apiRejection("expecting an array or an iterable object but got " + util.classString(values)).reason(); + this._promise._rejectCallback(err, false); + return; + } + if (values.length === 0) { + if (resolveValueIfEmpty === -5) { + this._resolveEmptyArray(); + } else { + this._resolve(toResolutionValue(resolveValueIfEmpty)); + } + return; + } + this._iterate(values); + }; + PromiseArray.prototype._iterate = function(values) { + var len = this.getActualLength(values.length); + this._length = len; + this._values = this.shouldCopyValues() ? new Array(len) : this._values; + var result = this._promise; + var isResolved = false; + var bitField = null; + for (var i = 0; i < len; ++i) { + var maybePromise = tryConvertToPromise(values[i], result); + if (maybePromise instanceof Promise2) { + maybePromise = maybePromise._target(); + bitField = maybePromise._bitField; + } else { + bitField = null; + } + if (isResolved) { + if (bitField !== null) { + maybePromise.suppressUnhandledRejections(); + } + } else if (bitField !== null) { + if ((bitField & 50397184) === 0) { + maybePromise._proxy(this, i); + this._values[i] = maybePromise; + } else if ((bitField & 33554432) !== 0) { + isResolved = this._promiseFulfilled(maybePromise._value(), i); + } else if ((bitField & 16777216) !== 0) { + isResolved = this._promiseRejected(maybePromise._reason(), i); + } else { + isResolved = this._promiseCancelled(i); + } + } else { + isResolved = this._promiseFulfilled(maybePromise, i); + } + } + if (!isResolved) + result._setAsyncGuaranteed(); + }; + PromiseArray.prototype._isResolved = function() { + return this._values === null; + }; + PromiseArray.prototype._resolve = function(value) { + this._values = null; + this._promise._fulfill(value); + }; + PromiseArray.prototype._cancel = function() { + if (this._isResolved() || !this._promise._isCancellable()) + return; + this._values = null; + this._promise._cancel(); + }; + PromiseArray.prototype._reject = function(reason) { + this._values = null; + this._promise._rejectCallback(reason, false); + }; + PromiseArray.prototype._promiseFulfilled = function(value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + this._resolve(this._values); + return true; + } + return false; + }; + PromiseArray.prototype._promiseCancelled = function() { + this._cancel(); + return true; + }; + PromiseArray.prototype._promiseRejected = function(reason) { + this._totalResolved++; + this._reject(reason); + return true; + }; + PromiseArray.prototype._resultCancelled = function() { + if (this._isResolved()) + return; + var values = this._values; + this._cancel(); + if (values instanceof Promise2) { + values.cancel(); + } else { + for (var i = 0; i < values.length; ++i) { + if (values[i] instanceof Promise2) { + values[i].cancel(); + } + } + } + }; + PromiseArray.prototype.shouldCopyValues = function() { + return true; + }; + PromiseArray.prototype.getActualLength = function(len) { + return len; + }; + return PromiseArray; + }; +}); + +// node_modules/bluebird/js/release/context.js +var require_context = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2) { + var longStackTraces = false; + var contextStack = []; + Promise2.prototype._promiseCreated = function() { + }; + Promise2.prototype._pushContext = function() { + }; + Promise2.prototype._popContext = function() { + return null; + }; + Promise2._peekContext = Promise2.prototype._peekContext = function() { + }; + function Context() { + this._trace = new Context.CapturedTrace(peekContext()); + } + Context.prototype._pushContext = function() { + if (this._trace !== void 0) { + this._trace._promiseCreated = null; + contextStack.push(this._trace); + } + }; + Context.prototype._popContext = function() { + if (this._trace !== void 0) { + var trace = contextStack.pop(); + var ret2 = trace._promiseCreated; + trace._promiseCreated = null; + return ret2; + } + return null; + }; + function createContext() { + if (longStackTraces) + return new Context(); + } + function peekContext() { + var lastIndex = contextStack.length - 1; + if (lastIndex >= 0) { + return contextStack[lastIndex]; + } + return void 0; + } + Context.CapturedTrace = null; + Context.create = createContext; + Context.deactivateLongStackTraces = function() { + }; + Context.activateLongStackTraces = function() { + var Promise_pushContext = Promise2.prototype._pushContext; + var Promise_popContext = Promise2.prototype._popContext; + var Promise_PeekContext = Promise2._peekContext; + var Promise_peekContext = Promise2.prototype._peekContext; + var Promise_promiseCreated = Promise2.prototype._promiseCreated; + Context.deactivateLongStackTraces = function() { + Promise2.prototype._pushContext = Promise_pushContext; + Promise2.prototype._popContext = Promise_popContext; + Promise2._peekContext = Promise_PeekContext; + Promise2.prototype._peekContext = Promise_peekContext; + Promise2.prototype._promiseCreated = Promise_promiseCreated; + longStackTraces = false; + }; + longStackTraces = true; + Promise2.prototype._pushContext = Context.prototype._pushContext; + Promise2.prototype._popContext = Context.prototype._popContext; + Promise2._peekContext = Promise2.prototype._peekContext = peekContext; + Promise2.prototype._promiseCreated = function() { + var ctx = this._peekContext(); + if (ctx && ctx._promiseCreated == null) + ctx._promiseCreated = this; + }; + }; + return Context; + }; +}); + +// node_modules/bluebird/js/release/debuggability.js +var require_debuggability = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, Context) { + var getDomain = Promise2._getDomain; + var async = Promise2._async; + var Warning = require_errors().Warning; + var util = require_util(); + var canAttachTrace2 = util.canAttachTrace; + var unhandledRejectionHandled; + var possiblyUnhandledRejection; + var bluebirdFramePattern = /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/; + var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/; + var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/; + var stackFramePattern = null; + var formatStack = null; + var indentStackFrames = false; + var printWarning; + var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && (util.env("BLUEBIRD_DEBUG") || util.env("NODE_ENV") === "development")); + var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && (debugging || util.env("BLUEBIRD_WARNINGS"))); + var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES"))); + var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); + Promise2.prototype.suppressUnhandledRejections = function() { + var target = this._target(); + target._bitField = target._bitField & ~1048576 | 524288; + }; + Promise2.prototype._ensurePossibleRejectionHandled = function() { + if ((this._bitField & 524288) !== 0) + return; + this._setRejectionIsUnhandled(); + async.invokeLater(this._notifyUnhandledRejection, this, void 0); + }; + Promise2.prototype._notifyUnhandledRejectionIsHandled = function() { + fireRejectionEvent("rejectionHandled", unhandledRejectionHandled, void 0, this); + }; + Promise2.prototype._setReturnedNonUndefined = function() { + this._bitField = this._bitField | 268435456; + }; + Promise2.prototype._returnedNonUndefined = function() { + return (this._bitField & 268435456) !== 0; + }; + Promise2.prototype._notifyUnhandledRejection = function() { + if (this._isRejectionUnhandled()) { + var reason = this._settledValue(); + this._setUnhandledRejectionIsNotified(); + fireRejectionEvent("unhandledRejection", possiblyUnhandledRejection, reason, this); + } + }; + Promise2.prototype._setUnhandledRejectionIsNotified = function() { + this._bitField = this._bitField | 262144; + }; + Promise2.prototype._unsetUnhandledRejectionIsNotified = function() { + this._bitField = this._bitField & ~262144; + }; + Promise2.prototype._isUnhandledRejectionNotified = function() { + return (this._bitField & 262144) > 0; + }; + Promise2.prototype._setRejectionIsUnhandled = function() { + this._bitField = this._bitField | 1048576; + }; + Promise2.prototype._unsetRejectionIsUnhandled = function() { + this._bitField = this._bitField & ~1048576; + if (this._isUnhandledRejectionNotified()) { + this._unsetUnhandledRejectionIsNotified(); + this._notifyUnhandledRejectionIsHandled(); + } + }; + Promise2.prototype._isRejectionUnhandled = function() { + return (this._bitField & 1048576) > 0; + }; + Promise2.prototype._warn = function(message, shouldUseOwnTrace, promise) { + return warn(message, shouldUseOwnTrace, promise || this); + }; + Promise2.onPossiblyUnhandledRejection = function(fn) { + var domain = getDomain(); + possiblyUnhandledRejection = typeof fn === "function" ? domain === null ? fn : util.domainBind(domain, fn) : void 0; + }; + Promise2.onUnhandledRejectionHandled = function(fn) { + var domain = getDomain(); + unhandledRejectionHandled = typeof fn === "function" ? domain === null ? fn : util.domainBind(domain, fn) : void 0; + }; + var disableLongStackTraces = function() { + }; + Promise2.longStackTraces = function() { + if (async.haveItemsQueued() && !config.longStackTraces) { + throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n"); + } + if (!config.longStackTraces && longStackTracesIsSupported()) { + var Promise_captureStackTrace = Promise2.prototype._captureStackTrace; + var Promise_attachExtraTrace = Promise2.prototype._attachExtraTrace; + config.longStackTraces = true; + disableLongStackTraces = function() { + if (async.haveItemsQueued() && !config.longStackTraces) { + throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n"); + } + Promise2.prototype._captureStackTrace = Promise_captureStackTrace; + Promise2.prototype._attachExtraTrace = Promise_attachExtraTrace; + Context.deactivateLongStackTraces(); + async.enableTrampoline(); + config.longStackTraces = false; + }; + Promise2.prototype._captureStackTrace = longStackTracesCaptureStackTrace; + Promise2.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; + Context.activateLongStackTraces(); + async.disableTrampolineIfNecessary(); + } + }; + Promise2.hasLongStackTraces = function() { + return config.longStackTraces && longStackTracesIsSupported(); + }; + var fireDomEvent = function() { + try { + if (typeof CustomEvent === "function") { + var event = new CustomEvent("CustomEvent"); + util.global.dispatchEvent(event); + return function(name, event2) { + var domEvent = new CustomEvent(name.toLowerCase(), { + detail: event2, + cancelable: true + }); + return !util.global.dispatchEvent(domEvent); + }; + } else if (typeof Event === "function") { + var event = new Event("CustomEvent"); + util.global.dispatchEvent(event); + return function(name, event2) { + var domEvent = new Event(name.toLowerCase(), { + cancelable: true + }); + domEvent.detail = event2; + return !util.global.dispatchEvent(domEvent); + }; + } else { + var event = document.createEvent("CustomEvent"); + event.initCustomEvent("testingtheevent", false, true, {}); + util.global.dispatchEvent(event); + return function(name, event2) { + var domEvent = document.createEvent("CustomEvent"); + domEvent.initCustomEvent(name.toLowerCase(), false, true, event2); + return !util.global.dispatchEvent(domEvent); + }; + } + } catch (e) { + } + return function() { + return false; + }; + }(); + var fireGlobalEvent = function() { + if (util.isNode) { + return function() { + return process.emit.apply(process, arguments); + }; + } else { + if (!util.global) { + return function() { + return false; + }; + } + return function(name) { + var methodName = "on" + name.toLowerCase(); + var method = util.global[methodName]; + if (!method) + return false; + method.apply(util.global, [].slice.call(arguments, 1)); + return true; + }; + } + }(); + function generatePromiseLifecycleEventObject(name, promise) { + return {promise}; + } + var eventToObjectGenerator = { + promiseCreated: generatePromiseLifecycleEventObject, + promiseFulfilled: generatePromiseLifecycleEventObject, + promiseRejected: generatePromiseLifecycleEventObject, + promiseResolved: generatePromiseLifecycleEventObject, + promiseCancelled: generatePromiseLifecycleEventObject, + promiseChained: function(name, promise, child) { + return {promise, child}; + }, + warning: function(name, warning) { + return {warning}; + }, + unhandledRejection: function(name, reason, promise) { + return {reason, promise}; + }, + rejectionHandled: generatePromiseLifecycleEventObject + }; + var activeFireEvent = function(name) { + var globalEventFired = false; + try { + globalEventFired = fireGlobalEvent.apply(null, arguments); + } catch (e) { + async.throwLater(e); + globalEventFired = true; + } + var domEventFired = false; + try { + domEventFired = fireDomEvent(name, eventToObjectGenerator[name].apply(null, arguments)); + } catch (e) { + async.throwLater(e); + domEventFired = true; + } + return domEventFired || globalEventFired; + }; + Promise2.config = function(opts) { + opts = Object(opts); + if ("longStackTraces" in opts) { + if (opts.longStackTraces) { + Promise2.longStackTraces(); + } else if (!opts.longStackTraces && Promise2.hasLongStackTraces()) { + disableLongStackTraces(); + } + } + if ("warnings" in opts) { + var warningsOption = opts.warnings; + config.warnings = !!warningsOption; + wForgottenReturn = config.warnings; + if (util.isObject(warningsOption)) { + if ("wForgottenReturn" in warningsOption) { + wForgottenReturn = !!warningsOption.wForgottenReturn; + } + } + } + if ("cancellation" in opts && opts.cancellation && !config.cancellation) { + if (async.haveItemsQueued()) { + throw new Error("cannot enable cancellation after promises are in use"); + } + Promise2.prototype._clearCancellationData = cancellationClearCancellationData; + Promise2.prototype._propagateFrom = cancellationPropagateFrom; + Promise2.prototype._onCancel = cancellationOnCancel; + Promise2.prototype._setOnCancel = cancellationSetOnCancel; + Promise2.prototype._attachCancellationCallback = cancellationAttachCancellationCallback; + Promise2.prototype._execute = cancellationExecute; + propagateFromFunction = cancellationPropagateFrom; + config.cancellation = true; + } + if ("monitoring" in opts) { + if (opts.monitoring && !config.monitoring) { + config.monitoring = true; + Promise2.prototype._fireEvent = activeFireEvent; + } else if (!opts.monitoring && config.monitoring) { + config.monitoring = false; + Promise2.prototype._fireEvent = defaultFireEvent; + } + } + return Promise2; + }; + function defaultFireEvent() { + return false; + } + Promise2.prototype._fireEvent = defaultFireEvent; + Promise2.prototype._execute = function(executor, resolve, reject) { + try { + executor(resolve, reject); + } catch (e) { + return e; + } + }; + Promise2.prototype._onCancel = function() { + }; + Promise2.prototype._setOnCancel = function(handler) { + ; + }; + Promise2.prototype._attachCancellationCallback = function(onCancel) { + ; + }; + Promise2.prototype._captureStackTrace = function() { + }; + Promise2.prototype._attachExtraTrace = function() { + }; + Promise2.prototype._clearCancellationData = function() { + }; + Promise2.prototype._propagateFrom = function(parent, flags) { + ; + ; + }; + function cancellationExecute(executor, resolve, reject) { + var promise = this; + try { + executor(resolve, reject, function(onCancel) { + if (typeof onCancel !== "function") { + throw new TypeError("onCancel must be a function, got: " + util.toString(onCancel)); + } + promise._attachCancellationCallback(onCancel); + }); + } catch (e) { + return e; + } + } + function cancellationAttachCancellationCallback(onCancel) { + if (!this._isCancellable()) + return this; + var previousOnCancel = this._onCancel(); + if (previousOnCancel !== void 0) { + if (util.isArray(previousOnCancel)) { + previousOnCancel.push(onCancel); + } else { + this._setOnCancel([previousOnCancel, onCancel]); + } + } else { + this._setOnCancel(onCancel); + } + } + function cancellationOnCancel() { + return this._onCancelField; + } + function cancellationSetOnCancel(onCancel) { + this._onCancelField = onCancel; + } + function cancellationClearCancellationData() { + this._cancellationParent = void 0; + this._onCancelField = void 0; + } + function cancellationPropagateFrom(parent, flags) { + if ((flags & 1) !== 0) { + this._cancellationParent = parent; + var branchesRemainingToCancel = parent._branchesRemainingToCancel; + if (branchesRemainingToCancel === void 0) { + branchesRemainingToCancel = 0; + } + parent._branchesRemainingToCancel = branchesRemainingToCancel + 1; + } + if ((flags & 2) !== 0 && parent._isBound()) { + this._setBoundTo(parent._boundTo); + } + } + function bindingPropagateFrom(parent, flags) { + if ((flags & 2) !== 0 && parent._isBound()) { + this._setBoundTo(parent._boundTo); + } + } + var propagateFromFunction = bindingPropagateFrom; + function boundValueFunction() { + var ret2 = this._boundTo; + if (ret2 !== void 0) { + if (ret2 instanceof Promise2) { + if (ret2.isFulfilled()) { + return ret2.value(); + } else { + return void 0; + } + } + } + return ret2; + } + function longStackTracesCaptureStackTrace() { + this._trace = new CapturedTrace(this._peekContext()); + } + function longStackTracesAttachExtraTrace(error, ignoreSelf) { + if (canAttachTrace2(error)) { + var trace = this._trace; + if (trace !== void 0) { + if (ignoreSelf) + trace = trace._parent; + } + if (trace !== void 0) { + trace.attachExtraTrace(error); + } else if (!error.__stackCleaned__) { + var parsed = parseStackAndMessage(error); + util.notEnumerableProp(error, "stack", parsed.message + "\n" + parsed.stack.join("\n")); + util.notEnumerableProp(error, "__stackCleaned__", true); + } + } + } + function checkForgottenReturns(returnValue, promiseCreated, name, promise, parent) { + if (returnValue === void 0 && promiseCreated !== null && wForgottenReturn) { + if (parent !== void 0 && parent._returnedNonUndefined()) + return; + if ((promise._bitField & 65535) === 0) + return; + if (name) + name = name + " "; + var handlerLine = ""; + var creatorLine = ""; + if (promiseCreated._trace) { + var traceLines = promiseCreated._trace.stack.split("\n"); + var stack = cleanStack(traceLines); + for (var i = stack.length - 1; i >= 0; --i) { + var line = stack[i]; + if (!nodeFramePattern.test(line)) { + var lineMatches = line.match(parseLinePattern); + if (lineMatches) { + handlerLine = "at " + lineMatches[1] + ":" + lineMatches[2] + ":" + lineMatches[3] + " "; + } + break; + } + } + if (stack.length > 0) { + var firstUserLine = stack[0]; + for (var i = 0; i < traceLines.length; ++i) { + if (traceLines[i] === firstUserLine) { + if (i > 0) { + creatorLine = "\n" + traceLines[i - 1]; + } + break; + } + } + } + } + var msg = "a promise was created in a " + name + "handler " + handlerLine + "but was not returned from it, see http://goo.gl/rRqMUw" + creatorLine; + promise._warn(msg, true, promiseCreated); + } + } + function deprecated(name, replacement) { + var message = name + " is deprecated and will be removed in a future version."; + if (replacement) + message += " Use " + replacement + " instead."; + return warn(message); + } + function warn(message, shouldUseOwnTrace, promise) { + if (!config.warnings) + return; + var warning = new Warning(message); + var ctx; + if (shouldUseOwnTrace) { + promise._attachExtraTrace(warning); + } else if (config.longStackTraces && (ctx = Promise2._peekContext())) { + ctx.attachExtraTrace(warning); + } else { + var parsed = parseStackAndMessage(warning); + warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); + } + if (!activeFireEvent("warning", warning)) { + formatAndLogError(warning, "", true); + } + } + function reconstructStack(message, stacks) { + for (var i = 0; i < stacks.length - 1; ++i) { + stacks[i].push("From previous event:"); + stacks[i] = stacks[i].join("\n"); + } + if (i < stacks.length) { + stacks[i] = stacks[i].join("\n"); + } + return message + "\n" + stacks.join("\n"); + } + function removeDuplicateOrEmptyJumps(stacks) { + for (var i = 0; i < stacks.length; ++i) { + if (stacks[i].length === 0 || i + 1 < stacks.length && stacks[i][0] === stacks[i + 1][0]) { + stacks.splice(i, 1); + i--; + } + } + } + function removeCommonRoots(stacks) { + var current = stacks[0]; + for (var i = 1; i < stacks.length; ++i) { + var prev = stacks[i]; + var currentLastIndex = current.length - 1; + var currentLastLine = current[currentLastIndex]; + var commonRootMeetPoint = -1; + for (var j = prev.length - 1; j >= 0; --j) { + if (prev[j] === currentLastLine) { + commonRootMeetPoint = j; + break; + } + } + for (var j = commonRootMeetPoint; j >= 0; --j) { + var line = prev[j]; + if (current[currentLastIndex] === line) { + current.pop(); + currentLastIndex--; + } else { + break; + } + } + current = prev; + } + } + function cleanStack(stack) { + var ret2 = []; + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + var isTraceLine = line === " (No stack trace)" || stackFramePattern.test(line); + var isInternalFrame = isTraceLine && shouldIgnore(line); + if (isTraceLine && !isInternalFrame) { + if (indentStackFrames && line.charAt(0) !== " ") { + line = " " + line; + } + ret2.push(line); + } + } + return ret2; + } + function stackFramesAsArray(error) { + var stack = error.stack.replace(/\s+$/g, "").split("\n"); + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + if (line === " (No stack trace)" || stackFramePattern.test(line)) { + break; + } + } + if (i > 0 && error.name != "SyntaxError") { + stack = stack.slice(i); + } + return stack; + } + function parseStackAndMessage(error) { + var stack = error.stack; + var message = error.toString(); + stack = typeof stack === "string" && stack.length > 0 ? stackFramesAsArray(error) : [" (No stack trace)"]; + return { + message, + stack: error.name == "SyntaxError" ? stack : cleanStack(stack) + }; + } + function formatAndLogError(error, title, isSoft) { + if (typeof console !== "undefined") { + var message; + if (util.isObject(error)) { + var stack = error.stack; + message = title + formatStack(stack, error); + } else { + message = title + String(error); + } + if (typeof printWarning === "function") { + printWarning(message, isSoft); + } else if (typeof console.log === "function" || typeof console.log === "object") { + console.log(message); + } + } + } + function fireRejectionEvent(name, localHandler, reason, promise) { + var localEventFired = false; + try { + if (typeof localHandler === "function") { + localEventFired = true; + if (name === "rejectionHandled") { + localHandler(promise); + } else { + localHandler(reason, promise); + } + } + } catch (e) { + async.throwLater(e); + } + if (name === "unhandledRejection") { + if (!activeFireEvent(name, reason, promise) && !localEventFired) { + formatAndLogError(reason, "Unhandled rejection "); + } + } else { + activeFireEvent(name, promise); + } + } + function formatNonError(obj) { + var str; + if (typeof obj === "function") { + str = "[function " + (obj.name || "anonymous") + "]"; + } else { + str = obj && typeof obj.toString === "function" ? obj.toString() : util.toString(obj); + var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; + if (ruselessToString.test(str)) { + try { + var newStr = JSON.stringify(obj); + str = newStr; + } catch (e) { + } + } + if (str.length === 0) { + str = "(empty array)"; + } + } + return "(<" + snip(str) + ">, no stack trace)"; + } + function snip(str) { + var maxChars = 41; + if (str.length < maxChars) { + return str; + } + return str.substr(0, maxChars - 3) + "..."; + } + function longStackTracesIsSupported() { + return typeof captureStackTrace === "function"; + } + var shouldIgnore = function() { + return false; + }; + var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; + function parseLineInfo(line) { + var matches = line.match(parseLineInfoRegex); + if (matches) { + return { + fileName: matches[1], + line: parseInt(matches[2], 10) + }; + } + } + function setBounds(firstLineError, lastLineError) { + if (!longStackTracesIsSupported()) + return; + var firstStackLines = firstLineError.stack.split("\n"); + var lastStackLines = lastLineError.stack.split("\n"); + var firstIndex = -1; + var lastIndex = -1; + var firstFileName; + var lastFileName; + for (var i = 0; i < firstStackLines.length; ++i) { + var result = parseLineInfo(firstStackLines[i]); + if (result) { + firstFileName = result.fileName; + firstIndex = result.line; + break; + } + } + for (var i = 0; i < lastStackLines.length; ++i) { + var result = parseLineInfo(lastStackLines[i]); + if (result) { + lastFileName = result.fileName; + lastIndex = result.line; + break; + } + } + if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || firstFileName !== lastFileName || firstIndex >= lastIndex) { + return; + } + shouldIgnore = function(line) { + if (bluebirdFramePattern.test(line)) + return true; + var info = parseLineInfo(line); + if (info) { + if (info.fileName === firstFileName && (firstIndex <= info.line && info.line <= lastIndex)) { + return true; + } + } + return false; + }; + } + function CapturedTrace(parent) { + this._parent = parent; + this._promisesCreated = 0; + var length = this._length = 1 + (parent === void 0 ? 0 : parent._length); + captureStackTrace(this, CapturedTrace); + if (length > 32) + this.uncycle(); + } + util.inherits(CapturedTrace, Error); + Context.CapturedTrace = CapturedTrace; + CapturedTrace.prototype.uncycle = function() { + var length = this._length; + if (length < 2) + return; + var nodes = []; + var stackToIndex = {}; + for (var i = 0, node = this; node !== void 0; ++i) { + nodes.push(node); + node = node._parent; + } + length = this._length = i; + for (var i = length - 1; i >= 0; --i) { + var stack = nodes[i].stack; + if (stackToIndex[stack] === void 0) { + stackToIndex[stack] = i; + } + } + for (var i = 0; i < length; ++i) { + var currentStack = nodes[i].stack; + var index = stackToIndex[currentStack]; + if (index !== void 0 && index !== i) { + if (index > 0) { + nodes[index - 1]._parent = void 0; + nodes[index - 1]._length = 1; + } + nodes[i]._parent = void 0; + nodes[i]._length = 1; + var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; + if (index < length - 1) { + cycleEdgeNode._parent = nodes[index + 1]; + cycleEdgeNode._parent.uncycle(); + cycleEdgeNode._length = cycleEdgeNode._parent._length + 1; + } else { + cycleEdgeNode._parent = void 0; + cycleEdgeNode._length = 1; + } + var currentChildLength = cycleEdgeNode._length + 1; + for (var j = i - 2; j >= 0; --j) { + nodes[j]._length = currentChildLength; + currentChildLength++; + } + return; + } + } + }; + CapturedTrace.prototype.attachExtraTrace = function(error) { + if (error.__stackCleaned__) + return; + this.uncycle(); + var parsed = parseStackAndMessage(error); + var message = parsed.message; + var stacks = [parsed.stack]; + var trace = this; + while (trace !== void 0) { + stacks.push(cleanStack(trace.stack.split("\n"))); + trace = trace._parent; + } + removeCommonRoots(stacks); + removeDuplicateOrEmptyJumps(stacks); + util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); + util.notEnumerableProp(error, "__stackCleaned__", true); + }; + var captureStackTrace = function stackDetection() { + var v8stackFramePattern = /^\s*at\s*/; + var v8stackFormatter = function(stack, error) { + if (typeof stack === "string") + return stack; + if (error.name !== void 0 && error.message !== void 0) { + return error.toString(); + } + return formatNonError(error); + }; + if (typeof Error.stackTraceLimit === "number" && typeof Error.captureStackTrace === "function") { + Error.stackTraceLimit += 6; + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + var captureStackTrace2 = Error.captureStackTrace; + shouldIgnore = function(line) { + return bluebirdFramePattern.test(line); + }; + return function(receiver, ignoreUntil) { + Error.stackTraceLimit += 6; + captureStackTrace2(receiver, ignoreUntil); + Error.stackTraceLimit -= 6; + }; + } + var err = new Error(); + if (typeof err.stack === "string" && err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { + stackFramePattern = /@/; + formatStack = v8stackFormatter; + indentStackFrames = true; + return function captureStackTrace3(o) { + o.stack = new Error().stack; + }; + } + var hasStackAfterThrow; + try { + throw new Error(); + } catch (e) { + hasStackAfterThrow = "stack" in e; + } + if (!("stack" in err) && hasStackAfterThrow && typeof Error.stackTraceLimit === "number") { + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + return function captureStackTrace3(o) { + Error.stackTraceLimit += 6; + try { + throw new Error(); + } catch (e) { + o.stack = e.stack; + } + Error.stackTraceLimit -= 6; + }; + } + formatStack = function(stack, error) { + if (typeof stack === "string") + return stack; + if ((typeof error === "object" || typeof error === "function") && error.name !== void 0 && error.message !== void 0) { + return error.toString(); + } + return formatNonError(error); + }; + return null; + }([]); + if (typeof console !== "undefined" && typeof console.warn !== "undefined") { + printWarning = function(message) { + console.warn(message); + }; + if (util.isNode && process.stderr.isTTY) { + printWarning = function(message, isSoft) { + var color = isSoft ? "" : ""; + console.warn(color + message + "\n"); + }; + } else if (!util.isNode && typeof new Error().stack === "string") { + printWarning = function(message, isSoft) { + console.warn("%c" + message, isSoft ? "color: darkorange" : "color: red"); + }; + } + } + var config = { + warnings, + longStackTraces: false, + cancellation: false, + monitoring: false + }; + if (longStackTraces) + Promise2.longStackTraces(); + return { + longStackTraces: function() { + return config.longStackTraces; + }, + warnings: function() { + return config.warnings; + }, + cancellation: function() { + return config.cancellation; + }, + monitoring: function() { + return config.monitoring; + }, + propagateFromFunction: function() { + return propagateFromFunction; + }, + boundValueFunction: function() { + return boundValueFunction; + }, + checkForgottenReturns, + setBounds, + warn, + deprecated, + CapturedTrace, + fireDomEvent, + fireGlobalEvent + }; + }; +}); + +// node_modules/bluebird/js/release/finally.js +var require_finally = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, tryConvertToPromise) { + var util = require_util(); + var CancellationError = Promise2.CancellationError; + var errorObj2 = util.errorObj; + function PassThroughHandlerContext(promise, type, handler) { + this.promise = promise; + this.type = type; + this.handler = handler; + this.called = false; + this.cancelPromise = null; + } + PassThroughHandlerContext.prototype.isFinallyHandler = function() { + return this.type === 0; + }; + function FinallyHandlerCancelReaction(finallyHandler2) { + this.finallyHandler = finallyHandler2; + } + FinallyHandlerCancelReaction.prototype._resultCancelled = function() { + checkCancel(this.finallyHandler); + }; + function checkCancel(ctx, reason) { + if (ctx.cancelPromise != null) { + if (arguments.length > 1) { + ctx.cancelPromise._reject(reason); + } else { + ctx.cancelPromise._cancel(); + } + ctx.cancelPromise = null; + return true; + } + return false; + } + function succeed() { + return finallyHandler.call(this, this.promise._target()._settledValue()); + } + function fail(reason) { + if (checkCancel(this, reason)) + return; + errorObj2.e = reason; + return errorObj2; + } + function finallyHandler(reasonOrValue) { + var promise = this.promise; + var handler = this.handler; + if (!this.called) { + this.called = true; + var ret2 = this.isFinallyHandler() ? handler.call(promise._boundValue()) : handler.call(promise._boundValue(), reasonOrValue); + if (ret2 !== void 0) { + promise._setReturnedNonUndefined(); + var maybePromise = tryConvertToPromise(ret2, promise); + if (maybePromise instanceof Promise2) { + if (this.cancelPromise != null) { + if (maybePromise._isCancelled()) { + var reason = new CancellationError("late cancellation observer"); + promise._attachExtraTrace(reason); + errorObj2.e = reason; + return errorObj2; + } else if (maybePromise.isPending()) { + maybePromise._attachCancellationCallback(new FinallyHandlerCancelReaction(this)); + } + } + return maybePromise._then(succeed, fail, void 0, this, void 0); + } + } + } + if (promise.isRejected()) { + checkCancel(this); + errorObj2.e = reasonOrValue; + return errorObj2; + } else { + checkCancel(this); + return reasonOrValue; + } + } + Promise2.prototype._passThrough = function(handler, type, success, fail2) { + if (typeof handler !== "function") + return this.then(); + return this._then(success, fail2, void 0, new PassThroughHandlerContext(this, type, handler), void 0); + }; + Promise2.prototype.lastly = Promise2.prototype["finally"] = function(handler) { + return this._passThrough(handler, 0, finallyHandler, finallyHandler); + }; + Promise2.prototype.tap = function(handler) { + return this._passThrough(handler, 1, finallyHandler); + }; + return PassThroughHandlerContext; + }; +}); + +// node_modules/bluebird/js/release/catch_filter.js +var require_catch_filter = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(NEXT_FILTER) { + var util = require_util(); + var getKeys = require_es5().keys; + var tryCatch2 = util.tryCatch; + var errorObj2 = util.errorObj; + function catchFilter(instances, cb, promise) { + return function(e) { + var boundTo = promise._boundValue(); + predicateLoop: + for (var i = 0; i < instances.length; ++i) { + var item = instances[i]; + if (item === Error || item != null && item.prototype instanceof Error) { + if (e instanceof item) { + return tryCatch2(cb).call(boundTo, e); + } + } else if (typeof item === "function") { + var matchesPredicate = tryCatch2(item).call(boundTo, e); + if (matchesPredicate === errorObj2) { + return matchesPredicate; + } else if (matchesPredicate) { + return tryCatch2(cb).call(boundTo, e); + } + } else if (util.isObject(e)) { + var keys = getKeys(item); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + if (item[key] != e[key]) { + continue predicateLoop; + } + } + return tryCatch2(cb).call(boundTo, e); + } + } + return NEXT_FILTER; + }; + } + return catchFilter; + }; +}); + +// node_modules/bluebird/js/release/nodeback.js +var require_nodeback = __commonJS((exports2, module2) => { + "use strict"; + var util = require_util(); + var maybeWrapAsError2 = util.maybeWrapAsError; + var errors = require_errors(); + var OperationalError = errors.OperationalError; + var es52 = require_es5(); + function isUntypedError(obj) { + return obj instanceof Error && es52.getPrototypeOf(obj) === Error.prototype; + } + var rErrorKey = /^(?:name|message|stack|cause)$/; + function wrapAsOperationalError(obj) { + var ret2; + if (isUntypedError(obj)) { + ret2 = new OperationalError(obj); + ret2.name = obj.name; + ret2.message = obj.message; + ret2.stack = obj.stack; + var keys = es52.keys(obj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!rErrorKey.test(key)) { + ret2[key] = obj[key]; + } + } + return ret2; + } + util.markAsOriginatingFromRejection(obj); + return obj; + } + function nodebackForPromise(promise, multiArgs) { + return function(err, value) { + if (promise === null) + return; + if (err) { + var wrapped = wrapAsOperationalError(maybeWrapAsError2(err)); + promise._attachExtraTrace(wrapped); + promise._reject(wrapped); + } else if (!multiArgs) { + promise._fulfill(value); + } else { + var $_len = arguments.length; + var args = new Array(Math.max($_len - 1, 0)); + for (var $_i = 1; $_i < $_len; ++$_i) { + args[$_i - 1] = arguments[$_i]; + } + ; + promise._fulfill(args); + } + promise = null; + }; + } + module2.exports = nodebackForPromise; +}); + +// node_modules/bluebird/js/release/method.js +var require_method = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, INTERNAL, tryConvertToPromise, apiRejection, debug) { + var util = require_util(); + var tryCatch2 = util.tryCatch; + Promise2.method = function(fn) { + if (typeof fn !== "function") { + throw new Promise2.TypeError("expecting a function but got " + util.classString(fn)); + } + return function() { + var ret2 = new Promise2(INTERNAL); + ret2._captureStackTrace(); + ret2._pushContext(); + var value = tryCatch2(fn).apply(this, arguments); + var promiseCreated = ret2._popContext(); + debug.checkForgottenReturns(value, promiseCreated, "Promise.method", ret2); + ret2._resolveFromSyncValue(value); + return ret2; + }; + }; + Promise2.attempt = Promise2["try"] = function(fn) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var ret2 = new Promise2(INTERNAL); + ret2._captureStackTrace(); + ret2._pushContext(); + var value; + if (arguments.length > 1) { + debug.deprecated("calling Promise.try with more than 1 argument"); + var arg = arguments[1]; + var ctx = arguments[2]; + value = util.isArray(arg) ? tryCatch2(fn).apply(ctx, arg) : tryCatch2(fn).call(ctx, arg); + } else { + value = tryCatch2(fn)(); + } + var promiseCreated = ret2._popContext(); + debug.checkForgottenReturns(value, promiseCreated, "Promise.try", ret2); + ret2._resolveFromSyncValue(value); + return ret2; + }; + Promise2.prototype._resolveFromSyncValue = function(value) { + if (value === util.errorObj) { + this._rejectCallback(value.e, false); + } else { + this._resolveCallback(value, true); + } + }; + }; +}); + +// node_modules/bluebird/js/release/bind.js +var require_bind = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, INTERNAL, tryConvertToPromise, debug) { + var calledBind = false; + var rejectThis = function(_, e) { + this._reject(e); + }; + var targetRejected = function(e, context) { + context.promiseRejectionQueued = true; + context.bindingPromise._then(rejectThis, rejectThis, null, this, e); + }; + var bindingResolved = function(thisArg, context) { + if ((this._bitField & 50397184) === 0) { + this._resolveCallback(context.target); + } + }; + var bindingRejected = function(e, context) { + if (!context.promiseRejectionQueued) + this._reject(e); + }; + Promise2.prototype.bind = function(thisArg) { + if (!calledBind) { + calledBind = true; + Promise2.prototype._propagateFrom = debug.propagateFromFunction(); + Promise2.prototype._boundValue = debug.boundValueFunction(); + } + var maybePromise = tryConvertToPromise(thisArg); + var ret2 = new Promise2(INTERNAL); + ret2._propagateFrom(this, 1); + var target = this._target(); + ret2._setBoundTo(maybePromise); + if (maybePromise instanceof Promise2) { + var context = { + promiseRejectionQueued: false, + promise: ret2, + target, + bindingPromise: maybePromise + }; + target._then(INTERNAL, targetRejected, void 0, ret2, context); + maybePromise._then(bindingResolved, bindingRejected, void 0, ret2, context); + ret2._setOnCancel(maybePromise); + } else { + ret2._resolveCallback(target); + } + return ret2; + }; + Promise2.prototype._setBoundTo = function(obj) { + if (obj !== void 0) { + this._bitField = this._bitField | 2097152; + this._boundTo = obj; + } else { + this._bitField = this._bitField & ~2097152; + } + }; + Promise2.prototype._isBound = function() { + return (this._bitField & 2097152) === 2097152; + }; + Promise2.bind = function(thisArg, value) { + return Promise2.resolve(value).bind(thisArg); + }; + }; +}); + +// node_modules/bluebird/js/release/cancel.js +var require_cancel = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, PromiseArray, apiRejection, debug) { + var util = require_util(); + var tryCatch2 = util.tryCatch; + var errorObj2 = util.errorObj; + var async = Promise2._async; + Promise2.prototype["break"] = Promise2.prototype.cancel = function() { + if (!debug.cancellation()) + return this._warn("cancellation is disabled"); + var promise = this; + var child = promise; + while (promise._isCancellable()) { + if (!promise._cancelBy(child)) { + if (child._isFollowing()) { + child._followee().cancel(); + } else { + child._cancelBranched(); + } + break; + } + var parent = promise._cancellationParent; + if (parent == null || !parent._isCancellable()) { + if (promise._isFollowing()) { + promise._followee().cancel(); + } else { + promise._cancelBranched(); + } + break; + } else { + if (promise._isFollowing()) + promise._followee().cancel(); + promise._setWillBeCancelled(); + child = promise; + promise = parent; + } + } + }; + Promise2.prototype._branchHasCancelled = function() { + this._branchesRemainingToCancel--; + }; + Promise2.prototype._enoughBranchesHaveCancelled = function() { + return this._branchesRemainingToCancel === void 0 || this._branchesRemainingToCancel <= 0; + }; + Promise2.prototype._cancelBy = function(canceller) { + if (canceller === this) { + this._branchesRemainingToCancel = 0; + this._invokeOnCancel(); + return true; + } else { + this._branchHasCancelled(); + if (this._enoughBranchesHaveCancelled()) { + this._invokeOnCancel(); + return true; + } + } + return false; + }; + Promise2.prototype._cancelBranched = function() { + if (this._enoughBranchesHaveCancelled()) { + this._cancel(); + } + }; + Promise2.prototype._cancel = function() { + if (!this._isCancellable()) + return; + this._setCancelled(); + async.invoke(this._cancelPromises, this, void 0); + }; + Promise2.prototype._cancelPromises = function() { + if (this._length() > 0) + this._settlePromises(); + }; + Promise2.prototype._unsetOnCancel = function() { + this._onCancelField = void 0; + }; + Promise2.prototype._isCancellable = function() { + return this.isPending() && !this._isCancelled(); + }; + Promise2.prototype.isCancellable = function() { + return this.isPending() && !this.isCancelled(); + }; + Promise2.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) { + if (util.isArray(onCancelCallback)) { + for (var i = 0; i < onCancelCallback.length; ++i) { + this._doInvokeOnCancel(onCancelCallback[i], internalOnly); + } + } else if (onCancelCallback !== void 0) { + if (typeof onCancelCallback === "function") { + if (!internalOnly) { + var e = tryCatch2(onCancelCallback).call(this._boundValue()); + if (e === errorObj2) { + this._attachExtraTrace(e.e); + async.throwLater(e.e); + } + } + } else { + onCancelCallback._resultCancelled(this); + } + } + }; + Promise2.prototype._invokeOnCancel = function() { + var onCancelCallback = this._onCancel(); + this._unsetOnCancel(); + async.invoke(this._doInvokeOnCancel, this, onCancelCallback); + }; + Promise2.prototype._invokeInternalOnCancel = function() { + if (this._isCancellable()) { + this._doInvokeOnCancel(this._onCancel(), true); + this._unsetOnCancel(); + } + }; + Promise2.prototype._resultCancelled = function() { + this.cancel(); + }; + }; +}); + +// node_modules/bluebird/js/release/direct_resolve.js +var require_direct_resolve = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2) { + function returner() { + return this.value; + } + function thrower2() { + throw this.reason; + } + Promise2.prototype["return"] = Promise2.prototype.thenReturn = function(value) { + if (value instanceof Promise2) + value.suppressUnhandledRejections(); + return this._then(returner, void 0, void 0, {value}, void 0); + }; + Promise2.prototype["throw"] = Promise2.prototype.thenThrow = function(reason) { + return this._then(thrower2, void 0, void 0, {reason}, void 0); + }; + Promise2.prototype.catchThrow = function(reason) { + if (arguments.length <= 1) { + return this._then(void 0, thrower2, void 0, {reason}, void 0); + } else { + var _reason = arguments[1]; + var handler = function() { + throw _reason; + }; + return this.caught(reason, handler); + } + }; + Promise2.prototype.catchReturn = function(value) { + if (arguments.length <= 1) { + if (value instanceof Promise2) + value.suppressUnhandledRejections(); + return this._then(void 0, returner, void 0, {value}, void 0); + } else { + var _value = arguments[1]; + if (_value instanceof Promise2) + _value.suppressUnhandledRejections(); + var handler = function() { + return _value; + }; + return this.caught(value, handler); + } + }; + }; +}); + +// node_modules/bluebird/js/release/synchronous_inspection.js +var require_synchronous_inspection = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2) { + function PromiseInspection(promise) { + if (promise !== void 0) { + promise = promise._target(); + this._bitField = promise._bitField; + this._settledValueField = promise._isFateSealed() ? promise._settledValue() : void 0; + } else { + this._bitField = 0; + this._settledValueField = void 0; + } + } + PromiseInspection.prototype._settledValue = function() { + return this._settledValueField; + }; + var value = PromiseInspection.prototype.value = function() { + if (!this.isFulfilled()) { + throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n"); + } + return this._settledValue(); + }; + var reason = PromiseInspection.prototype.error = PromiseInspection.prototype.reason = function() { + if (!this.isRejected()) { + throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n"); + } + return this._settledValue(); + }; + var isFulfilled = PromiseInspection.prototype.isFulfilled = function() { + return (this._bitField & 33554432) !== 0; + }; + var isRejected = PromiseInspection.prototype.isRejected = function() { + return (this._bitField & 16777216) !== 0; + }; + var isPending = PromiseInspection.prototype.isPending = function() { + return (this._bitField & 50397184) === 0; + }; + var isResolved = PromiseInspection.prototype.isResolved = function() { + return (this._bitField & 50331648) !== 0; + }; + PromiseInspection.prototype.isCancelled = function() { + return (this._bitField & 8454144) !== 0; + }; + Promise2.prototype.__isCancelled = function() { + return (this._bitField & 65536) === 65536; + }; + Promise2.prototype._isCancelled = function() { + return this._target().__isCancelled(); + }; + Promise2.prototype.isCancelled = function() { + return (this._target()._bitField & 8454144) !== 0; + }; + Promise2.prototype.isPending = function() { + return isPending.call(this._target()); + }; + Promise2.prototype.isRejected = function() { + return isRejected.call(this._target()); + }; + Promise2.prototype.isFulfilled = function() { + return isFulfilled.call(this._target()); + }; + Promise2.prototype.isResolved = function() { + return isResolved.call(this._target()); + }; + Promise2.prototype.value = function() { + return value.call(this._target()); + }; + Promise2.prototype.reason = function() { + var target = this._target(); + target._unsetRejectionIsUnhandled(); + return reason.call(target); + }; + Promise2.prototype._value = function() { + return this._settledValue(); + }; + Promise2.prototype._reason = function() { + this._unsetRejectionIsUnhandled(); + return this._settledValue(); + }; + Promise2.PromiseInspection = PromiseInspection; + }; +}); + +// node_modules/bluebird/js/release/join.js +var require_join = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain) { + var util = require_util(); + var canEvaluate2 = util.canEvaluate; + var tryCatch2 = util.tryCatch; + var errorObj2 = util.errorObj; + var reject; + if (true) { + if (canEvaluate2) { + var thenCallback = function(i2) { + return new Function("value", "holder", " \n 'use strict'; \n holder.pIndex = value; \n holder.checkFulfillment(this); \n ".replace(/Index/g, i2)); + }; + var promiseSetter = function(i2) { + return new Function("promise", "holder", " \n 'use strict'; \n holder.pIndex = promise; \n ".replace(/Index/g, i2)); + }; + var generateHolderClass = function(total) { + var props = new Array(total); + for (var i2 = 0; i2 < props.length; ++i2) { + props[i2] = "this.p" + (i2 + 1); + } + var assignment = props.join(" = ") + " = null;"; + var cancellationCode = "var promise;\n" + props.map(function(prop) { + return " \n promise = " + prop + "; \n if (promise instanceof Promise) { \n promise.cancel(); \n } \n "; + }).join("\n"); + var passedArguments = props.join(", "); + var name = "Holder$" + total; + var code = "return function(tryCatch, errorObj, Promise, async) { \n 'use strict'; \n function [TheName](fn) { \n [TheProperties] \n this.fn = fn; \n this.asyncNeeded = true; \n this.now = 0; \n } \n \n [TheName].prototype._callFunction = function(promise) { \n promise._pushContext(); \n var ret = tryCatch(this.fn)([ThePassedArguments]); \n promise._popContext(); \n if (ret === errorObj) { \n promise._rejectCallback(ret.e, false); \n } else { \n promise._resolveCallback(ret); \n } \n }; \n \n [TheName].prototype.checkFulfillment = function(promise) { \n var now = ++this.now; \n if (now === [TheTotal]) { \n if (this.asyncNeeded) { \n async.invoke(this._callFunction, this, promise); \n } else { \n this._callFunction(promise); \n } \n \n } \n }; \n \n [TheName].prototype._resultCancelled = function() { \n [CancellationCode] \n }; \n \n return [TheName]; \n }(tryCatch, errorObj, Promise, async); \n "; + code = code.replace(/\[TheName\]/g, name).replace(/\[TheTotal\]/g, total).replace(/\[ThePassedArguments\]/g, passedArguments).replace(/\[TheProperties\]/g, assignment).replace(/\[CancellationCode\]/g, cancellationCode); + return new Function("tryCatch", "errorObj", "Promise", "async", code)(tryCatch2, errorObj2, Promise2, async); + }; + var holderClasses = []; + var thenCallbacks = []; + var promiseSetters = []; + for (var i = 0; i < 8; ++i) { + holderClasses.push(generateHolderClass(i + 1)); + thenCallbacks.push(thenCallback(i + 1)); + promiseSetters.push(promiseSetter(i + 1)); + } + reject = function(reason) { + this._reject(reason); + }; + } + } + Promise2.join = function() { + var last = arguments.length - 1; + var fn; + if (last > 0 && typeof arguments[last] === "function") { + fn = arguments[last]; + if (true) { + if (last <= 8 && canEvaluate2) { + var ret2 = new Promise2(INTERNAL); + ret2._captureStackTrace(); + var HolderClass = holderClasses[last - 1]; + var holder = new HolderClass(fn); + var callbacks = thenCallbacks; + for (var i2 = 0; i2 < last; ++i2) { + var maybePromise = tryConvertToPromise(arguments[i2], ret2); + if (maybePromise instanceof Promise2) { + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if ((bitField & 50397184) === 0) { + maybePromise._then(callbacks[i2], reject, void 0, ret2, holder); + promiseSetters[i2](maybePromise, holder); + holder.asyncNeeded = false; + } else if ((bitField & 33554432) !== 0) { + callbacks[i2].call(ret2, maybePromise._value(), holder); + } else if ((bitField & 16777216) !== 0) { + ret2._reject(maybePromise._reason()); + } else { + ret2._cancel(); + } + } else { + callbacks[i2].call(ret2, maybePromise, holder); + } + } + if (!ret2._isFateSealed()) { + if (holder.asyncNeeded) { + var domain = getDomain(); + if (domain !== null) { + holder.fn = util.domainBind(domain, holder.fn); + } + } + ret2._setAsyncGuaranteed(); + ret2._setOnCancel(holder); + } + return ret2; + } + } + } + var $_len = arguments.length; + var args = new Array($_len); + for (var $_i = 0; $_i < $_len; ++$_i) { + args[$_i] = arguments[$_i]; + } + ; + if (fn) + args.pop(); + var ret2 = new PromiseArray(args).promise(); + return fn !== void 0 ? ret2.spread(fn) : ret2; + }; + }; +}); + +// node_modules/bluebird/js/release/map.js +var require_map = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug) { + var getDomain = Promise2._getDomain; + var util = require_util(); + var tryCatch2 = util.tryCatch; + var errorObj2 = util.errorObj; + var async = Promise2._async; + function MappingPromiseArray(promises, fn, limit, _filter) { + this.constructor$(promises); + this._promise._captureStackTrace(); + var domain = getDomain(); + this._callback = domain === null ? fn : util.domainBind(domain, fn); + this._preservedValues = _filter === INTERNAL ? new Array(this.length()) : null; + this._limit = limit; + this._inFlight = 0; + this._queue = []; + async.invoke(this._asyncInit, this, void 0); + } + util.inherits(MappingPromiseArray, PromiseArray); + MappingPromiseArray.prototype._asyncInit = function() { + this._init$(void 0, -2); + }; + MappingPromiseArray.prototype._init = function() { + }; + MappingPromiseArray.prototype._promiseFulfilled = function(value, index) { + var values = this._values; + var length = this.length(); + var preservedValues = this._preservedValues; + var limit = this._limit; + if (index < 0) { + index = index * -1 - 1; + values[index] = value; + if (limit >= 1) { + this._inFlight--; + this._drainQueue(); + if (this._isResolved()) + return true; + } + } else { + if (limit >= 1 && this._inFlight >= limit) { + values[index] = value; + this._queue.push(index); + return false; + } + if (preservedValues !== null) + preservedValues[index] = value; + var promise = this._promise; + var callback = this._callback; + var receiver = promise._boundValue(); + promise._pushContext(); + var ret2 = tryCatch2(callback).call(receiver, value, index, length); + var promiseCreated = promise._popContext(); + debug.checkForgottenReturns(ret2, promiseCreated, preservedValues !== null ? "Promise.filter" : "Promise.map", promise); + if (ret2 === errorObj2) { + this._reject(ret2.e); + return true; + } + var maybePromise = tryConvertToPromise(ret2, this._promise); + if (maybePromise instanceof Promise2) { + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if ((bitField & 50397184) === 0) { + if (limit >= 1) + this._inFlight++; + values[index] = maybePromise; + maybePromise._proxy(this, (index + 1) * -1); + return false; + } else if ((bitField & 33554432) !== 0) { + ret2 = maybePromise._value(); + } else if ((bitField & 16777216) !== 0) { + this._reject(maybePromise._reason()); + return true; + } else { + this._cancel(); + return true; + } + } + values[index] = ret2; + } + var totalResolved = ++this._totalResolved; + if (totalResolved >= length) { + if (preservedValues !== null) { + this._filter(values, preservedValues); + } else { + this._resolve(values); + } + return true; + } + return false; + }; + MappingPromiseArray.prototype._drainQueue = function() { + var queue = this._queue; + var limit = this._limit; + var values = this._values; + while (queue.length > 0 && this._inFlight < limit) { + if (this._isResolved()) + return; + var index = queue.pop(); + this._promiseFulfilled(values[index], index); + } + }; + MappingPromiseArray.prototype._filter = function(booleans, values) { + var len = values.length; + var ret2 = new Array(len); + var j = 0; + for (var i = 0; i < len; ++i) { + if (booleans[i]) + ret2[j++] = values[i]; + } + ret2.length = j; + this._resolve(ret2); + }; + MappingPromiseArray.prototype.preservedValues = function() { + return this._preservedValues; + }; + function map(promises, fn, options, _filter) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var limit = 0; + if (options !== void 0) { + if (typeof options === "object" && options !== null) { + if (typeof options.concurrency !== "number") { + return Promise2.reject(new TypeError("'concurrency' must be a number but it is " + util.classString(options.concurrency))); + } + limit = options.concurrency; + } else { + return Promise2.reject(new TypeError("options argument must be an object but it is " + util.classString(options))); + } + } + limit = typeof limit === "number" && isFinite(limit) && limit >= 1 ? limit : 0; + return new MappingPromiseArray(promises, fn, limit, _filter).promise(); + } + Promise2.prototype.map = function(fn, options) { + return map(this, fn, options, null); + }; + Promise2.map = function(promises, fn, options, _filter) { + return map(promises, fn, options, _filter); + }; + }; +}); + +// node_modules/bluebird/js/release/call_get.js +var require_call_get = __commonJS((exports2, module2) => { + "use strict"; + var cr = Object.create; + if (cr) { + callerCache = cr(null); + getterCache = cr(null); + callerCache[" size"] = getterCache[" size"] = 0; + } + var callerCache; + var getterCache; + module2.exports = function(Promise2) { + var util = require_util(); + var canEvaluate2 = util.canEvaluate; + var isIdentifier2 = util.isIdentifier; + var getMethodCaller; + var getGetter; + if (true) { + var makeMethodCaller = function(methodName) { + return new Function("ensureMethod", " \n return function(obj) { \n 'use strict' \n var len = this.length; \n ensureMethod(obj, 'methodName'); \n switch(len) { \n case 1: return obj.methodName(this[0]); \n case 2: return obj.methodName(this[0], this[1]); \n case 3: return obj.methodName(this[0], this[1], this[2]); \n case 0: return obj.methodName(); \n default: \n return obj.methodName.apply(obj, this); \n } \n }; \n ".replace(/methodName/g, methodName))(ensureMethod); + }; + var makeGetter = function(propertyName) { + return new Function("obj", " \n 'use strict'; \n return obj.propertyName; \n ".replace("propertyName", propertyName)); + }; + var getCompiled = function(name, compiler, cache) { + var ret2 = cache[name]; + if (typeof ret2 !== "function") { + if (!isIdentifier2(name)) { + return null; + } + ret2 = compiler(name); + cache[name] = ret2; + cache[" size"]++; + if (cache[" size"] > 512) { + var keys = Object.keys(cache); + for (var i = 0; i < 256; ++i) + delete cache[keys[i]]; + cache[" size"] = keys.length - 256; + } + } + return ret2; + }; + getMethodCaller = function(name) { + return getCompiled(name, makeMethodCaller, callerCache); + }; + getGetter = function(name) { + return getCompiled(name, makeGetter, getterCache); + }; + } + function ensureMethod(obj, methodName) { + var fn; + if (obj != null) + fn = obj[methodName]; + if (typeof fn !== "function") { + var message = "Object " + util.classString(obj) + " has no method '" + util.toString(methodName) + "'"; + throw new Promise2.TypeError(message); + } + return fn; + } + function caller(obj) { + var methodName = this.pop(); + var fn = ensureMethod(obj, methodName); + return fn.apply(obj, this); + } + Promise2.prototype.call = function(methodName) { + var $_len = arguments.length; + var args = new Array(Math.max($_len - 1, 0)); + for (var $_i = 1; $_i < $_len; ++$_i) { + args[$_i - 1] = arguments[$_i]; + } + ; + if (true) { + if (canEvaluate2) { + var maybeCaller = getMethodCaller(methodName); + if (maybeCaller !== null) { + return this._then(maybeCaller, void 0, void 0, args, void 0); + } + } + } + args.push(methodName); + return this._then(caller, void 0, void 0, args, void 0); + }; + function namedGetter(obj) { + return obj[this]; + } + function indexedGetter(obj) { + var index = +this; + if (index < 0) + index = Math.max(0, index + obj.length); + return obj[index]; + } + Promise2.prototype.get = function(propertyName) { + var isIndex = typeof propertyName === "number"; + var getter; + if (!isIndex) { + if (canEvaluate2) { + var maybeGetter = getGetter(propertyName); + getter = maybeGetter !== null ? maybeGetter : namedGetter; + } else { + getter = namedGetter; + } + } else { + getter = indexedGetter; + } + return this._then(getter, void 0, void 0, propertyName, void 0); + }; + }; +}); + +// node_modules/bluebird/js/release/using.js +var require_using = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug) { + var util = require_util(); + var TypeError2 = require_errors().TypeError; + var inherits2 = require_util().inherits; + var errorObj2 = util.errorObj; + var tryCatch2 = util.tryCatch; + var NULL = {}; + function thrower2(e) { + setTimeout(function() { + throw e; + }, 0); + } + function castPreservingDisposable(thenable) { + var maybePromise = tryConvertToPromise(thenable); + if (maybePromise !== thenable && typeof thenable._isDisposable === "function" && typeof thenable._getDisposer === "function" && thenable._isDisposable()) { + maybePromise._setDisposable(thenable._getDisposer()); + } + return maybePromise; + } + function dispose(resources, inspection) { + var i = 0; + var len = resources.length; + var ret2 = new Promise2(INTERNAL); + function iterator() { + if (i >= len) + return ret2._fulfill(); + var maybePromise = castPreservingDisposable(resources[i++]); + if (maybePromise instanceof Promise2 && maybePromise._isDisposable()) { + try { + maybePromise = tryConvertToPromise(maybePromise._getDisposer().tryDispose(inspection), resources.promise); + } catch (e) { + return thrower2(e); + } + if (maybePromise instanceof Promise2) { + return maybePromise._then(iterator, thrower2, null, null, null); + } + } + iterator(); + } + iterator(); + return ret2; + } + function Disposer(data, promise, context) { + this._data = data; + this._promise = promise; + this._context = context; + } + Disposer.prototype.data = function() { + return this._data; + }; + Disposer.prototype.promise = function() { + return this._promise; + }; + Disposer.prototype.resource = function() { + if (this.promise().isFulfilled()) { + return this.promise().value(); + } + return NULL; + }; + Disposer.prototype.tryDispose = function(inspection) { + var resource = this.resource(); + var context = this._context; + if (context !== void 0) + context._pushContext(); + var ret2 = resource !== NULL ? this.doDispose(resource, inspection) : null; + if (context !== void 0) + context._popContext(); + this._promise._unsetDisposable(); + this._data = null; + return ret2; + }; + Disposer.isDisposer = function(d) { + return d != null && typeof d.resource === "function" && typeof d.tryDispose === "function"; + }; + function FunctionDisposer(fn, promise, context) { + this.constructor$(fn, promise, context); + } + inherits2(FunctionDisposer, Disposer); + FunctionDisposer.prototype.doDispose = function(resource, inspection) { + var fn = this.data(); + return fn.call(resource, resource, inspection); + }; + function maybeUnwrapDisposer(value) { + if (Disposer.isDisposer(value)) { + this.resources[this.index]._setDisposable(value); + return value.promise(); + } + return value; + } + function ResourceList(length) { + this.length = length; + this.promise = null; + this[length - 1] = null; + } + ResourceList.prototype._resultCancelled = function() { + var len = this.length; + for (var i = 0; i < len; ++i) { + var item = this[i]; + if (item instanceof Promise2) { + item.cancel(); + } + } + }; + Promise2.using = function() { + var len = arguments.length; + if (len < 2) + return apiRejection("you must pass at least 2 arguments to Promise.using"); + var fn = arguments[len - 1]; + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var input; + var spreadArgs = true; + if (len === 2 && Array.isArray(arguments[0])) { + input = arguments[0]; + len = input.length; + spreadArgs = false; + } else { + input = arguments; + len--; + } + var resources = new ResourceList(len); + for (var i = 0; i < len; ++i) { + var resource = input[i]; + if (Disposer.isDisposer(resource)) { + var disposer = resource; + resource = resource.promise(); + resource._setDisposable(disposer); + } else { + var maybePromise = tryConvertToPromise(resource); + if (maybePromise instanceof Promise2) { + resource = maybePromise._then(maybeUnwrapDisposer, null, null, { + resources, + index: i + }, void 0); + } + } + resources[i] = resource; + } + var reflectedResources = new Array(resources.length); + for (var i = 0; i < reflectedResources.length; ++i) { + reflectedResources[i] = Promise2.resolve(resources[i]).reflect(); + } + var resultPromise = Promise2.all(reflectedResources).then(function(inspections) { + for (var i2 = 0; i2 < inspections.length; ++i2) { + var inspection = inspections[i2]; + if (inspection.isRejected()) { + errorObj2.e = inspection.error(); + return errorObj2; + } else if (!inspection.isFulfilled()) { + resultPromise.cancel(); + return; + } + inspections[i2] = inspection.value(); + } + promise._pushContext(); + fn = tryCatch2(fn); + var ret2 = spreadArgs ? fn.apply(void 0, inspections) : fn(inspections); + var promiseCreated = promise._popContext(); + debug.checkForgottenReturns(ret2, promiseCreated, "Promise.using", promise); + return ret2; + }); + var promise = resultPromise.lastly(function() { + var inspection = new Promise2.PromiseInspection(resultPromise); + return dispose(resources, inspection); + }); + resources.promise = promise; + promise._setOnCancel(resources); + return promise; + }; + Promise2.prototype._setDisposable = function(disposer) { + this._bitField = this._bitField | 131072; + this._disposer = disposer; + }; + Promise2.prototype._isDisposable = function() { + return (this._bitField & 131072) > 0; + }; + Promise2.prototype._getDisposer = function() { + return this._disposer; + }; + Promise2.prototype._unsetDisposable = function() { + this._bitField = this._bitField & ~131072; + this._disposer = void 0; + }; + Promise2.prototype.disposer = function(fn) { + if (typeof fn === "function") { + return new FunctionDisposer(fn, this, createContext()); + } + throw new TypeError2(); + }; + }; +}); + +// node_modules/bluebird/js/release/timers.js +var require_timers = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, INTERNAL, debug) { + var util = require_util(); + var TimeoutError = Promise2.TimeoutError; + function HandleWrapper(handle) { + this.handle = handle; + } + HandleWrapper.prototype._resultCancelled = function() { + clearTimeout(this.handle); + }; + var afterValue = function(value) { + return delay(+this).thenReturn(value); + }; + var delay = Promise2.delay = function(ms, value) { + var ret2; + var handle; + if (value !== void 0) { + ret2 = Promise2.resolve(value)._then(afterValue, null, null, ms, void 0); + if (debug.cancellation() && value instanceof Promise2) { + ret2._setOnCancel(value); + } + } else { + ret2 = new Promise2(INTERNAL); + handle = setTimeout(function() { + ret2._fulfill(); + }, +ms); + if (debug.cancellation()) { + ret2._setOnCancel(new HandleWrapper(handle)); + } + ret2._captureStackTrace(); + } + ret2._setAsyncGuaranteed(); + return ret2; + }; + Promise2.prototype.delay = function(ms) { + return delay(ms, this); + }; + var afterTimeout = function(promise, message, parent) { + var err; + if (typeof message !== "string") { + if (message instanceof Error) { + err = message; + } else { + err = new TimeoutError("operation timed out"); + } + } else { + err = new TimeoutError(message); + } + util.markAsOriginatingFromRejection(err); + promise._attachExtraTrace(err); + promise._reject(err); + if (parent != null) { + parent.cancel(); + } + }; + function successClear(value) { + clearTimeout(this.handle); + return value; + } + function failureClear(reason) { + clearTimeout(this.handle); + throw reason; + } + Promise2.prototype.timeout = function(ms, message) { + ms = +ms; + var ret2, parent; + var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() { + if (ret2.isPending()) { + afterTimeout(ret2, message, parent); + } + }, ms)); + if (debug.cancellation()) { + parent = this.then(); + ret2 = parent._then(successClear, failureClear, void 0, handleWrapper, void 0); + ret2._setOnCancel(handleWrapper); + } else { + ret2 = this._then(successClear, failureClear, void 0, handleWrapper, void 0); + } + return ret2; + }; + }; +}); + +// node_modules/bluebird/js/release/generators.js +var require_generators = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug) { + var errors = require_errors(); + var TypeError2 = errors.TypeError; + var util = require_util(); + var errorObj2 = util.errorObj; + var tryCatch2 = util.tryCatch; + var yieldHandlers = []; + function promiseFromYieldHandler(value, yieldHandlers2, traceParent) { + for (var i = 0; i < yieldHandlers2.length; ++i) { + traceParent._pushContext(); + var result = tryCatch2(yieldHandlers2[i])(value); + traceParent._popContext(); + if (result === errorObj2) { + traceParent._pushContext(); + var ret2 = Promise2.reject(errorObj2.e); + traceParent._popContext(); + return ret2; + } + var maybePromise = tryConvertToPromise(result, traceParent); + if (maybePromise instanceof Promise2) + return maybePromise; + } + return null; + } + function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { + if (debug.cancellation()) { + var internal = new Promise2(INTERNAL); + var _finallyPromise = this._finallyPromise = new Promise2(INTERNAL); + this._promise = internal.lastly(function() { + return _finallyPromise; + }); + internal._captureStackTrace(); + internal._setOnCancel(this); + } else { + var promise = this._promise = new Promise2(INTERNAL); + promise._captureStackTrace(); + } + this._stack = stack; + this._generatorFunction = generatorFunction; + this._receiver = receiver; + this._generator = void 0; + this._yieldHandlers = typeof yieldHandler === "function" ? [yieldHandler].concat(yieldHandlers) : yieldHandlers; + this._yieldedPromise = null; + this._cancellationPhase = false; + } + util.inherits(PromiseSpawn, Proxyable); + PromiseSpawn.prototype._isResolved = function() { + return this._promise === null; + }; + PromiseSpawn.prototype._cleanup = function() { + this._promise = this._generator = null; + if (debug.cancellation() && this._finallyPromise !== null) { + this._finallyPromise._fulfill(); + this._finallyPromise = null; + } + }; + PromiseSpawn.prototype._promiseCancelled = function() { + if (this._isResolved()) + return; + var implementsReturn = typeof this._generator["return"] !== "undefined"; + var result; + if (!implementsReturn) { + var reason = new Promise2.CancellationError("generator .return() sentinel"); + Promise2.coroutine.returnSentinel = reason; + this._promise._attachExtraTrace(reason); + this._promise._pushContext(); + result = tryCatch2(this._generator["throw"]).call(this._generator, reason); + this._promise._popContext(); + } else { + this._promise._pushContext(); + result = tryCatch2(this._generator["return"]).call(this._generator, void 0); + this._promise._popContext(); + } + this._cancellationPhase = true; + this._yieldedPromise = null; + this._continue(result); + }; + PromiseSpawn.prototype._promiseFulfilled = function(value) { + this._yieldedPromise = null; + this._promise._pushContext(); + var result = tryCatch2(this._generator.next).call(this._generator, value); + this._promise._popContext(); + this._continue(result); + }; + PromiseSpawn.prototype._promiseRejected = function(reason) { + this._yieldedPromise = null; + this._promise._attachExtraTrace(reason); + this._promise._pushContext(); + var result = tryCatch2(this._generator["throw"]).call(this._generator, reason); + this._promise._popContext(); + this._continue(result); + }; + PromiseSpawn.prototype._resultCancelled = function() { + if (this._yieldedPromise instanceof Promise2) { + var promise = this._yieldedPromise; + this._yieldedPromise = null; + promise.cancel(); + } + }; + PromiseSpawn.prototype.promise = function() { + return this._promise; + }; + PromiseSpawn.prototype._run = function() { + this._generator = this._generatorFunction.call(this._receiver); + this._receiver = this._generatorFunction = void 0; + this._promiseFulfilled(void 0); + }; + PromiseSpawn.prototype._continue = function(result) { + var promise = this._promise; + if (result === errorObj2) { + this._cleanup(); + if (this._cancellationPhase) { + return promise.cancel(); + } else { + return promise._rejectCallback(result.e, false); + } + } + var value = result.value; + if (result.done === true) { + this._cleanup(); + if (this._cancellationPhase) { + return promise.cancel(); + } else { + return promise._resolveCallback(value); + } + } else { + var maybePromise = tryConvertToPromise(value, this._promise); + if (!(maybePromise instanceof Promise2)) { + maybePromise = promiseFromYieldHandler(maybePromise, this._yieldHandlers, this._promise); + if (maybePromise === null) { + this._promiseRejected(new TypeError2("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s", value) + "From coroutine:\n" + this._stack.split("\n").slice(1, -7).join("\n"))); + return; + } + } + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if ((bitField & 50397184) === 0) { + this._yieldedPromise = maybePromise; + maybePromise._proxy(this, null); + } else if ((bitField & 33554432) !== 0) { + Promise2._async.invoke(this._promiseFulfilled, this, maybePromise._value()); + } else if ((bitField & 16777216) !== 0) { + Promise2._async.invoke(this._promiseRejected, this, maybePromise._reason()); + } else { + this._promiseCancelled(); + } + } + }; + Promise2.coroutine = function(generatorFunction, options) { + if (typeof generatorFunction !== "function") { + throw new TypeError2("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n"); + } + var yieldHandler = Object(options).yieldHandler; + var PromiseSpawn$ = PromiseSpawn; + var stack = new Error().stack; + return function() { + var generator = generatorFunction.apply(this, arguments); + var spawn = new PromiseSpawn$(void 0, void 0, yieldHandler, stack); + var ret2 = spawn.promise(); + spawn._generator = generator; + spawn._promiseFulfilled(void 0); + return ret2; + }; + }; + Promise2.coroutine.addYieldHandler = function(fn) { + if (typeof fn !== "function") { + throw new TypeError2("expecting a function but got " + util.classString(fn)); + } + yieldHandlers.push(fn); + }; + Promise2.spawn = function(generatorFunction) { + debug.deprecated("Promise.spawn()", "Promise.coroutine()"); + if (typeof generatorFunction !== "function") { + return apiRejection("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n"); + } + var spawn = new PromiseSpawn(generatorFunction, this); + var ret2 = spawn.promise(); + spawn._run(Promise2.spawn); + return ret2; + }; + }; +}); + +// node_modules/bluebird/js/release/nodeify.js +var require_nodeify = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2) { + var util = require_util(); + var async = Promise2._async; + var tryCatch2 = util.tryCatch; + var errorObj2 = util.errorObj; + function spreadAdapter(val, nodeback) { + var promise = this; + if (!util.isArray(val)) + return successAdapter.call(promise, val, nodeback); + var ret2 = tryCatch2(nodeback).apply(promise._boundValue(), [null].concat(val)); + if (ret2 === errorObj2) { + async.throwLater(ret2.e); + } + } + function successAdapter(val, nodeback) { + var promise = this; + var receiver = promise._boundValue(); + var ret2 = val === void 0 ? tryCatch2(nodeback).call(receiver, null) : tryCatch2(nodeback).call(receiver, null, val); + if (ret2 === errorObj2) { + async.throwLater(ret2.e); + } + } + function errorAdapter(reason, nodeback) { + var promise = this; + if (!reason) { + var newReason = new Error(reason + ""); + newReason.cause = reason; + reason = newReason; + } + var ret2 = tryCatch2(nodeback).call(promise._boundValue(), reason); + if (ret2 === errorObj2) { + async.throwLater(ret2.e); + } + } + Promise2.prototype.asCallback = Promise2.prototype.nodeify = function(nodeback, options) { + if (typeof nodeback == "function") { + var adapter = successAdapter; + if (options !== void 0 && Object(options).spread) { + adapter = spreadAdapter; + } + this._then(adapter, errorAdapter, void 0, this, nodeback); + } + return this; + }; + }; +}); + +// node_modules/bluebird/js/release/promisify.js +var require_promisify = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, INTERNAL) { + var THIS = {}; + var util = require_util(); + var nodebackForPromise = require_nodeback(); + var withAppended2 = util.withAppended; + var maybeWrapAsError2 = util.maybeWrapAsError; + var canEvaluate2 = util.canEvaluate; + var TypeError2 = require_errors().TypeError; + var defaultSuffix = "Async"; + var defaultPromisified = {__isPromisified__: true}; + var noCopyProps = [ + "arity", + "length", + "name", + "arguments", + "caller", + "callee", + "prototype", + "__isPromisified__" + ]; + var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$"); + var defaultFilter = function(name) { + return util.isIdentifier(name) && name.charAt(0) !== "_" && name !== "constructor"; + }; + function propsFilter(key) { + return !noCopyPropsPattern.test(key); + } + function isPromisified(fn) { + try { + return fn.__isPromisified__ === true; + } catch (e) { + return false; + } + } + function hasPromisified(obj, key, suffix) { + var val = util.getDataPropertyOrDefault(obj, key + suffix, defaultPromisified); + return val ? isPromisified(val) : false; + } + function checkValid(ret2, suffix, suffixRegexp) { + for (var i = 0; i < ret2.length; i += 2) { + var key = ret2[i]; + if (suffixRegexp.test(key)) { + var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); + for (var j = 0; j < ret2.length; j += 2) { + if (ret2[j] === keyWithoutAsyncSuffix) { + throw new TypeError2("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/MqrFmX\n".replace("%s", suffix)); + } + } + } + } + } + function promisifiableMethods(obj, suffix, suffixRegexp, filter) { + var keys = util.inheritedDataKeys(obj); + var ret2 = []; + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var value = obj[key]; + var passesDefaultFilter = filter === defaultFilter ? true : defaultFilter(key, value, obj); + if (typeof value === "function" && !isPromisified(value) && !hasPromisified(obj, key, suffix) && filter(key, value, obj, passesDefaultFilter)) { + ret2.push(key, value); + } + } + checkValid(ret2, suffix, suffixRegexp); + return ret2; + } + var escapeIdentRegex = function(str) { + return str.replace(/([$])/, "\\$"); + }; + var makeNodePromisifiedEval; + if (true) { + var switchCaseArgumentOrder = function(likelyArgumentCount) { + var ret2 = [likelyArgumentCount]; + var min = Math.max(0, likelyArgumentCount - 1 - 3); + for (var i = likelyArgumentCount - 1; i >= min; --i) { + ret2.push(i); + } + for (var i = likelyArgumentCount + 1; i <= 3; ++i) { + ret2.push(i); + } + return ret2; + }; + var argumentSequence = function(argumentCount) { + return util.filledRange(argumentCount, "_arg", ""); + }; + var parameterDeclaration = function(parameterCount2) { + return util.filledRange(Math.max(parameterCount2, 3), "_arg", ""); + }; + var parameterCount = function(fn) { + if (typeof fn.length === "number") { + return Math.max(Math.min(fn.length, 1023 + 1), 0); + } + return 0; + }; + makeNodePromisifiedEval = function(callback, receiver, originalName, fn, _, multiArgs) { + var newParameterCount = Math.max(0, parameterCount(fn) - 1); + var argumentOrder = switchCaseArgumentOrder(newParameterCount); + var shouldProxyThis = typeof callback === "string" || receiver === THIS; + function generateCallForArgumentCount(count) { + var args = argumentSequence(count).join(", "); + var comma = count > 0 ? ", " : ""; + var ret2; + if (shouldProxyThis) { + ret2 = "ret = callback.call(this, {{args}}, nodeback); break;\n"; + } else { + ret2 = receiver === void 0 ? "ret = callback({{args}}, nodeback); break;\n" : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; + } + return ret2.replace("{{args}}", args).replace(", ", comma); + } + function generateArgumentSwitchCase() { + var ret2 = ""; + for (var i = 0; i < argumentOrder.length; ++i) { + ret2 += "case " + argumentOrder[i] + ":" + generateCallForArgumentCount(argumentOrder[i]); + } + ret2 += " \n default: \n var args = new Array(len + 1); \n var i = 0; \n for (var i = 0; i < len; ++i) { \n args[i] = arguments[i]; \n } \n args[i] = nodeback; \n [CodeForCall] \n break; \n ".replace("[CodeForCall]", shouldProxyThis ? "ret = callback.apply(this, args);\n" : "ret = callback.apply(receiver, args);\n"); + return ret2; + } + var getFunctionCode = typeof callback === "string" ? "this != null ? this['" + callback + "'] : fn" : "fn"; + var body = "'use strict'; \n var ret = function (Parameters) { \n 'use strict'; \n var len = arguments.length; \n var promise = new Promise(INTERNAL); \n promise._captureStackTrace(); \n var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n var ret; \n var callback = tryCatch([GetFunctionCode]); \n switch(len) { \n [CodeForSwitchCase] \n } \n if (ret === errorObj) { \n promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n } \n if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n return promise; \n }; \n notEnumerableProp(ret, '__isPromisified__', true); \n return ret; \n ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase()).replace("[GetFunctionCode]", getFunctionCode); + body = body.replace("Parameters", parameterDeclaration(newParameterCount)); + return new Function("Promise", "fn", "receiver", "withAppended", "maybeWrapAsError", "nodebackForPromise", "tryCatch", "errorObj", "notEnumerableProp", "INTERNAL", body)(Promise2, fn, receiver, withAppended2, maybeWrapAsError2, nodebackForPromise, util.tryCatch, util.errorObj, util.notEnumerableProp, INTERNAL); + }; + } + function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) { + var defaultThis = function() { + return this; + }(); + var method = callback; + if (typeof method === "string") { + callback = fn; + } + function promisified() { + var _receiver = receiver; + if (receiver === THIS) + _receiver = this; + var promise = new Promise2(INTERNAL); + promise._captureStackTrace(); + var cb = typeof method === "string" && this !== defaultThis ? this[method] : callback; + var fn2 = nodebackForPromise(promise, multiArgs); + try { + cb.apply(_receiver, withAppended2(arguments, fn2)); + } catch (e) { + promise._rejectCallback(maybeWrapAsError2(e), true, true); + } + if (!promise._isFateSealed()) + promise._setAsyncGuaranteed(); + return promise; + } + util.notEnumerableProp(promisified, "__isPromisified__", true); + return promisified; + } + var makeNodePromisified = canEvaluate2 ? makeNodePromisifiedEval : makeNodePromisifiedClosure; + function promisifyAll(obj, suffix, filter, promisifier, multiArgs) { + var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); + var methods = promisifiableMethods(obj, suffix, suffixRegexp, filter); + for (var i = 0, len = methods.length; i < len; i += 2) { + var key = methods[i]; + var fn = methods[i + 1]; + var promisifiedKey = key + suffix; + if (promisifier === makeNodePromisified) { + obj[promisifiedKey] = makeNodePromisified(key, THIS, key, fn, suffix, multiArgs); + } else { + var promisified = promisifier(fn, function() { + return makeNodePromisified(key, THIS, key, fn, suffix, multiArgs); + }); + util.notEnumerableProp(promisified, "__isPromisified__", true); + obj[promisifiedKey] = promisified; + } + } + util.toFastProperties(obj); + return obj; + } + function promisify(callback, receiver, multiArgs) { + return makeNodePromisified(callback, receiver, void 0, callback, null, multiArgs); + } + Promise2.promisify = function(fn, options) { + if (typeof fn !== "function") { + throw new TypeError2("expecting a function but got " + util.classString(fn)); + } + if (isPromisified(fn)) { + return fn; + } + options = Object(options); + var receiver = options.context === void 0 ? THIS : options.context; + var multiArgs = !!options.multiArgs; + var ret2 = promisify(fn, receiver, multiArgs); + util.copyDescriptors(fn, ret2, propsFilter); + return ret2; + }; + Promise2.promisifyAll = function(target, options) { + if (typeof target !== "function" && typeof target !== "object") { + throw new TypeError2("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n"); + } + options = Object(options); + var multiArgs = !!options.multiArgs; + var suffix = options.suffix; + if (typeof suffix !== "string") + suffix = defaultSuffix; + var filter = options.filter; + if (typeof filter !== "function") + filter = defaultFilter; + var promisifier = options.promisifier; + if (typeof promisifier !== "function") + promisifier = makeNodePromisified; + if (!util.isIdentifier(suffix)) { + throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n"); + } + var keys = util.inheritedDataKeys(target); + for (var i = 0; i < keys.length; ++i) { + var value = target[keys[i]]; + if (keys[i] !== "constructor" && util.isClass(value)) { + promisifyAll(value.prototype, suffix, filter, promisifier, multiArgs); + promisifyAll(value, suffix, filter, promisifier, multiArgs); + } + } + return promisifyAll(target, suffix, filter, promisifier, multiArgs); + }; + }; +}); + +// node_modules/bluebird/js/release/props.js +var require_props = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, PromiseArray, tryConvertToPromise, apiRejection) { + var util = require_util(); + var isObject3 = util.isObject; + var es52 = require_es5(); + var Es6Map; + if (typeof Map === "function") + Es6Map = Map; + var mapToEntries = function() { + var index = 0; + var size = 0; + function extractEntry(value, key) { + this[index] = value; + this[index + size] = key; + index++; + } + return function mapToEntries2(map) { + size = map.size; + index = 0; + var ret2 = new Array(map.size * 2); + map.forEach(extractEntry, ret2); + return ret2; + }; + }(); + var entriesToMap = function(entries) { + var ret2 = new Es6Map(); + var length = entries.length / 2 | 0; + for (var i = 0; i < length; ++i) { + var key = entries[length + i]; + var value = entries[i]; + ret2.set(key, value); + } + return ret2; + }; + function PropertiesPromiseArray(obj) { + var isMap = false; + var entries; + if (Es6Map !== void 0 && obj instanceof Es6Map) { + entries = mapToEntries(obj); + isMap = true; + } else { + var keys = es52.keys(obj); + var len = keys.length; + entries = new Array(len * 2); + for (var i = 0; i < len; ++i) { + var key = keys[i]; + entries[i] = obj[key]; + entries[i + len] = key; + } + } + this.constructor$(entries); + this._isMap = isMap; + this._init$(void 0, -3); + } + util.inherits(PropertiesPromiseArray, PromiseArray); + PropertiesPromiseArray.prototype._init = function() { + }; + PropertiesPromiseArray.prototype._promiseFulfilled = function(value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + var val; + if (this._isMap) { + val = entriesToMap(this._values); + } else { + val = {}; + var keyOffset = this.length(); + for (var i = 0, len = this.length(); i < len; ++i) { + val[this._values[i + keyOffset]] = this._values[i]; + } + } + this._resolve(val); + return true; + } + return false; + }; + PropertiesPromiseArray.prototype.shouldCopyValues = function() { + return false; + }; + PropertiesPromiseArray.prototype.getActualLength = function(len) { + return len >> 1; + }; + function props(promises) { + var ret2; + var castValue = tryConvertToPromise(promises); + if (!isObject3(castValue)) { + return apiRejection("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n"); + } else if (castValue instanceof Promise2) { + ret2 = castValue._then(Promise2.props, void 0, void 0, void 0, void 0); + } else { + ret2 = new PropertiesPromiseArray(castValue).promise(); + } + if (castValue instanceof Promise2) { + ret2._propagateFrom(castValue, 2); + } + return ret2; + } + Promise2.prototype.props = function() { + return props(this); + }; + Promise2.props = function(promises) { + return props(promises); + }; + }; +}); + +// node_modules/bluebird/js/release/race.js +var require_race = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, INTERNAL, tryConvertToPromise, apiRejection) { + var util = require_util(); + var raceLater = function(promise) { + return promise.then(function(array) { + return race(array, promise); + }); + }; + function race(promises, parent) { + var maybePromise = tryConvertToPromise(promises); + if (maybePromise instanceof Promise2) { + return raceLater(maybePromise); + } else { + promises = util.asArray(promises); + if (promises === null) + return apiRejection("expecting an array or an iterable object but got " + util.classString(promises)); + } + var ret2 = new Promise2(INTERNAL); + if (parent !== void 0) { + ret2._propagateFrom(parent, 3); + } + var fulfill = ret2._fulfill; + var reject = ret2._reject; + for (var i = 0, len = promises.length; i < len; ++i) { + var val = promises[i]; + if (val === void 0 && !(i in promises)) { + continue; + } + Promise2.cast(val)._then(fulfill, reject, void 0, ret2, null); + } + return ret2; + } + Promise2.race = function(promises) { + return race(promises, void 0); + }; + Promise2.prototype.race = function() { + return race(this, void 0); + }; + }; +}); + +// node_modules/bluebird/js/release/reduce.js +var require_reduce = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug) { + var getDomain = Promise2._getDomain; + var util = require_util(); + var tryCatch2 = util.tryCatch; + function ReductionPromiseArray(promises, fn, initialValue, _each) { + this.constructor$(promises); + var domain = getDomain(); + this._fn = domain === null ? fn : util.domainBind(domain, fn); + if (initialValue !== void 0) { + initialValue = Promise2.resolve(initialValue); + initialValue._attachCancellationCallback(this); + } + this._initialValue = initialValue; + this._currentCancellable = null; + if (_each === INTERNAL) { + this._eachValues = Array(this._length); + } else if (_each === 0) { + this._eachValues = null; + } else { + this._eachValues = void 0; + } + this._promise._captureStackTrace(); + this._init$(void 0, -5); + } + util.inherits(ReductionPromiseArray, PromiseArray); + ReductionPromiseArray.prototype._gotAccum = function(accum) { + if (this._eachValues !== void 0 && this._eachValues !== null && accum !== INTERNAL) { + this._eachValues.push(accum); + } + }; + ReductionPromiseArray.prototype._eachComplete = function(value) { + if (this._eachValues !== null) { + this._eachValues.push(value); + } + return this._eachValues; + }; + ReductionPromiseArray.prototype._init = function() { + }; + ReductionPromiseArray.prototype._resolveEmptyArray = function() { + this._resolve(this._eachValues !== void 0 ? this._eachValues : this._initialValue); + }; + ReductionPromiseArray.prototype.shouldCopyValues = function() { + return false; + }; + ReductionPromiseArray.prototype._resolve = function(value) { + this._promise._resolveCallback(value); + this._values = null; + }; + ReductionPromiseArray.prototype._resultCancelled = function(sender) { + if (sender === this._initialValue) + return this._cancel(); + if (this._isResolved()) + return; + this._resultCancelled$(); + if (this._currentCancellable instanceof Promise2) { + this._currentCancellable.cancel(); + } + if (this._initialValue instanceof Promise2) { + this._initialValue.cancel(); + } + }; + ReductionPromiseArray.prototype._iterate = function(values) { + this._values = values; + var value; + var i; + var length = values.length; + if (this._initialValue !== void 0) { + value = this._initialValue; + i = 0; + } else { + value = Promise2.resolve(values[0]); + i = 1; + } + this._currentCancellable = value; + if (!value.isRejected()) { + for (; i < length; ++i) { + var ctx = { + accum: null, + value: values[i], + index: i, + length, + array: this + }; + value = value._then(gotAccum, void 0, void 0, ctx, void 0); + } + } + if (this._eachValues !== void 0) { + value = value._then(this._eachComplete, void 0, void 0, this, void 0); + } + value._then(completed, completed, void 0, value, this); + }; + Promise2.prototype.reduce = function(fn, initialValue) { + return reduce(this, fn, initialValue, null); + }; + Promise2.reduce = function(promises, fn, initialValue, _each) { + return reduce(promises, fn, initialValue, _each); + }; + function completed(valueOrReason, array) { + if (this.isFulfilled()) { + array._resolve(valueOrReason); + } else { + array._reject(valueOrReason); + } + } + function reduce(promises, fn, initialValue, _each) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var array = new ReductionPromiseArray(promises, fn, initialValue, _each); + return array.promise(); + } + function gotAccum(accum) { + this.accum = accum; + this.array._gotAccum(accum); + var value = tryConvertToPromise(this.value, this.array._promise); + if (value instanceof Promise2) { + this.array._currentCancellable = value; + return value._then(gotValue, void 0, void 0, this, void 0); + } else { + return gotValue.call(this, value); + } + } + function gotValue(value) { + var array = this.array; + var promise = array._promise; + var fn = tryCatch2(array._fn); + promise._pushContext(); + var ret2; + if (array._eachValues !== void 0) { + ret2 = fn.call(promise._boundValue(), value, this.index, this.length); + } else { + ret2 = fn.call(promise._boundValue(), this.accum, value, this.index, this.length); + } + if (ret2 instanceof Promise2) { + array._currentCancellable = ret2; + } + var promiseCreated = promise._popContext(); + debug.checkForgottenReturns(ret2, promiseCreated, array._eachValues !== void 0 ? "Promise.each" : "Promise.reduce", promise); + return ret2; + } + }; +}); + +// node_modules/bluebird/js/release/settle.js +var require_settle = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, PromiseArray, debug) { + var PromiseInspection = Promise2.PromiseInspection; + var util = require_util(); + function SettledPromiseArray(values) { + this.constructor$(values); + } + util.inherits(SettledPromiseArray, PromiseArray); + SettledPromiseArray.prototype._promiseResolved = function(index, inspection) { + this._values[index] = inspection; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + this._resolve(this._values); + return true; + } + return false; + }; + SettledPromiseArray.prototype._promiseFulfilled = function(value, index) { + var ret2 = new PromiseInspection(); + ret2._bitField = 33554432; + ret2._settledValueField = value; + return this._promiseResolved(index, ret2); + }; + SettledPromiseArray.prototype._promiseRejected = function(reason, index) { + var ret2 = new PromiseInspection(); + ret2._bitField = 16777216; + ret2._settledValueField = reason; + return this._promiseResolved(index, ret2); + }; + Promise2.settle = function(promises) { + debug.deprecated(".settle()", ".reflect()"); + return new SettledPromiseArray(promises).promise(); + }; + Promise2.prototype.settle = function() { + return Promise2.settle(this); + }; + }; +}); + +// node_modules/bluebird/js/release/some.js +var require_some = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, PromiseArray, apiRejection) { + var util = require_util(); + var RangeError2 = require_errors().RangeError; + var AggregateError = require_errors().AggregateError; + var isArray = util.isArray; + var CANCELLATION = {}; + function SomePromiseArray(values) { + this.constructor$(values); + this._howMany = 0; + this._unwrap = false; + this._initialized = false; + } + util.inherits(SomePromiseArray, PromiseArray); + SomePromiseArray.prototype._init = function() { + if (!this._initialized) { + return; + } + if (this._howMany === 0) { + this._resolve([]); + return; + } + this._init$(void 0, -5); + var isArrayResolved = isArray(this._values); + if (!this._isResolved() && isArrayResolved && this._howMany > this._canPossiblyFulfill()) { + this._reject(this._getRangeError(this.length())); + } + }; + SomePromiseArray.prototype.init = function() { + this._initialized = true; + this._init(); + }; + SomePromiseArray.prototype.setUnwrap = function() { + this._unwrap = true; + }; + SomePromiseArray.prototype.howMany = function() { + return this._howMany; + }; + SomePromiseArray.prototype.setHowMany = function(count) { + this._howMany = count; + }; + SomePromiseArray.prototype._promiseFulfilled = function(value) { + this._addFulfilled(value); + if (this._fulfilled() === this.howMany()) { + this._values.length = this.howMany(); + if (this.howMany() === 1 && this._unwrap) { + this._resolve(this._values[0]); + } else { + this._resolve(this._values); + } + return true; + } + return false; + }; + SomePromiseArray.prototype._promiseRejected = function(reason) { + this._addRejected(reason); + return this._checkOutcome(); + }; + SomePromiseArray.prototype._promiseCancelled = function() { + if (this._values instanceof Promise2 || this._values == null) { + return this._cancel(); + } + this._addRejected(CANCELLATION); + return this._checkOutcome(); + }; + SomePromiseArray.prototype._checkOutcome = function() { + if (this.howMany() > this._canPossiblyFulfill()) { + var e = new AggregateError(); + for (var i = this.length(); i < this._values.length; ++i) { + if (this._values[i] !== CANCELLATION) { + e.push(this._values[i]); + } + } + if (e.length > 0) { + this._reject(e); + } else { + this._cancel(); + } + return true; + } + return false; + }; + SomePromiseArray.prototype._fulfilled = function() { + return this._totalResolved; + }; + SomePromiseArray.prototype._rejected = function() { + return this._values.length - this.length(); + }; + SomePromiseArray.prototype._addRejected = function(reason) { + this._values.push(reason); + }; + SomePromiseArray.prototype._addFulfilled = function(value) { + this._values[this._totalResolved++] = value; + }; + SomePromiseArray.prototype._canPossiblyFulfill = function() { + return this.length() - this._rejected(); + }; + SomePromiseArray.prototype._getRangeError = function(count) { + var message = "Input array must contain at least " + this._howMany + " items but contains only " + count + " items"; + return new RangeError2(message); + }; + SomePromiseArray.prototype._resolveEmptyArray = function() { + this._reject(this._getRangeError(0)); + }; + function some(promises, howMany) { + if ((howMany | 0) !== howMany || howMany < 0) { + return apiRejection("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n"); + } + var ret2 = new SomePromiseArray(promises); + var promise = ret2.promise(); + ret2.setHowMany(howMany); + ret2.init(); + return promise; + } + Promise2.some = function(promises, howMany) { + return some(promises, howMany); + }; + Promise2.prototype.some = function(howMany) { + return some(this, howMany); + }; + Promise2._SomePromiseArray = SomePromiseArray; + }; +}); + +// node_modules/bluebird/js/release/filter.js +var require_filter = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, INTERNAL) { + var PromiseMap = Promise2.map; + Promise2.prototype.filter = function(fn, options) { + return PromiseMap(this, fn, options, INTERNAL); + }; + Promise2.filter = function(promises, fn, options) { + return PromiseMap(promises, fn, options, INTERNAL); + }; + }; +}); + +// node_modules/bluebird/js/release/each.js +var require_each = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2, INTERNAL) { + var PromiseReduce = Promise2.reduce; + var PromiseAll = Promise2.all; + function promiseAllThis() { + return PromiseAll(this); + } + function PromiseMapSeries(promises, fn) { + return PromiseReduce(promises, fn, INTERNAL, INTERNAL); + } + Promise2.prototype.each = function(fn) { + return PromiseReduce(this, fn, INTERNAL, 0)._then(promiseAllThis, void 0, void 0, this, void 0); + }; + Promise2.prototype.mapSeries = function(fn) { + return PromiseReduce(this, fn, INTERNAL, INTERNAL); + }; + Promise2.each = function(promises, fn) { + return PromiseReduce(promises, fn, INTERNAL, 0)._then(promiseAllThis, void 0, void 0, promises, void 0); + }; + Promise2.mapSeries = PromiseMapSeries; + }; +}); + +// node_modules/bluebird/js/release/any.js +var require_any = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(Promise2) { + var SomePromiseArray = Promise2._SomePromiseArray; + function any(promises) { + var ret2 = new SomePromiseArray(promises); + var promise = ret2.promise(); + ret2.setHowMany(1); + ret2.setUnwrap(); + ret2.init(); + return promise; + } + Promise2.any = function(promises) { + return any(promises); + }; + Promise2.prototype.any = function() { + return any(this); + }; + }; +}); + +// node_modules/bluebird/js/release/promise.js +var require_promise = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function() { + var makeSelfResolutionError = function() { + return new TypeError2("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n"); + }; + var reflectHandler = function() { + return new Promise2.PromiseInspection(this._target()); + }; + var apiRejection = function(msg) { + return Promise2.reject(new TypeError2(msg)); + }; + function Proxyable() { + } + var UNDEFINED_BINDING = {}; + var util = require_util(); + var getDomain; + if (util.isNode) { + getDomain = function() { + var ret2 = process.domain; + if (ret2 === void 0) + ret2 = null; + return ret2; + }; + } else { + getDomain = function() { + return null; + }; + } + util.notEnumerableProp(Promise2, "_getDomain", getDomain); + var es52 = require_es5(); + var Async = require_async(); + var async = new Async(); + es52.defineProperty(Promise2, "_async", {value: async}); + var errors = require_errors(); + var TypeError2 = Promise2.TypeError = errors.TypeError; + Promise2.RangeError = errors.RangeError; + var CancellationError = Promise2.CancellationError = errors.CancellationError; + Promise2.TimeoutError = errors.TimeoutError; + Promise2.OperationalError = errors.OperationalError; + Promise2.RejectionError = errors.OperationalError; + Promise2.AggregateError = errors.AggregateError; + var INTERNAL = function() { + }; + var APPLY = {}; + var NEXT_FILTER = {}; + var tryConvertToPromise = require_thenables()(Promise2, INTERNAL); + var PromiseArray = require_promise_array()(Promise2, INTERNAL, tryConvertToPromise, apiRejection, Proxyable); + var Context = require_context()(Promise2); + var createContext = Context.create; + var debug = require_debuggability()(Promise2, Context); + var CapturedTrace = debug.CapturedTrace; + var PassThroughHandlerContext = require_finally()(Promise2, tryConvertToPromise); + var catchFilter = require_catch_filter()(NEXT_FILTER); + var nodebackForPromise = require_nodeback(); + var errorObj2 = util.errorObj; + var tryCatch2 = util.tryCatch; + function check(self2, executor) { + if (typeof executor !== "function") { + throw new TypeError2("expecting a function but got " + util.classString(executor)); + } + if (self2.constructor !== Promise2) { + throw new TypeError2("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n"); + } + } + function Promise2(executor) { + this._bitField = 0; + this._fulfillmentHandler0 = void 0; + this._rejectionHandler0 = void 0; + this._promise0 = void 0; + this._receiver0 = void 0; + if (executor !== INTERNAL) { + check(this, executor); + this._resolveFromExecutor(executor); + } + this._promiseCreated(); + this._fireEvent("promiseCreated", this); + } + Promise2.prototype.toString = function() { + return "[object Promise]"; + }; + Promise2.prototype.caught = Promise2.prototype["catch"] = function(fn) { + var len = arguments.length; + if (len > 1) { + var catchInstances = new Array(len - 1), j = 0, i; + for (i = 0; i < len - 1; ++i) { + var item = arguments[i]; + if (util.isObject(item)) { + catchInstances[j++] = item; + } else { + return apiRejection("expecting an object but got A catch statement predicate " + util.classString(item)); + } + } + catchInstances.length = j; + fn = arguments[i]; + return this.then(void 0, catchFilter(catchInstances, fn, this)); + } + return this.then(void 0, fn); + }; + Promise2.prototype.reflect = function() { + return this._then(reflectHandler, reflectHandler, void 0, this, void 0); + }; + Promise2.prototype.then = function(didFulfill, didReject) { + if (debug.warnings() && arguments.length > 0 && typeof didFulfill !== "function" && typeof didReject !== "function") { + var msg = ".then() only accepts functions but was passed: " + util.classString(didFulfill); + if (arguments.length > 1) { + msg += ", " + util.classString(didReject); + } + this._warn(msg); + } + return this._then(didFulfill, didReject, void 0, void 0, void 0); + }; + Promise2.prototype.done = function(didFulfill, didReject) { + var promise = this._then(didFulfill, didReject, void 0, void 0, void 0); + promise._setIsFinal(); + }; + Promise2.prototype.spread = function(fn) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + return this.all()._then(fn, void 0, void 0, APPLY, void 0); + }; + Promise2.prototype.toJSON = function() { + var ret2 = { + isFulfilled: false, + isRejected: false, + fulfillmentValue: void 0, + rejectionReason: void 0 + }; + if (this.isFulfilled()) { + ret2.fulfillmentValue = this.value(); + ret2.isFulfilled = true; + } else if (this.isRejected()) { + ret2.rejectionReason = this.reason(); + ret2.isRejected = true; + } + return ret2; + }; + Promise2.prototype.all = function() { + if (arguments.length > 0) { + this._warn(".all() was passed arguments but it does not take any"); + } + return new PromiseArray(this).promise(); + }; + Promise2.prototype.error = function(fn) { + return this.caught(util.originatesFromRejection, fn); + }; + Promise2.getNewLibraryCopy = module2.exports; + Promise2.is = function(val) { + return val instanceof Promise2; + }; + Promise2.fromNode = Promise2.fromCallback = function(fn) { + var ret2 = new Promise2(INTERNAL); + ret2._captureStackTrace(); + var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs : false; + var result = tryCatch2(fn)(nodebackForPromise(ret2, multiArgs)); + if (result === errorObj2) { + ret2._rejectCallback(result.e, true); + } + if (!ret2._isFateSealed()) + ret2._setAsyncGuaranteed(); + return ret2; + }; + Promise2.all = function(promises) { + return new PromiseArray(promises).promise(); + }; + Promise2.cast = function(obj) { + var ret2 = tryConvertToPromise(obj); + if (!(ret2 instanceof Promise2)) { + ret2 = new Promise2(INTERNAL); + ret2._captureStackTrace(); + ret2._setFulfilled(); + ret2._rejectionHandler0 = obj; + } + return ret2; + }; + Promise2.resolve = Promise2.fulfilled = Promise2.cast; + Promise2.reject = Promise2.rejected = function(reason) { + var ret2 = new Promise2(INTERNAL); + ret2._captureStackTrace(); + ret2._rejectCallback(reason, true); + return ret2; + }; + Promise2.setScheduler = function(fn) { + if (typeof fn !== "function") { + throw new TypeError2("expecting a function but got " + util.classString(fn)); + } + return async.setScheduler(fn); + }; + Promise2.prototype._then = function(didFulfill, didReject, _, receiver, internalData) { + var haveInternalData = internalData !== void 0; + var promise = haveInternalData ? internalData : new Promise2(INTERNAL); + var target = this._target(); + var bitField = target._bitField; + if (!haveInternalData) { + promise._propagateFrom(this, 3); + promise._captureStackTrace(); + if (receiver === void 0 && (this._bitField & 2097152) !== 0) { + if (!((bitField & 50397184) === 0)) { + receiver = this._boundValue(); + } else { + receiver = target === this ? void 0 : this._boundTo; + } + } + this._fireEvent("promiseChained", this, promise); + } + var domain = getDomain(); + if (!((bitField & 50397184) === 0)) { + var handler, value, settler = target._settlePromiseCtx; + if ((bitField & 33554432) !== 0) { + value = target._rejectionHandler0; + handler = didFulfill; + } else if ((bitField & 16777216) !== 0) { + value = target._fulfillmentHandler0; + handler = didReject; + target._unsetRejectionIsUnhandled(); + } else { + settler = target._settlePromiseLateCancellationObserver; + value = new CancellationError("late cancellation observer"); + target._attachExtraTrace(value); + handler = didReject; + } + async.invoke(settler, target, { + handler: domain === null ? handler : typeof handler === "function" && util.domainBind(domain, handler), + promise, + receiver, + value + }); + } else { + target._addCallbacks(didFulfill, didReject, promise, receiver, domain); + } + return promise; + }; + Promise2.prototype._length = function() { + return this._bitField & 65535; + }; + Promise2.prototype._isFateSealed = function() { + return (this._bitField & 117506048) !== 0; + }; + Promise2.prototype._isFollowing = function() { + return (this._bitField & 67108864) === 67108864; + }; + Promise2.prototype._setLength = function(len) { + this._bitField = this._bitField & -65536 | len & 65535; + }; + Promise2.prototype._setFulfilled = function() { + this._bitField = this._bitField | 33554432; + this._fireEvent("promiseFulfilled", this); + }; + Promise2.prototype._setRejected = function() { + this._bitField = this._bitField | 16777216; + this._fireEvent("promiseRejected", this); + }; + Promise2.prototype._setFollowing = function() { + this._bitField = this._bitField | 67108864; + this._fireEvent("promiseResolved", this); + }; + Promise2.prototype._setIsFinal = function() { + this._bitField = this._bitField | 4194304; + }; + Promise2.prototype._isFinal = function() { + return (this._bitField & 4194304) > 0; + }; + Promise2.prototype._unsetCancelled = function() { + this._bitField = this._bitField & ~65536; + }; + Promise2.prototype._setCancelled = function() { + this._bitField = this._bitField | 65536; + this._fireEvent("promiseCancelled", this); + }; + Promise2.prototype._setWillBeCancelled = function() { + this._bitField = this._bitField | 8388608; + }; + Promise2.prototype._setAsyncGuaranteed = function() { + if (async.hasCustomScheduler()) + return; + this._bitField = this._bitField | 134217728; + }; + Promise2.prototype._receiverAt = function(index) { + var ret2 = index === 0 ? this._receiver0 : this[index * 4 - 4 + 3]; + if (ret2 === UNDEFINED_BINDING) { + return void 0; + } else if (ret2 === void 0 && this._isBound()) { + return this._boundValue(); + } + return ret2; + }; + Promise2.prototype._promiseAt = function(index) { + return this[index * 4 - 4 + 2]; + }; + Promise2.prototype._fulfillmentHandlerAt = function(index) { + return this[index * 4 - 4 + 0]; + }; + Promise2.prototype._rejectionHandlerAt = function(index) { + return this[index * 4 - 4 + 1]; + }; + Promise2.prototype._boundValue = function() { + }; + Promise2.prototype._migrateCallback0 = function(follower) { + var bitField = follower._bitField; + var fulfill = follower._fulfillmentHandler0; + var reject = follower._rejectionHandler0; + var promise = follower._promise0; + var receiver = follower._receiverAt(0); + if (receiver === void 0) + receiver = UNDEFINED_BINDING; + this._addCallbacks(fulfill, reject, promise, receiver, null); + }; + Promise2.prototype._migrateCallbackAt = function(follower, index) { + var fulfill = follower._fulfillmentHandlerAt(index); + var reject = follower._rejectionHandlerAt(index); + var promise = follower._promiseAt(index); + var receiver = follower._receiverAt(index); + if (receiver === void 0) + receiver = UNDEFINED_BINDING; + this._addCallbacks(fulfill, reject, promise, receiver, null); + }; + Promise2.prototype._addCallbacks = function(fulfill, reject, promise, receiver, domain) { + var index = this._length(); + if (index >= 65535 - 4) { + index = 0; + this._setLength(0); + } + if (index === 0) { + this._promise0 = promise; + this._receiver0 = receiver; + if (typeof fulfill === "function") { + this._fulfillmentHandler0 = domain === null ? fulfill : util.domainBind(domain, fulfill); + } + if (typeof reject === "function") { + this._rejectionHandler0 = domain === null ? reject : util.domainBind(domain, reject); + } + } else { + var base = index * 4 - 4; + this[base + 2] = promise; + this[base + 3] = receiver; + if (typeof fulfill === "function") { + this[base + 0] = domain === null ? fulfill : util.domainBind(domain, fulfill); + } + if (typeof reject === "function") { + this[base + 1] = domain === null ? reject : util.domainBind(domain, reject); + } + } + this._setLength(index + 1); + return index; + }; + Promise2.prototype._proxy = function(proxyable, arg) { + this._addCallbacks(void 0, void 0, arg, proxyable, null); + }; + Promise2.prototype._resolveCallback = function(value, shouldBind) { + if ((this._bitField & 117506048) !== 0) + return; + if (value === this) + return this._rejectCallback(makeSelfResolutionError(), false); + var maybePromise = tryConvertToPromise(value, this); + if (!(maybePromise instanceof Promise2)) + return this._fulfill(value); + if (shouldBind) + this._propagateFrom(maybePromise, 2); + var promise = maybePromise._target(); + if (promise === this) { + this._reject(makeSelfResolutionError()); + return; + } + var bitField = promise._bitField; + if ((bitField & 50397184) === 0) { + var len = this._length(); + if (len > 0) + promise._migrateCallback0(this); + for (var i = 1; i < len; ++i) { + promise._migrateCallbackAt(this, i); + } + this._setFollowing(); + this._setLength(0); + this._setFollowee(promise); + } else if ((bitField & 33554432) !== 0) { + this._fulfill(promise._value()); + } else if ((bitField & 16777216) !== 0) { + this._reject(promise._reason()); + } else { + var reason = new CancellationError("late cancellation observer"); + promise._attachExtraTrace(reason); + this._reject(reason); + } + }; + Promise2.prototype._rejectCallback = function(reason, synchronous, ignoreNonErrorWarnings) { + var trace = util.ensureErrorObject(reason); + var hasStack = trace === reason; + if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) { + var message = "a promise was rejected with a non-error: " + util.classString(reason); + this._warn(message, true); + } + this._attachExtraTrace(trace, synchronous ? hasStack : false); + this._reject(reason); + }; + Promise2.prototype._resolveFromExecutor = function(executor) { + var promise = this; + this._captureStackTrace(); + this._pushContext(); + var synchronous = true; + var r = this._execute(executor, function(value) { + promise._resolveCallback(value); + }, function(reason) { + promise._rejectCallback(reason, synchronous); + }); + synchronous = false; + this._popContext(); + if (r !== void 0) { + promise._rejectCallback(r, true); + } + }; + Promise2.prototype._settlePromiseFromHandler = function(handler, receiver, value, promise) { + var bitField = promise._bitField; + if ((bitField & 65536) !== 0) + return; + promise._pushContext(); + var x; + if (receiver === APPLY) { + if (!value || typeof value.length !== "number") { + x = errorObj2; + x.e = new TypeError2("cannot .spread() a non-array: " + util.classString(value)); + } else { + x = tryCatch2(handler).apply(this._boundValue(), value); + } + } else { + x = tryCatch2(handler).call(receiver, value); + } + var promiseCreated = promise._popContext(); + bitField = promise._bitField; + if ((bitField & 65536) !== 0) + return; + if (x === NEXT_FILTER) { + promise._reject(value); + } else if (x === errorObj2) { + promise._rejectCallback(x.e, false); + } else { + debug.checkForgottenReturns(x, promiseCreated, "", promise, this); + promise._resolveCallback(x); + } + }; + Promise2.prototype._target = function() { + var ret2 = this; + while (ret2._isFollowing()) + ret2 = ret2._followee(); + return ret2; + }; + Promise2.prototype._followee = function() { + return this._rejectionHandler0; + }; + Promise2.prototype._setFollowee = function(promise) { + this._rejectionHandler0 = promise; + }; + Promise2.prototype._settlePromise = function(promise, handler, receiver, value) { + var isPromise = promise instanceof Promise2; + var bitField = this._bitField; + var asyncGuaranteed = (bitField & 134217728) !== 0; + if ((bitField & 65536) !== 0) { + if (isPromise) + promise._invokeInternalOnCancel(); + if (receiver instanceof PassThroughHandlerContext && receiver.isFinallyHandler()) { + receiver.cancelPromise = promise; + if (tryCatch2(handler).call(receiver, value) === errorObj2) { + promise._reject(errorObj2.e); + } + } else if (handler === reflectHandler) { + promise._fulfill(reflectHandler.call(receiver)); + } else if (receiver instanceof Proxyable) { + receiver._promiseCancelled(promise); + } else if (isPromise || promise instanceof PromiseArray) { + promise._cancel(); + } else { + receiver.cancel(); + } + } else if (typeof handler === "function") { + if (!isPromise) { + handler.call(receiver, value, promise); + } else { + if (asyncGuaranteed) + promise._setAsyncGuaranteed(); + this._settlePromiseFromHandler(handler, receiver, value, promise); + } + } else if (receiver instanceof Proxyable) { + if (!receiver._isResolved()) { + if ((bitField & 33554432) !== 0) { + receiver._promiseFulfilled(value, promise); + } else { + receiver._promiseRejected(value, promise); + } + } + } else if (isPromise) { + if (asyncGuaranteed) + promise._setAsyncGuaranteed(); + if ((bitField & 33554432) !== 0) { + promise._fulfill(value); + } else { + promise._reject(value); + } + } + }; + Promise2.prototype._settlePromiseLateCancellationObserver = function(ctx) { + var handler = ctx.handler; + var promise = ctx.promise; + var receiver = ctx.receiver; + var value = ctx.value; + if (typeof handler === "function") { + if (!(promise instanceof Promise2)) { + handler.call(receiver, value, promise); + } else { + this._settlePromiseFromHandler(handler, receiver, value, promise); + } + } else if (promise instanceof Promise2) { + promise._reject(value); + } + }; + Promise2.prototype._settlePromiseCtx = function(ctx) { + this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value); + }; + Promise2.prototype._settlePromise0 = function(handler, value, bitField) { + var promise = this._promise0; + var receiver = this._receiverAt(0); + this._promise0 = void 0; + this._receiver0 = void 0; + this._settlePromise(promise, handler, receiver, value); + }; + Promise2.prototype._clearCallbackDataAtIndex = function(index) { + var base = index * 4 - 4; + this[base + 2] = this[base + 3] = this[base + 0] = this[base + 1] = void 0; + }; + Promise2.prototype._fulfill = function(value) { + var bitField = this._bitField; + if ((bitField & 117506048) >>> 16) + return; + if (value === this) { + var err = makeSelfResolutionError(); + this._attachExtraTrace(err); + return this._reject(err); + } + this._setFulfilled(); + this._rejectionHandler0 = value; + if ((bitField & 65535) > 0) { + if ((bitField & 134217728) !== 0) { + this._settlePromises(); + } else { + async.settlePromises(this); + } + } + }; + Promise2.prototype._reject = function(reason) { + var bitField = this._bitField; + if ((bitField & 117506048) >>> 16) + return; + this._setRejected(); + this._fulfillmentHandler0 = reason; + if (this._isFinal()) { + return async.fatalError(reason, util.isNode); + } + if ((bitField & 65535) > 0) { + async.settlePromises(this); + } else { + this._ensurePossibleRejectionHandled(); + } + }; + Promise2.prototype._fulfillPromises = function(len, value) { + for (var i = 1; i < len; i++) { + var handler = this._fulfillmentHandlerAt(i); + var promise = this._promiseAt(i); + var receiver = this._receiverAt(i); + this._clearCallbackDataAtIndex(i); + this._settlePromise(promise, handler, receiver, value); + } + }; + Promise2.prototype._rejectPromises = function(len, reason) { + for (var i = 1; i < len; i++) { + var handler = this._rejectionHandlerAt(i); + var promise = this._promiseAt(i); + var receiver = this._receiverAt(i); + this._clearCallbackDataAtIndex(i); + this._settlePromise(promise, handler, receiver, reason); + } + }; + Promise2.prototype._settlePromises = function() { + var bitField = this._bitField; + var len = bitField & 65535; + if (len > 0) { + if ((bitField & 16842752) !== 0) { + var reason = this._fulfillmentHandler0; + this._settlePromise0(this._rejectionHandler0, reason, bitField); + this._rejectPromises(len, reason); + } else { + var value = this._rejectionHandler0; + this._settlePromise0(this._fulfillmentHandler0, value, bitField); + this._fulfillPromises(len, value); + } + this._setLength(0); + } + this._clearCancellationData(); + }; + Promise2.prototype._settledValue = function() { + var bitField = this._bitField; + if ((bitField & 33554432) !== 0) { + return this._rejectionHandler0; + } else if ((bitField & 16777216) !== 0) { + return this._fulfillmentHandler0; + } + }; + function deferResolve(v) { + this.promise._resolveCallback(v); + } + function deferReject(v) { + this.promise._rejectCallback(v, false); + } + Promise2.defer = Promise2.pending = function() { + debug.deprecated("Promise.defer", "new Promise"); + var promise = new Promise2(INTERNAL); + return { + promise, + resolve: deferResolve, + reject: deferReject + }; + }; + util.notEnumerableProp(Promise2, "_makeSelfResolutionError", makeSelfResolutionError); + require_method()(Promise2, INTERNAL, tryConvertToPromise, apiRejection, debug); + require_bind()(Promise2, INTERNAL, tryConvertToPromise, debug); + require_cancel()(Promise2, PromiseArray, apiRejection, debug); + require_direct_resolve()(Promise2); + require_synchronous_inspection()(Promise2); + require_join()(Promise2, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain); + Promise2.Promise = Promise2; + Promise2.version = "3.4.7"; + require_map()(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); + require_call_get()(Promise2); + require_using()(Promise2, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug); + require_timers()(Promise2, INTERNAL, debug); + require_generators()(Promise2, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug); + require_nodeify()(Promise2); + require_promisify()(Promise2, INTERNAL); + require_props()(Promise2, PromiseArray, tryConvertToPromise, apiRejection); + require_race()(Promise2, INTERNAL, tryConvertToPromise, apiRejection); + require_reduce()(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); + require_settle()(Promise2, PromiseArray, debug); + require_some()(Promise2, PromiseArray, apiRejection); + require_filter()(Promise2, INTERNAL); + require_each()(Promise2, INTERNAL); + require_any()(Promise2); + util.toFastProperties(Promise2); + util.toFastProperties(Promise2.prototype); + function fillTypes(value) { + var p = new Promise2(INTERNAL); + p._fulfillmentHandler0 = value; + p._rejectionHandler0 = value; + p._promise0 = value; + p._receiver0 = value; + } + fillTypes({a: 1}); + fillTypes({b: 2}); + fillTypes({c: 3}); + fillTypes(1); + fillTypes(function() { + }); + fillTypes(void 0); + fillTypes(false); + fillTypes(new Promise2(INTERNAL)); + debug.setBounds(Async.firstLineError, util.lastLineError); + return Promise2; + }; +}); + +// node_modules/bluebird/js/release/bluebird.js +var require_bluebird = __commonJS((exports2, module2) => { + "use strict"; + var old; + if (typeof Promise !== "undefined") + old = Promise; + function noConflict() { + try { + if (Promise === bluebird) + Promise = old; + } catch (e) { + } + return bluebird; + } + var bluebird = require_promise()(); + bluebird.noConflict = noConflict; + module2.exports = bluebird; +}); + +// node_modules/unzipper/lib/Buffer.js +var require_Buffer = __commonJS((exports2, module2) => { + var Buffer2 = require("buffer").Buffer; + if (Buffer2.from === void 0) { + Buffer2.from = function(a, b, c) { + return new Buffer2(a, b, c); + }; + Buffer2.alloc = Buffer2.from; + } + module2.exports = Buffer2; +}); + +// node_modules/process-nextick-args/index.js +var require_process_nextick_args = __commonJS((exports2, module2) => { + "use strict"; + if (typeof process === "undefined" || !process.version || process.version.indexOf("v0.") === 0 || process.version.indexOf("v1.") === 0 && process.version.indexOf("v1.8.") !== 0) { + module2.exports = {nextTick}; + } else { + module2.exports = process; + } + function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== "function") { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } + } +}); + +// node_modules/isarray/index.js +var require_isarray = __commonJS((exports2, module2) => { + var toString = {}.toString; + module2.exports = Array.isArray || function(arr) { + return toString.call(arr) == "[object Array]"; + }; +}); + +// node_modules/readable-stream/lib/internal/streams/stream.js +var require_stream = __commonJS((exports2, module2) => { + module2.exports = require("stream"); +}); + +// node_modules/safe-buffer/index.js +var require_safe_buffer = __commonJS((exports2, module2) => { + var buffer = require("buffer"); + var Buffer2 = buffer.Buffer; + function copyProps(src, dst) { + for (var key in src) { + dst[key] = src[key]; + } + } + if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) { + module2.exports = buffer; + } else { + copyProps(buffer, exports2); + exports2.Buffer = SafeBuffer; + } + function SafeBuffer(arg, encodingOrOffset, length) { + return Buffer2(arg, encodingOrOffset, length); + } + copyProps(Buffer2, SafeBuffer); + SafeBuffer.from = function(arg, encodingOrOffset, length) { + if (typeof arg === "number") { + throw new TypeError("Argument must not be a number"); + } + return Buffer2(arg, encodingOrOffset, length); + }; + SafeBuffer.alloc = function(size, fill, encoding) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); + } + var buf = Buffer2(size); + if (fill !== void 0) { + if (typeof encoding === "string") { + buf.fill(fill, encoding); + } else { + buf.fill(fill); + } + } else { + buf.fill(0); + } + return buf; + }; + SafeBuffer.allocUnsafe = function(size) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); + } + return Buffer2(size); + }; + SafeBuffer.allocUnsafeSlow = function(size) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); + } + return buffer.SlowBuffer(size); + }; +}); + +// node_modules/core-util-is/lib/util.js +var require_util2 = __commonJS((exports2) => { + function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === "[object Array]"; + } + exports2.isArray = isArray; + function isBoolean(arg) { + return typeof arg === "boolean"; + } + exports2.isBoolean = isBoolean; + function isNull(arg) { + return arg === null; + } + exports2.isNull = isNull; + function isNullOrUndefined(arg) { + return arg == null; + } + exports2.isNullOrUndefined = isNullOrUndefined; + function isNumber(arg) { + return typeof arg === "number"; + } + exports2.isNumber = isNumber; + function isString(arg) { + return typeof arg === "string"; + } + exports2.isString = isString; + function isSymbol(arg) { + return typeof arg === "symbol"; + } + exports2.isSymbol = isSymbol; + function isUndefined(arg) { + return arg === void 0; + } + exports2.isUndefined = isUndefined; + function isRegExp(re) { + return objectToString(re) === "[object RegExp]"; + } + exports2.isRegExp = isRegExp; + function isObject3(arg) { + return typeof arg === "object" && arg !== null; + } + exports2.isObject = isObject3; + function isDate(d) { + return objectToString(d) === "[object Date]"; + } + exports2.isDate = isDate; + function isError2(e) { + return objectToString(e) === "[object Error]" || e instanceof Error; + } + exports2.isError = isError2; + function isFunction(arg) { + return typeof arg === "function"; + } + exports2.isFunction = isFunction; + function isPrimitive2(arg) { + return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined"; + } + exports2.isPrimitive = isPrimitive2; + exports2.isBuffer = Buffer.isBuffer; + function objectToString(o) { + return Object.prototype.toString.call(o); + } +}); + +// node_modules/readable-stream/lib/internal/streams/BufferList.js +var require_BufferList = __commonJS((exports2, module2) => { + "use strict"; + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + var Buffer2 = require_safe_buffer().Buffer; + var util = require("util"); + function copyBuffer(src, target, offset) { + src.copy(target, offset); + } + module2.exports = function() { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; + } + BufferList.prototype.push = function push(v) { + var entry = {data: v, next: null}; + if (this.length > 0) + this.tail.next = entry; + else + this.head = entry; + this.tail = entry; + ++this.length; + }; + BufferList.prototype.unshift = function unshift(v) { + var entry = {data: v, next: this.head}; + if (this.length === 0) + this.tail = entry; + this.head = entry; + ++this.length; + }; + BufferList.prototype.shift = function shift() { + if (this.length === 0) + return; + var ret2 = this.head.data; + if (this.length === 1) + this.head = this.tail = null; + else + this.head = this.head.next; + --this.length; + return ret2; + }; + BufferList.prototype.clear = function clear() { + this.head = this.tail = null; + this.length = 0; + }; + BufferList.prototype.join = function join(s) { + if (this.length === 0) + return ""; + var p = this.head; + var ret2 = "" + p.data; + while (p = p.next) { + ret2 += s + p.data; + } + return ret2; + }; + BufferList.prototype.concat = function concat(n) { + if (this.length === 0) + return Buffer2.alloc(0); + if (this.length === 1) + return this.head.data; + var ret2 = Buffer2.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret2, i); + i += p.data.length; + p = p.next; + } + return ret2; + }; + return BufferList; + }(); + if (util && util.inspect && util.inspect.custom) { + module2.exports.prototype[util.inspect.custom] = function() { + var obj = util.inspect({length: this.length}); + return this.constructor.name + " " + obj; + }; + } +}); + +// node_modules/readable-stream/lib/internal/streams/destroy.js +var require_destroy = __commonJS((exports2, module2) => { + "use strict"; + var pna = require_process_nextick_args(); + function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { + pna.nextTick(emitErrorNT, this, err); + } + return this; + } + if (this._readableState) { + this._readableState.destroyed = true; + } + if (this._writableState) { + this._writableState.destroyed = true; + } + this._destroy(err || null, function(err2) { + if (!cb && err2) { + pna.nextTick(emitErrorNT, _this, err2); + if (_this._writableState) { + _this._writableState.errorEmitted = true; + } + } else if (cb) { + cb(err2); + } + }); + return this; + } + function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } + } + function emitErrorNT(self2, err) { + self2.emit("error", err); + } + module2.exports = { + destroy, + undestroy + }; +}); + +// node_modules/util-deprecate/node.js +var require_node2 = __commonJS((exports2, module2) => { + module2.exports = require("util").deprecate; +}); + +// node_modules/readable-stream/lib/_stream_writable.js +var require_stream_writable = __commonJS((exports2, module2) => { + "use strict"; + var pna = require_process_nextick_args(); + module2.exports = Writable; + function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function() { + onCorkedFinish(_this, state); + }; + } + var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; + var Duplex; + Writable.WritableState = WritableState; + var util = Object.create(require_util2()); + util.inherits = require_inherits(); + var internalUtil = { + deprecate: require_node2() + }; + var Stream = require_stream(); + var Buffer2 = require_safe_buffer().Buffer; + var OurUint8Array = global.Uint8Array || function() { + }; + function _uint8ArrayToBuffer(chunk) { + return Buffer2.from(chunk); + } + function _isUint8Array(obj) { + return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array; + } + var destroyImpl = require_destroy(); + util.inherits(Writable, Stream); + function nop() { + } + function WritableState(options, stream) { + Duplex = Duplex || require_stream_duplex(); + options = options || {}; + var isDuplex = stream instanceof Duplex; + this.objectMode = !!options.objectMode; + if (isDuplex) + this.objectMode = this.objectMode || !!options.writableObjectMode; + var hwm = options.highWaterMark; + var writableHwm = options.writableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + if (hwm || hwm === 0) + this.highWaterMark = hwm; + else if (isDuplex && (writableHwm || writableHwm === 0)) + this.highWaterMark = writableHwm; + else + this.highWaterMark = defaultHwm; + this.highWaterMark = Math.floor(this.highWaterMark); + this.finalCalled = false; + this.needDrain = false; + this.ending = false; + this.ended = false; + this.finished = false; + this.destroyed = false; + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + this.defaultEncoding = options.defaultEncoding || "utf8"; + this.length = 0; + this.writing = false; + this.corked = 0; + this.sync = true; + this.bufferProcessing = false; + this.onwrite = function(er) { + onwrite(stream, er); + }; + this.writecb = null; + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + this.pendingcb = 0; + this.prefinished = false; + this.errorEmitted = false; + this.bufferedRequestCount = 0; + this.corkedRequestsFree = new CorkedRequest(this); + } + WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; + }; + (function() { + try { + Object.defineProperty(WritableState.prototype, "buffer", { + get: internalUtil.deprecate(function() { + return this.getBuffer(); + }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") + }); + } catch (_) { + } + })(); + var realHasInstance; + if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function(object) { + if (realHasInstance.call(this, object)) + return true; + if (this !== Writable) + return false; + return object && object._writableState instanceof WritableState; + } + }); + } else { + realHasInstance = function(object) { + return object instanceof this; + }; + } + function Writable(options) { + Duplex = Duplex || require_stream_duplex(); + if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { + return new Writable(options); + } + this._writableState = new WritableState(options, this); + this.writable = true; + if (options) { + if (typeof options.write === "function") + this._write = options.write; + if (typeof options.writev === "function") + this._writev = options.writev; + if (typeof options.destroy === "function") + this._destroy = options.destroy; + if (typeof options.final === "function") + this._final = options.final; + } + Stream.call(this); + } + Writable.prototype.pipe = function() { + this.emit("error", new Error("Cannot pipe, not readable")); + }; + function writeAfterEnd(stream, cb) { + var er = new Error("write after end"); + stream.emit("error", er); + pna.nextTick(cb, er); + } + function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; + if (chunk === null) { + er = new TypeError("May not write null values to stream"); + } else if (typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) { + er = new TypeError("Invalid non-string/buffer chunk"); + } + if (er) { + stream.emit("error", er); + pna.nextTick(cb, er); + valid = false; + } + return valid; + } + Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret2 = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer2.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (typeof encoding === "function") { + cb = encoding; + encoding = null; + } + if (isBuf) + encoding = "buffer"; + else if (!encoding) + encoding = state.defaultEncoding; + if (typeof cb !== "function") + cb = nop; + if (state.ended) + writeAfterEnd(this, cb); + else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret2 = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret2; + }; + Writable.prototype.cork = function() { + var state = this._writableState; + state.corked++; + }; + Writable.prototype.uncork = function() { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) + clearBuffer(this, state); + } + }; + Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + if (typeof encoding === "string") + encoding = encoding.toLowerCase(); + if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) + throw new TypeError("Unknown encoding: " + encoding); + this._writableState.defaultEncoding = encoding; + return this; + }; + function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") { + chunk = Buffer2.from(chunk, encoding); + } + return chunk; + } + Object.defineProperty(Writable.prototype, "writableHighWaterMark", { + enumerable: false, + get: function() { + return this._writableState.highWaterMark; + } + }); + function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = "buffer"; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret2 = state.length < state.highWaterMark; + if (!ret2) + state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk, + encoding, + isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + return ret2; + } + function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) + stream._writev(chunk, state.onwrite); + else + stream._write(chunk, encoding, state.onwrite); + state.sync = false; + } + function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + pna.nextTick(cb, er); + pna.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + stream.emit("error", er); + } else { + cb(er); + stream._writableState.errorEmitted = true; + stream.emit("error", er); + finishMaybe(stream, state); + } + } + function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; + } + function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + onwriteStateUpdate(state); + if (er) + onwriteError(stream, state, sync, er, cb); + else { + var finished = needFinish(state); + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + asyncWrite(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } + } + function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); + } + function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit("drain"); + } + } + function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) + allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, "", holder.finish); + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + if (state.writing) { + break; + } + } + if (entry === null) + state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; + } + Writable.prototype._write = function(chunk, encoding, cb) { + cb(new Error("_write() is not implemented")); + }; + Writable.prototype._writev = null; + Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === "function") { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === "function") { + cb = encoding; + encoding = null; + } + if (chunk !== null && chunk !== void 0) + this.write(chunk, encoding); + if (state.corked) { + state.corked = 1; + this.uncork(); + } + if (!state.ending && !state.finished) + endWritable(this, state, cb); + }; + function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; + } + function callFinal(stream, state) { + stream._final(function(err) { + state.pendingcb--; + if (err) { + stream.emit("error", err); + } + state.prefinished = true; + stream.emit("prefinish"); + finishMaybe(stream, state); + }); + } + function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === "function") { + state.pendingcb++; + state.finalCalled = true; + pna.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit("prefinish"); + } + } + } + function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit("finish"); + } + } + return need; + } + function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + pna.nextTick(cb); + else + stream.once("finish", cb); + } + state.ended = true; + stream.writable = false; + } + function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = corkReq; + } else { + state.corkedRequestsFree = corkReq; + } + } + Object.defineProperty(Writable.prototype, "destroyed", { + get: function() { + if (this._writableState === void 0) { + return false; + } + return this._writableState.destroyed; + }, + set: function(value) { + if (!this._writableState) { + return; + } + this._writableState.destroyed = value; + } + }); + Writable.prototype.destroy = destroyImpl.destroy; + Writable.prototype._undestroy = destroyImpl.undestroy; + Writable.prototype._destroy = function(err, cb) { + this.end(); + cb(err); + }; +}); + +// node_modules/readable-stream/lib/_stream_duplex.js +var require_stream_duplex = __commonJS((exports2, module2) => { + "use strict"; + var pna = require_process_nextick_args(); + var objectKeys = Object.keys || function(obj) { + var keys2 = []; + for (var key in obj) { + keys2.push(key); + } + return keys2; + }; + module2.exports = Duplex; + var util = Object.create(require_util2()); + util.inherits = require_inherits(); + var Readable = require_stream_readable(); + var Writable = require_stream_writable(); + util.inherits(Duplex, Readable); + { + keys = objectKeys(Writable.prototype); + for (v = 0; v < keys.length; v++) { + method = keys[v]; + if (!Duplex.prototype[method]) + Duplex.prototype[method] = Writable.prototype[method]; + } + } + var keys; + var method; + var v; + function Duplex(options) { + if (!(this instanceof Duplex)) + return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + if (options && options.readable === false) + this.readable = false; + if (options && options.writable === false) + this.writable = false; + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) + this.allowHalfOpen = false; + this.once("end", onend); + } + Object.defineProperty(Duplex.prototype, "writableHighWaterMark", { + enumerable: false, + get: function() { + return this._writableState.highWaterMark; + } + }); + function onend() { + if (this.allowHalfOpen || this._writableState.ended) + return; + pna.nextTick(onEndNT, this); + } + function onEndNT(self2) { + self2.end(); + } + Object.defineProperty(Duplex.prototype, "destroyed", { + get: function() { + if (this._readableState === void 0 || this._writableState === void 0) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function(value) { + if (this._readableState === void 0 || this._writableState === void 0) { + return; + } + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } + }); + Duplex.prototype._destroy = function(err, cb) { + this.push(null); + this.end(); + pna.nextTick(cb, err); + }; +}); + +// node_modules/readable-stream/lib/_stream_readable.js +var require_stream_readable = __commonJS((exports2, module2) => { + "use strict"; + var pna = require_process_nextick_args(); + module2.exports = Readable; + var isArray = require_isarray(); + var Duplex; + Readable.ReadableState = ReadableState; + var EE = require("events").EventEmitter; + var EElistenerCount = function(emitter, type) { + return emitter.listeners(type).length; + }; + var Stream = require_stream(); + var Buffer2 = require_safe_buffer().Buffer; + var OurUint8Array = global.Uint8Array || function() { + }; + function _uint8ArrayToBuffer(chunk) { + return Buffer2.from(chunk); + } + function _isUint8Array(obj) { + return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array; + } + var util = Object.create(require_util2()); + util.inherits = require_inherits(); + var debugUtil = require("util"); + var debug = void 0; + if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog("stream"); + } else { + debug = function() { + }; + } + var BufferList = require_BufferList(); + var destroyImpl = require_destroy(); + var StringDecoder; + util.inherits(Readable, Stream); + var kProxyEvents = ["error", "close", "destroy", "pause", "resume"]; + function prependListener(emitter, event, fn) { + if (typeof emitter.prependListener === "function") + return emitter.prependListener(event, fn); + if (!emitter._events || !emitter._events[event]) + emitter.on(event, fn); + else if (isArray(emitter._events[event])) + emitter._events[event].unshift(fn); + else + emitter._events[event] = [fn, emitter._events[event]]; + } + function ReadableState(options, stream) { + Duplex = Duplex || require_stream_duplex(); + options = options || {}; + var isDuplex = stream instanceof Duplex; + this.objectMode = !!options.objectMode; + if (isDuplex) + this.objectMode = this.objectMode || !!options.readableObjectMode; + var hwm = options.highWaterMark; + var readableHwm = options.readableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + if (hwm || hwm === 0) + this.highWaterMark = hwm; + else if (isDuplex && (readableHwm || readableHwm === 0)) + this.highWaterMark = readableHwm; + else + this.highWaterMark = defaultHwm; + this.highWaterMark = Math.floor(this.highWaterMark); + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + this.sync = true; + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.destroyed = false; + this.defaultEncoding = options.defaultEncoding || "utf8"; + this.awaitDrain = 0; + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) + StringDecoder = require("string_decoder/").StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } + } + function Readable(options) { + Duplex = Duplex || require_stream_duplex(); + if (!(this instanceof Readable)) + return new Readable(options); + this._readableState = new ReadableState(options, this); + this.readable = true; + if (options) { + if (typeof options.read === "function") + this._read = options.read; + if (typeof options.destroy === "function") + this._destroy = options.destroy; + } + Stream.call(this); + } + Object.defineProperty(Readable.prototype, "destroyed", { + get: function() { + if (this._readableState === void 0) { + return false; + } + return this._readableState.destroyed; + }, + set: function(value) { + if (!this._readableState) { + return; + } + this._readableState.destroyed = value; + } + }); + Readable.prototype.destroy = destroyImpl.destroy; + Readable.prototype._undestroy = destroyImpl.undestroy; + Readable.prototype._destroy = function(err, cb) { + this.push(null); + cb(err); + }; + Readable.prototype.push = function(chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === "string") { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer2.from(chunk, encoding); + encoding = ""; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); + }; + Readable.prototype.unshift = function(chunk) { + return readableAddChunk(this, chunk, null, true, false); + }; + function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) + er = chunkInvalid(state, chunk); + if (er) { + stream.emit("error", er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) + stream.emit("error", new Error("stream.unshift() after end event")); + else + addChunk(stream, state, chunk, true); + } else if (state.ended) { + stream.emit("error", new Error("stream.push() after EOF")); + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) + addChunk(stream, state, chunk, false); + else + maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + } + } + return needMoreData(state); + } + function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit("data", chunk); + stream.read(0); + } else { + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) + state.buffer.unshift(chunk); + else + state.buffer.push(chunk); + if (state.needReadable) + emitReadable(stream); + } + maybeReadMore(stream, state); + } + function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) { + er = new TypeError("Invalid non-string/buffer chunk"); + } + return er; + } + function needMoreData(state) { + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); + } + Readable.prototype.isPaused = function() { + return this._readableState.flowing === false; + }; + Readable.prototype.setEncoding = function(enc) { + if (!StringDecoder) + StringDecoder = require("string_decoder/").StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; + }; + var MAX_HWM = 8388608; + function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; + } + function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) + return 0; + if (state.objectMode) + return 1; + if (n !== n) { + if (state.flowing && state.length) + return state.buffer.head.data.length; + else + return state.length; + } + if (n > state.highWaterMark) + state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) + return n; + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; + } + Readable.prototype.read = function(n) { + debug("read", n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) + state.emittedReadable = false; + if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + debug("read: emitReadable", state.length, state.ended); + if (state.length === 0 && state.ended) + endReadable(this); + else + emitReadable(this); + return null; + } + n = howMuchToRead(n, state); + if (n === 0 && state.ended) { + if (state.length === 0) + endReadable(this); + return null; + } + var doRead = state.needReadable; + debug("need readable", doRead); + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug("length less than watermark", doRead); + } + if (state.ended || state.reading) { + doRead = false; + debug("reading or ended", doRead); + } else if (doRead) { + debug("do read"); + state.reading = true; + state.sync = true; + if (state.length === 0) + state.needReadable = true; + this._read(state.highWaterMark); + state.sync = false; + if (!state.reading) + n = howMuchToRead(nOrig, state); + } + var ret2; + if (n > 0) + ret2 = fromList(n, state); + else + ret2 = null; + if (ret2 === null) { + state.needReadable = true; + n = 0; + } else { + state.length -= n; + } + if (state.length === 0) { + if (!state.ended) + state.needReadable = true; + if (nOrig !== n && state.ended) + endReadable(this); + } + if (ret2 !== null) + this.emit("data", ret2); + return ret2; + }; + function onEofChunk(stream, state) { + if (state.ended) + return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + emitReadable(stream); + } + function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug("emitReadable", state.flowing); + state.emittedReadable = true; + if (state.sync) + pna.nextTick(emitReadable_, stream); + else + emitReadable_(stream); + } + } + function emitReadable_(stream) { + debug("emit readable"); + stream.emit("readable"); + flow(stream); + } + function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + pna.nextTick(maybeReadMore_, stream, state); + } + } + function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug("maybeReadMore read 0"); + stream.read(0); + if (len === state.length) + break; + else + len = state.length; + } + state.readingMore = false; + } + Readable.prototype._read = function(n) { + this.emit("error", new Error("_read() is not implemented")); + }; + Readable.prototype.pipe = function(dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) + pna.nextTick(endFn); + else + src.once("end", endFn); + dest.on("unpipe", onunpipe); + function onunpipe(readable, unpipeInfo) { + debug("onunpipe"); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + function onend() { + debug("onend"); + dest.end(); + } + var ondrain = pipeOnDrain(src); + dest.on("drain", ondrain); + var cleanedUp = false; + function cleanup() { + debug("cleanup"); + dest.removeListener("close", onclose); + dest.removeListener("finish", onfinish); + dest.removeListener("drain", ondrain); + dest.removeListener("error", onerror); + dest.removeListener("unpipe", onunpipe); + src.removeListener("end", onend); + src.removeListener("end", unpipe); + src.removeListener("data", ondata); + cleanedUp = true; + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) + ondrain(); + } + var increasedAwaitDrain = false; + src.on("data", ondata); + function ondata(chunk) { + debug("ondata"); + increasedAwaitDrain = false; + var ret2 = dest.write(chunk); + if (ret2 === false && !increasedAwaitDrain) { + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug("false write response, pause", src._readableState.awaitDrain); + src._readableState.awaitDrain++; + increasedAwaitDrain = true; + } + src.pause(); + } + } + function onerror(er) { + debug("onerror", er); + unpipe(); + dest.removeListener("error", onerror); + if (EElistenerCount(dest, "error") === 0) + dest.emit("error", er); + } + prependListener(dest, "error", onerror); + function onclose() { + dest.removeListener("finish", onfinish); + unpipe(); + } + dest.once("close", onclose); + function onfinish() { + debug("onfinish"); + dest.removeListener("close", onclose); + unpipe(); + } + dest.once("finish", onfinish); + function unpipe() { + debug("unpipe"); + src.unpipe(dest); + } + dest.emit("pipe", src); + if (!state.flowing) { + debug("pipe resume"); + src.resume(); + } + return dest; + }; + function pipeOnDrain(src) { + return function() { + var state = src._readableState; + debug("pipeOnDrain", state.awaitDrain); + if (state.awaitDrain) + state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, "data")) { + state.flowing = true; + flow(src); + } + }; + } + Readable.prototype.unpipe = function(dest) { + var state = this._readableState; + var unpipeInfo = {hasUnpiped: false}; + if (state.pipesCount === 0) + return this; + if (state.pipesCount === 1) { + if (dest && dest !== state.pipes) + return this; + if (!dest) + dest = state.pipes; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) + dest.emit("unpipe", this, unpipeInfo); + return this; + } + if (!dest) { + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) { + dests[i].emit("unpipe", this, unpipeInfo); + } + return this; + } + var index = indexOf(state.pipes, dest); + if (index === -1) + return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) + state.pipes = state.pipes[0]; + dest.emit("unpipe", this, unpipeInfo); + return this; + }; + Readable.prototype.on = function(ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + if (ev === "data") { + if (this._readableState.flowing !== false) + this.resume(); + } else if (ev === "readable") { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + pna.nextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this); + } + } + } + return res; + }; + Readable.prototype.addListener = Readable.prototype.on; + function nReadingNextTick(self2) { + debug("readable nexttick read 0"); + self2.read(0); + } + Readable.prototype.resume = function() { + var state = this._readableState; + if (!state.flowing) { + debug("resume"); + state.flowing = true; + resume(this, state); + } + return this; + }; + function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + pna.nextTick(resume_, stream, state); + } + } + function resume_(stream, state) { + if (!state.reading) { + debug("resume read 0"); + stream.read(0); + } + state.resumeScheduled = false; + state.awaitDrain = 0; + stream.emit("resume"); + flow(stream); + if (state.flowing && !state.reading) + stream.read(0); + } + Readable.prototype.pause = function() { + debug("call pause flowing=%j", this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug("pause"); + this._readableState.flowing = false; + this.emit("pause"); + } + return this; + }; + function flow(stream) { + var state = stream._readableState; + debug("flow", state.flowing); + while (state.flowing && stream.read() !== null) { + } + } + Readable.prototype.wrap = function(stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on("end", function() { + debug("wrapped end"); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) + _this.push(chunk); + } + _this.push(null); + }); + stream.on("data", function(chunk) { + debug("wrapped data"); + if (state.decoder) + chunk = state.decoder.write(chunk); + if (state.objectMode && (chunk === null || chunk === void 0)) + return; + else if (!state.objectMode && (!chunk || !chunk.length)) + return; + var ret2 = _this.push(chunk); + if (!ret2) { + paused = true; + stream.pause(); + } + }); + for (var i in stream) { + if (this[i] === void 0 && typeof stream[i] === "function") { + this[i] = function(method) { + return function() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + this._read = function(n2) { + debug("wrapped _read", n2); + if (paused) { + paused = false; + stream.resume(); + } + }; + return this; + }; + Object.defineProperty(Readable.prototype, "readableHighWaterMark", { + enumerable: false, + get: function() { + return this._readableState.highWaterMark; + } + }); + Readable._fromList = fromList; + function fromList(n, state) { + if (state.length === 0) + return null; + var ret2; + if (state.objectMode) + ret2 = state.buffer.shift(); + else if (!n || n >= state.length) { + if (state.decoder) + ret2 = state.buffer.join(""); + else if (state.buffer.length === 1) + ret2 = state.buffer.head.data; + else + ret2 = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + ret2 = fromListPartial(n, state.buffer, state.decoder); + } + return ret2; + } + function fromListPartial(n, list, hasStrings) { + var ret2; + if (n < list.head.data.length) { + ret2 = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + ret2 = list.shift(); + } else { + ret2 = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); + } + return ret2; + } + function copyFromBufferString(n, list) { + var p = list.head; + var c = 1; + var ret2 = p.data; + n -= ret2.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) + ret2 += str; + else + ret2 += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) + list.head = p.next; + else + list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret2; + } + function copyFromBuffer(n, list) { + var ret2 = Buffer2.allocUnsafe(n); + var p = list.head; + var c = 1; + p.data.copy(ret2); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret2, ret2.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) + list.head = p.next; + else + list.head = list.tail = null; + } else { + list.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret2; + } + function endReadable(stream) { + var state = stream._readableState; + if (state.length > 0) + throw new Error('"endReadable()" called on non-empty stream'); + if (!state.endEmitted) { + state.ended = true; + pna.nextTick(endReadableNT, state, stream); + } + } + function endReadableNT(state, stream) { + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit("end"); + } + } + function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) + return i; + } + return -1; + } +}); + +// node_modules/readable-stream/lib/_stream_transform.js +var require_stream_transform = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = Transform; + var Duplex = require_stream_duplex(); + var util = Object.create(require_util2()); + util.inherits = require_inherits(); + util.inherits(Transform, Duplex); + function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (!cb) { + return this.emit("error", new Error("write callback called multiple times")); + } + ts.writechunk = null; + ts.writecb = null; + if (data != null) + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } + } + function Transform(options) { + if (!(this instanceof Transform)) + return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + this._readableState.needReadable = true; + this._readableState.sync = false; + if (options) { + if (typeof options.transform === "function") + this._transform = options.transform; + if (typeof options.flush === "function") + this._flush = options.flush; + } + this.on("prefinish", prefinish); + } + function prefinish() { + var _this = this; + if (typeof this._flush === "function") { + this._flush(function(er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } + } + Transform.prototype.push = function(chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); + }; + Transform.prototype._transform = function(chunk, encoding, cb) { + throw new Error("_transform() is not implemented"); + }; + Transform.prototype._write = function(chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) + this._read(rs.highWaterMark); + } + }; + Transform.prototype._read = function(n) { + var ts = this._transformState; + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + ts.needTransform = true; + } + }; + Transform.prototype._destroy = function(err, cb) { + var _this2 = this; + Duplex.prototype._destroy.call(this, err, function(err2) { + cb(err2); + _this2.emit("close"); + }); + }; + function done(stream, er, data) { + if (er) + return stream.emit("error", er); + if (data != null) + stream.push(data); + if (stream._writableState.length) + throw new Error("Calling transform done when ws.length != 0"); + if (stream._transformState.transforming) + throw new Error("Calling transform done when still transforming"); + return stream.push(null); + } +}); + +// node_modules/readable-stream/lib/_stream_passthrough.js +var require_stream_passthrough = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = PassThrough; + var Transform = require_stream_transform(); + var util = Object.create(require_util2()); + util.inherits = require_inherits(); + util.inherits(PassThrough, Transform); + function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); + Transform.call(this, options); + } + PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); + }; +}); + +// node_modules/readable-stream/readable.js +var require_readable = __commonJS((exports2, module2) => { + var Stream = require("stream"); + if (process.env.READABLE_STREAM === "disable" && Stream) { + module2.exports = Stream; + exports2 = module2.exports = Stream.Readable; + exports2.Readable = Stream.Readable; + exports2.Writable = Stream.Writable; + exports2.Duplex = Stream.Duplex; + exports2.Transform = Stream.Transform; + exports2.PassThrough = Stream.PassThrough; + exports2.Stream = Stream; + } else { + exports2 = module2.exports = require_stream_readable(); + exports2.Stream = Stream || exports2; + exports2.Readable = exports2; + exports2.Writable = require_stream_writable(); + exports2.Duplex = require_stream_duplex(); + exports2.Transform = require_stream_transform(); + exports2.PassThrough = require_stream_passthrough(); + } +}); + +// node_modules/unzipper/lib/PullStream.js +var require_PullStream = __commonJS((exports2, module2) => { + var Stream = require("stream"); + var Promise2 = require_bluebird(); + var util = require("util"); + var Buffer2 = require_Buffer(); + var strFunction = "function"; + if (!Stream.Writable || !Stream.Writable.prototype.destroy) + Stream = require_readable(); + function PullStream() { + if (!(this instanceof PullStream)) + return new PullStream(); + Stream.Duplex.call(this, {decodeStrings: false, objectMode: true}); + this.buffer = Buffer2.from(""); + var self2 = this; + self2.on("finish", function() { + self2.finished = true; + self2.emit("chunk", false); + }); + } + util.inherits(PullStream, Stream.Duplex); + PullStream.prototype._write = function(chunk, e, cb) { + this.buffer = Buffer2.concat([this.buffer, chunk]); + this.cb = cb; + this.emit("chunk"); + }; + PullStream.prototype.stream = function(eof, includeEof) { + var p = Stream.PassThrough(); + var done, self2 = this; + function cb() { + if (typeof self2.cb === strFunction) { + var callback = self2.cb; + self2.cb = void 0; + return callback(); + } + } + function pull() { + var packet; + if (self2.buffer && self2.buffer.length) { + if (typeof eof === "number") { + packet = self2.buffer.slice(0, eof); + self2.buffer = self2.buffer.slice(eof); + eof -= packet.length; + done = !eof; + } else { + var match = self2.buffer.indexOf(eof); + if (match !== -1) { + self2.match = match; + if (includeEof) + match = match + eof.length; + packet = self2.buffer.slice(0, match); + self2.buffer = self2.buffer.slice(match); + done = true; + } else { + var len = self2.buffer.length - eof.length; + if (len <= 0) { + cb(); + } else { + packet = self2.buffer.slice(0, len); + self2.buffer = self2.buffer.slice(len); + } + } + } + if (packet) + p.write(packet, function() { + if (self2.buffer.length === 0 || eof.length && self2.buffer.length <= eof.length) + cb(); + }); + } + if (!done) { + if (self2.finished && !this.__ended) { + self2.removeListener("chunk", pull); + self2.emit("error", new Error("FILE_ENDED")); + this.__ended = true; + return; + } + } else { + self2.removeListener("chunk", pull); + p.end(); + } + } + self2.on("chunk", pull); + pull(); + return p; + }; + PullStream.prototype.pull = function(eof, includeEof) { + if (eof === 0) + return Promise2.resolve(""); + if (!isNaN(eof) && this.buffer.length > eof) { + var data = this.buffer.slice(0, eof); + this.buffer = this.buffer.slice(eof); + return Promise2.resolve(data); + } + var buffer = Buffer2.from(""), self2 = this; + var concatStream = Stream.Transform(); + concatStream._transform = function(d, e, cb) { + buffer = Buffer2.concat([buffer, d]); + cb(); + }; + var rejectHandler; + var pullStreamRejectHandler; + return new Promise2(function(resolve, reject) { + rejectHandler = reject; + pullStreamRejectHandler = function(e) { + self2.__emittedError = e; + reject(e); + }; + if (self2.finished) + return reject(new Error("FILE_ENDED")); + self2.once("error", pullStreamRejectHandler); + self2.stream(eof, includeEof).on("error", reject).pipe(concatStream).on("finish", function() { + resolve(buffer); + }).on("error", reject); + }).finally(function() { + self2.removeListener("error", rejectHandler); + self2.removeListener("error", pullStreamRejectHandler); + }); + }; + PullStream.prototype._read = function() { + }; + module2.exports = PullStream; +}); + +// node_modules/unzipper/lib/NoopStream.js +var require_NoopStream = __commonJS((exports2, module2) => { + var Stream = require("stream"); + var util = require("util"); + if (!Stream.Writable || !Stream.Writable.prototype.destroy) + Stream = require_readable(); + function NoopStream() { + if (!(this instanceof NoopStream)) { + return new NoopStream(); + } + Stream.Transform.call(this); + } + util.inherits(NoopStream, Stream.Transform); + NoopStream.prototype._transform = function(d, e, cb) { + cb(); + }; + module2.exports = NoopStream; +}); + +// node_modules/unzipper/lib/BufferStream.js +var require_BufferStream = __commonJS((exports2, module2) => { + var Promise2 = require_bluebird(); + var Stream = require("stream"); + var Buffer2 = require_Buffer(); + if (!Stream.Writable || !Stream.Writable.prototype.destroy) + Stream = require_readable(); + module2.exports = function(entry) { + return new Promise2(function(resolve, reject) { + var chunks = []; + var bufferStream = Stream.Transform().on("finish", function() { + resolve(Buffer2.concat(chunks)); + }).on("error", reject); + bufferStream._transform = function(d, e, cb) { + chunks.push(d); + cb(); + }; + entry.on("error", reject).pipe(bufferStream); + }); + }; +}); + +// node_modules/unzipper/lib/parseExtraField.js +var require_parseExtraField = __commonJS((exports2, module2) => { + var binary = require_binary(); + module2.exports = function(extraField, vars) { + var extra; + while (!extra && extraField && extraField.length) { + var candidateExtra = binary.parse(extraField).word16lu("signature").word16lu("partsize").word64lu("uncompressedSize").word64lu("compressedSize").word64lu("offset").word64lu("disknum").vars; + if (candidateExtra.signature === 1) { + extra = candidateExtra; + } else { + extraField = extraField.slice(candidateExtra.partsize + 4); + } + } + extra = extra || {}; + if (vars.compressedSize === 4294967295) + vars.compressedSize = extra.compressedSize; + if (vars.uncompressedSize === 4294967295) + vars.uncompressedSize = extra.uncompressedSize; + if (vars.offsetToLocalFileHeader === 4294967295) + vars.offsetToLocalFileHeader = extra.offset; + return extra; + }; +}); + +// node_modules/unzipper/lib/parseDateTime.js +var require_parseDateTime = __commonJS((exports2, module2) => { + module2.exports = function parseDateTime(date, time) { + const day = date & 31; + const month = date >> 5 & 15; + const year = (date >> 9 & 127) + 1980; + const seconds = time ? (time & 31) * 2 : 0; + const minutes = time ? time >> 5 & 63 : 0; + const hours = time ? time >> 11 : 0; + return new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds)); + }; +}); + +// node_modules/unzipper/lib/parse.js +var require_parse3 = __commonJS((exports2, module2) => { + var util = require("util"); + var zlib = require("zlib"); + var Stream = require("stream"); + var binary = require_binary(); + var Promise2 = require_bluebird(); + var PullStream = require_PullStream(); + var NoopStream = require_NoopStream(); + var BufferStream = require_BufferStream(); + var parseExtraField = require_parseExtraField(); + var Buffer2 = require_Buffer(); + var parseDateTime = require_parseDateTime(); + if (!Stream.Writable || !Stream.Writable.prototype.destroy) + Stream = require_readable(); + var endDirectorySignature = Buffer2.alloc(4); + endDirectorySignature.writeUInt32LE(101010256, 0); + function Parse(opts) { + if (!(this instanceof Parse)) { + return new Parse(opts); + } + var self2 = this; + self2._opts = opts || {verbose: false}; + PullStream.call(self2, self2._opts); + self2.on("finish", function() { + self2.emit("close"); + }); + self2._readRecord().catch(function(e) { + if (!self2.__emittedError || self2.__emittedError !== e) + self2.emit("error", e); + }); + } + util.inherits(Parse, PullStream); + Parse.prototype._readRecord = function() { + var self2 = this; + return self2.pull(4).then(function(data) { + if (data.length === 0) + return; + var signature = data.readUInt32LE(0); + if (signature === 875721283) { + return self2._readCrxHeader(); + } + if (signature === 67324752) { + return self2._readFile(); + } else if (signature === 33639248) { + self2.__ended = true; + return self2._readCentralDirectoryFileHeader(); + } else if (signature === 101010256) { + return self2._readEndOfCentralDirectoryRecord(); + } else if (self2.__ended) { + return self2.pull(endDirectorySignature).then(function() { + return self2._readEndOfCentralDirectoryRecord(); + }); + } else + self2.emit("error", new Error("invalid signature: 0x" + signature.toString(16))); + }); + }; + Parse.prototype._readCrxHeader = function() { + var self2 = this; + return self2.pull(12).then(function(data) { + self2.crxHeader = binary.parse(data).word32lu("version").word32lu("pubKeyLength").word32lu("signatureLength").vars; + return self2.pull(self2.crxHeader.pubKeyLength + self2.crxHeader.signatureLength); + }).then(function(data) { + self2.crxHeader.publicKey = data.slice(0, self2.crxHeader.pubKeyLength); + self2.crxHeader.signature = data.slice(self2.crxHeader.pubKeyLength); + self2.emit("crx-header", self2.crxHeader); + return self2._readRecord(); + }); + }; + Parse.prototype._readFile = function() { + var self2 = this; + return self2.pull(26).then(function(data) { + var vars = binary.parse(data).word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").vars; + vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime); + if (self2.crxHeader) + vars.crxHeader = self2.crxHeader; + return self2.pull(vars.fileNameLength).then(function(fileNameBuffer) { + var fileName = fileNameBuffer.toString("utf8"); + var entry = Stream.PassThrough(); + var __autodraining = false; + entry.autodrain = function() { + __autodraining = true; + var draining = entry.pipe(NoopStream()); + draining.promise = function() { + return new Promise2(function(resolve, reject) { + draining.on("finish", resolve); + draining.on("error", reject); + }); + }; + return draining; + }; + entry.buffer = function() { + return BufferStream(entry); + }; + entry.path = fileName; + entry.props = {}; + entry.props.path = fileName; + entry.props.pathBuffer = fileNameBuffer; + entry.props.flags = { + isUnicode: vars.flags & 17 + }; + entry.type = vars.uncompressedSize === 0 && /[\/\\]$/.test(fileName) ? "Directory" : "File"; + if (self2._opts.verbose) { + if (entry.type === "Directory") { + console.log(" creating:", fileName); + } else if (entry.type === "File") { + if (vars.compressionMethod === 0) { + console.log(" extracting:", fileName); + } else { + console.log(" inflating:", fileName); + } + } + } + return self2.pull(vars.extraFieldLength).then(function(extraField) { + var extra = parseExtraField(extraField, vars); + entry.vars = vars; + entry.extra = extra; + if (self2._opts.forceStream) { + self2.push(entry); + } else { + self2.emit("entry", entry); + if (self2._readableState.pipesCount || self2._readableState.pipes && self2._readableState.pipes.length) + self2.push(entry); + } + if (self2._opts.verbose) + console.log({ + filename: fileName, + vars, + extra + }); + var fileSizeKnown = !(vars.flags & 8) || vars.compressedSize > 0, eof; + entry.__autodraining = __autodraining; + var inflater = vars.compressionMethod && !__autodraining ? zlib.createInflateRaw() : Stream.PassThrough(); + if (fileSizeKnown) { + entry.size = vars.uncompressedSize; + eof = vars.compressedSize; + } else { + eof = Buffer2.alloc(4); + eof.writeUInt32LE(134695760, 0); + } + return new Promise2(function(resolve, reject) { + self2.stream(eof).pipe(inflater).on("error", function(err) { + self2.emit("error", err); + }).pipe(entry).on("finish", function() { + return fileSizeKnown ? self2._readRecord().then(resolve).catch(reject) : self2._processDataDescriptor(entry).then(resolve).catch(reject); + }); + }); + }); + }); + }); + }; + Parse.prototype._processDataDescriptor = function(entry) { + var self2 = this; + return self2.pull(16).then(function(data) { + var vars = binary.parse(data).word32lu("dataDescriptorSignature").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").vars; + entry.size = vars.uncompressedSize; + return self2._readRecord(); + }); + }; + Parse.prototype._readCentralDirectoryFileHeader = function() { + var self2 = this; + return self2.pull(42).then(function(data) { + var vars = binary.parse(data).word16lu("versionMadeBy").word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").word16lu("fileCommentLength").word16lu("diskNumber").word16lu("internalFileAttributes").word32lu("externalFileAttributes").word32lu("offsetToLocalFileHeader").vars; + return self2.pull(vars.fileNameLength).then(function(fileName) { + vars.fileName = fileName.toString("utf8"); + return self2.pull(vars.extraFieldLength); + }).then(function(extraField) { + return self2.pull(vars.fileCommentLength); + }).then(function(fileComment) { + return self2._readRecord(); + }); + }); + }; + Parse.prototype._readEndOfCentralDirectoryRecord = function() { + var self2 = this; + return self2.pull(18).then(function(data) { + var vars = binary.parse(data).word16lu("diskNumber").word16lu("diskStart").word16lu("numberOfRecordsOnDisk").word16lu("numberOfRecords").word32lu("sizeOfCentralDirectory").word32lu("offsetToStartOfCentralDirectory").word16lu("commentLength").vars; + return self2.pull(vars.commentLength).then(function(comment) { + comment = comment.toString("utf8"); + self2.end(); + self2.push(null); + }); + }); + }; + Parse.prototype.promise = function() { + var self2 = this; + return new Promise2(function(resolve, reject) { + self2.on("finish", resolve); + self2.on("error", reject); + }); + }; + module2.exports = Parse; +}); + +// node_modules/duplexer2/index.js +var require_duplexer2 = __commonJS((exports2, module2) => { + "use strict"; + var stream = require_readable(); + function DuplexWrapper(options, writable, readable) { + if (typeof readable === "undefined") { + readable = writable; + writable = options; + options = null; + } + stream.Duplex.call(this, options); + if (typeof readable.read !== "function") { + readable = new stream.Readable(options).wrap(readable); + } + this._writable = writable; + this._readable = readable; + this._waiting = false; + var self2 = this; + writable.once("finish", function() { + self2.end(); + }); + this.once("finish", function() { + writable.end(); + }); + readable.on("readable", function() { + if (self2._waiting) { + self2._waiting = false; + self2._read(); + } + }); + readable.once("end", function() { + self2.push(null); + }); + if (!options || typeof options.bubbleErrors === "undefined" || options.bubbleErrors) { + writable.on("error", function(err) { + self2.emit("error", err); + }); + readable.on("error", function(err) { + self2.emit("error", err); + }); + } + } + DuplexWrapper.prototype = Object.create(stream.Duplex.prototype, {constructor: {value: DuplexWrapper}}); + DuplexWrapper.prototype._write = function _write(input, encoding, done) { + this._writable.write(input, encoding, done); + }; + DuplexWrapper.prototype._read = function _read() { + var buf; + var reads = 0; + while ((buf = this._readable.read()) !== null) { + this.push(buf); + reads++; + } + if (reads === 0) { + this._waiting = true; + } + }; + module2.exports = function duplex2(options, writable, readable) { + return new DuplexWrapper(options, writable, readable); + }; + module2.exports.DuplexWrapper = DuplexWrapper; +}); + +// node_modules/unzipper/lib/parseOne.js +var require_parseOne = __commonJS((exports2, module2) => { + var Stream = require("stream"); + var Parse = require_parse3(); + var duplexer2 = require_duplexer2(); + var BufferStream = require_BufferStream(); + if (!Stream.Writable || !Stream.Writable.prototype.destroy) + Stream = require_readable(); + function parseOne(match, opts) { + var inStream = Stream.PassThrough({objectMode: true}); + var outStream = Stream.PassThrough(); + var transform = Stream.Transform({objectMode: true}); + var re = match instanceof RegExp ? match : match && new RegExp(match); + var found; + transform._transform = function(entry, e, cb) { + if (found || re && !re.exec(entry.path)) { + entry.autodrain(); + return cb(); + } else { + found = true; + out.emit("entry", entry); + entry.on("error", function(e2) { + outStream.emit("error", e2); + }); + entry.pipe(outStream).on("error", function(err) { + cb(err); + }).on("finish", function(d) { + cb(null, d); + }); + } + }; + inStream.pipe(Parse(opts)).on("error", function(err) { + outStream.emit("error", err); + }).pipe(transform).on("error", Object).on("finish", function() { + if (!found) + outStream.emit("error", new Error("PATTERN_NOT_FOUND")); + else + outStream.end(); + }); + var out = duplexer2(inStream, outStream); + out.buffer = function() { + return BufferStream(outStream); + }; + return out; + } + module2.exports = parseOne; +}); + +// node_modules/fstream/lib/abstract.js +var require_abstract = __commonJS((exports2, module2) => { + module2.exports = Abstract; + var Stream = require("stream").Stream; + var inherits2 = require_inherits(); + function Abstract() { + Stream.call(this); + } + inherits2(Abstract, Stream); + Abstract.prototype.on = function(ev, fn) { + if (ev === "ready" && this.ready) { + process.nextTick(fn.bind(this)); + } else { + Stream.prototype.on.call(this, ev, fn); + } + return this; + }; + Abstract.prototype.abort = function() { + this._aborted = true; + this.emit("abort"); + }; + Abstract.prototype.destroy = function() { + }; + Abstract.prototype.warn = function(msg, code) { + var self2 = this; + var er = decorate(msg, code, self2); + if (!self2.listeners("warn")) { + console.error("%s %s\npath = %s\nsyscall = %s\nfstream_type = %s\nfstream_path = %s\nfstream_unc_path = %s\nfstream_class = %s\nfstream_stack =\n%s\n", code || "UNKNOWN", er.stack, er.path, er.syscall, er.fstream_type, er.fstream_path, er.fstream_unc_path, er.fstream_class, er.fstream_stack.join("\n")); + } else { + self2.emit("warn", er); + } + }; + Abstract.prototype.info = function(msg, code) { + this.emit("info", msg, code); + }; + Abstract.prototype.error = function(msg, code, th) { + var er = decorate(msg, code, this); + if (th) + throw er; + else + this.emit("error", er); + }; + function decorate(er, code, self2) { + if (!(er instanceof Error)) + er = new Error(er); + er.code = er.code || code; + er.path = er.path || self2.path; + er.fstream_type = er.fstream_type || self2.type; + er.fstream_path = er.fstream_path || self2.path; + if (self2._path !== self2.path) { + er.fstream_unc_path = er.fstream_unc_path || self2._path; + } + if (self2.linkpath) { + er.fstream_linkpath = er.fstream_linkpath || self2.linkpath; + } + er.fstream_class = er.fstream_class || self2.constructor.name; + er.fstream_stack = er.fstream_stack || new Error().stack.split(/\n/).slice(3).map(function(s) { + return s.replace(/^ {4}at /, ""); + }); + return er; + } +}); + +// node_modules/graceful-fs/polyfills.js +var require_polyfills = __commonJS((exports2, module2) => { + var constants = require("constants"); + var origCwd = process.cwd; + var cwd = null; + var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform; + process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process); + return cwd; + }; + try { + process.cwd(); + } catch (er) { + } + var chdir = process.chdir; + process.chdir = function(d) { + cwd = null; + chdir.call(process, d); + }; + module2.exports = patch; + function patch(fs) { + if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs); + } + if (!fs.lutimes) { + patchLutimes(fs); + } + fs.chown = chownFix(fs.chown); + fs.fchown = chownFix(fs.fchown); + fs.lchown = chownFix(fs.lchown); + fs.chmod = chmodFix(fs.chmod); + fs.fchmod = chmodFix(fs.fchmod); + fs.lchmod = chmodFix(fs.lchmod); + fs.chownSync = chownFixSync(fs.chownSync); + fs.fchownSync = chownFixSync(fs.fchownSync); + fs.lchownSync = chownFixSync(fs.lchownSync); + fs.chmodSync = chmodFixSync(fs.chmodSync); + fs.fchmodSync = chmodFixSync(fs.fchmodSync); + fs.lchmodSync = chmodFixSync(fs.lchmodSync); + fs.stat = statFix(fs.stat); + fs.fstat = statFix(fs.fstat); + fs.lstat = statFix(fs.lstat); + fs.statSync = statFixSync(fs.statSync); + fs.fstatSync = statFixSync(fs.fstatSync); + fs.lstatSync = statFixSync(fs.lstatSync); + if (!fs.lchmod) { + fs.lchmod = function(path, mode, cb) { + if (cb) + process.nextTick(cb); + }; + fs.lchmodSync = function() { + }; + } + if (!fs.lchown) { + fs.lchown = function(path, uid, gid, cb) { + if (cb) + process.nextTick(cb); + }; + fs.lchownSync = function() { + }; + } + if (platform === "win32") { + fs.rename = function(fs$rename) { + return function(from, to, cb) { + var start = Date.now(); + var backoff = 0; + fs$rename(from, to, function CB(er) { + if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) { + setTimeout(function() { + fs.stat(to, function(stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er); + }); + }, backoff); + if (backoff < 100) + backoff += 10; + return; + } + if (cb) + cb(er); + }); + }; + }(fs.rename); + } + fs.read = function(fs$read) { + function read(fd, buffer, offset, length, position, callback_) { + var callback; + if (callback_ && typeof callback_ === "function") { + var eagCounter = 0; + callback = function(er, _, __) { + if (er && er.code === "EAGAIN" && eagCounter < 10) { + eagCounter++; + return fs$read.call(fs, fd, buffer, offset, length, position, callback); + } + callback_.apply(this, arguments); + }; + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback); + } + read.__proto__ = fs$read; + return read; + }(fs.read); + fs.readSync = function(fs$readSync) { + return function(fd, buffer, offset, length, position) { + var eagCounter = 0; + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position); + } catch (er) { + if (er.code === "EAGAIN" && eagCounter < 10) { + eagCounter++; + continue; + } + throw er; + } + } + }; + }(fs.readSync); + function patchLchmod(fs2) { + fs2.lchmod = function(path, mode, callback) { + fs2.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) { + if (err) { + if (callback) + callback(err); + return; + } + fs2.fchmod(fd, mode, function(err2) { + fs2.close(fd, function(err22) { + if (callback) + callback(err2 || err22); + }); + }); + }); + }; + fs2.lchmodSync = function(path, mode) { + var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode); + var threw = true; + var ret2; + try { + ret2 = fs2.fchmodSync(fd, mode); + threw = false; + } finally { + if (threw) { + try { + fs2.closeSync(fd); + } catch (er) { + } + } else { + fs2.closeSync(fd); + } + } + return ret2; + }; + } + function patchLutimes(fs2) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs2.lutimes = function(path, at, mt, cb) { + fs2.open(path, constants.O_SYMLINK, function(er, fd) { + if (er) { + if (cb) + cb(er); + return; + } + fs2.futimes(fd, at, mt, function(er2) { + fs2.close(fd, function(er22) { + if (cb) + cb(er2 || er22); + }); + }); + }); + }; + fs2.lutimesSync = function(path, at, mt) { + var fd = fs2.openSync(path, constants.O_SYMLINK); + var ret2; + var threw = true; + try { + ret2 = fs2.futimesSync(fd, at, mt); + threw = false; + } finally { + if (threw) { + try { + fs2.closeSync(fd); + } catch (er) { + } + } else { + fs2.closeSync(fd); + } + } + return ret2; + }; + } else { + fs2.lutimes = function(_a, _b, _c, cb) { + if (cb) + process.nextTick(cb); + }; + fs2.lutimesSync = function() { + }; + } + } + function chmodFix(orig) { + if (!orig) + return orig; + return function(target, mode, cb) { + return orig.call(fs, target, mode, function(er) { + if (chownErOk(er)) + er = null; + if (cb) + cb.apply(this, arguments); + }); + }; + } + function chmodFixSync(orig) { + if (!orig) + return orig; + return function(target, mode) { + try { + return orig.call(fs, target, mode); + } catch (er) { + if (!chownErOk(er)) + throw er; + } + }; + } + function chownFix(orig) { + if (!orig) + return orig; + return function(target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function(er) { + if (chownErOk(er)) + er = null; + if (cb) + cb.apply(this, arguments); + }); + }; + } + function chownFixSync(orig) { + if (!orig) + return orig; + return function(target, uid, gid) { + try { + return orig.call(fs, target, uid, gid); + } catch (er) { + if (!chownErOk(er)) + throw er; + } + }; + } + function statFix(orig) { + if (!orig) + return orig; + return function(target, options, cb) { + if (typeof options === "function") { + cb = options; + options = null; + } + function callback(er, stats) { + if (stats) { + if (stats.uid < 0) + stats.uid += 4294967296; + if (stats.gid < 0) + stats.gid += 4294967296; + } + if (cb) + cb.apply(this, arguments); + } + return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback); + }; + } + function statFixSync(orig) { + if (!orig) + return orig; + return function(target, options) { + var stats = options ? orig.call(fs, target, options) : orig.call(fs, target); + if (stats.uid < 0) + stats.uid += 4294967296; + if (stats.gid < 0) + stats.gid += 4294967296; + return stats; + }; + } + function chownErOk(er) { + if (!er) + return true; + if (er.code === "ENOSYS") + return true; + var nonroot = !process.getuid || process.getuid() !== 0; + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true; + } + return false; + } + } +}); + +// node_modules/graceful-fs/legacy-streams.js +var require_legacy_streams = __commonJS((exports2, module2) => { + var Stream = require("stream").Stream; + module2.exports = legacy; + function legacy(fs) { + return { + ReadStream, + WriteStream + }; + function ReadStream(path, options) { + if (!(this instanceof ReadStream)) + return new ReadStream(path, options); + Stream.call(this); + var self2 = this; + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; + this.flags = "r"; + this.mode = 438; + this.bufferSize = 64 * 1024; + options = options || {}; + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + if (this.encoding) + this.setEncoding(this.encoding); + if (this.start !== void 0) { + if (typeof this.start !== "number") { + throw TypeError("start must be a Number"); + } + if (this.end === void 0) { + this.end = Infinity; + } else if (typeof this.end !== "number") { + throw TypeError("end must be a Number"); + } + if (this.start > this.end) { + throw new Error("start must be <= end"); + } + this.pos = this.start; + } + if (this.fd !== null) { + process.nextTick(function() { + self2._read(); + }); + return; + } + fs.open(this.path, this.flags, this.mode, function(err, fd) { + if (err) { + self2.emit("error", err); + self2.readable = false; + return; + } + self2.fd = fd; + self2.emit("open", fd); + self2._read(); + }); + } + function WriteStream(path, options) { + if (!(this instanceof WriteStream)) + return new WriteStream(path, options); + Stream.call(this); + this.path = path; + this.fd = null; + this.writable = true; + this.flags = "w"; + this.encoding = "binary"; + this.mode = 438; + this.bytesWritten = 0; + options = options || {}; + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + if (this.start !== void 0) { + if (typeof this.start !== "number") { + throw TypeError("start must be a Number"); + } + if (this.start < 0) { + throw new Error("start must be >= zero"); + } + this.pos = this.start; + } + this.busy = false; + this._queue = []; + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, void 0]); + this.flush(); + } + } + } +}); + +// node_modules/graceful-fs/clone.js +var require_clone = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = clone; + function clone(obj) { + if (obj === null || typeof obj !== "object") + return obj; + if (obj instanceof Object) + var copy = {__proto__: obj.__proto__}; + else + var copy = Object.create(null); + Object.getOwnPropertyNames(obj).forEach(function(key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)); + }); + return copy; + } +}); + +// node_modules/graceful-fs/graceful-fs.js +var require_graceful_fs = __commonJS((exports2, module2) => { + var fs = require("fs"); + var polyfills = require_polyfills(); + var legacy = require_legacy_streams(); + var clone = require_clone(); + var util = require("util"); + var gracefulQueue; + var previousSymbol; + if (typeof Symbol === "function" && typeof Symbol.for === "function") { + gracefulQueue = Symbol.for("graceful-fs.queue"); + previousSymbol = Symbol.for("graceful-fs.previous"); + } else { + gracefulQueue = "___graceful-fs.queue"; + previousSymbol = "___graceful-fs.previous"; + } + function noop() { + } + function publishQueue(context, queue2) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue2; + } + }); + } + var debug = noop; + if (util.debuglog) + debug = util.debuglog("gfs4"); + else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) + debug = function() { + var m = util.format.apply(util, arguments); + m = "GFS4: " + m.split(/\n/).join("\nGFS4: "); + console.error(m); + }; + if (!fs[gracefulQueue]) { + queue = global[gracefulQueue] || []; + publishQueue(fs, queue); + fs.close = function(fs$close) { + function close(fd, cb) { + return fs$close.call(fs, fd, function(err) { + if (!err) { + retry(); + } + if (typeof cb === "function") + cb.apply(this, arguments); + }); + } + Object.defineProperty(close, previousSymbol, { + value: fs$close + }); + return close; + }(fs.close); + fs.closeSync = function(fs$closeSync) { + function closeSync(fd) { + fs$closeSync.apply(fs, arguments); + retry(); + } + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }); + return closeSync; + }(fs.closeSync); + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) { + process.on("exit", function() { + debug(fs[gracefulQueue]); + require("assert").equal(fs[gracefulQueue].length, 0); + }); + } + } + var queue; + if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); + } + module2.exports = patch(clone(fs)); + if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module2.exports = patch(fs); + fs.__patched = true; + } + function patch(fs2) { + polyfills(fs2); + fs2.gracefulify = patch; + fs2.createReadStream = createReadStream; + fs2.createWriteStream = createWriteStream; + var fs$readFile = fs2.readFile; + fs2.readFile = readFile; + function readFile(path, options, cb) { + if (typeof options === "function") + cb = options, options = null; + return go$readFile(path, options, cb); + function go$readFile(path2, options2, cb2) { + return fs$readFile(path2, options2, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$readFile, [path2, options2, cb2]]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + retry(); + } + }); + } + } + var fs$writeFile = fs2.writeFile; + fs2.writeFile = writeFile; + function writeFile(path, data, options, cb) { + if (typeof options === "function") + cb = options, options = null; + return go$writeFile(path, data, options, cb); + function go$writeFile(path2, data2, options2, cb2) { + return fs$writeFile(path2, data2, options2, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$writeFile, [path2, data2, options2, cb2]]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + retry(); + } + }); + } + } + var fs$appendFile = fs2.appendFile; + if (fs$appendFile) + fs2.appendFile = appendFile; + function appendFile(path, data, options, cb) { + if (typeof options === "function") + cb = options, options = null; + return go$appendFile(path, data, options, cb); + function go$appendFile(path2, data2, options2, cb2) { + return fs$appendFile(path2, data2, options2, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$appendFile, [path2, data2, options2, cb2]]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + retry(); + } + }); + } + } + var fs$readdir = fs2.readdir; + fs2.readdir = readdir; + function readdir(path, options, cb) { + var args = [path]; + if (typeof options !== "function") { + args.push(options); + } else { + cb = options; + } + args.push(go$readdir$cb); + return go$readdir(args); + function go$readdir$cb(err, files) { + if (files && files.sort) + files.sort(); + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$readdir, [args]]); + else { + if (typeof cb === "function") + cb.apply(this, arguments); + retry(); + } + } + } + function go$readdir(args) { + return fs$readdir.apply(fs2, args); + } + if (process.version.substr(0, 4) === "v0.8") { + var legStreams = legacy(fs2); + ReadStream = legStreams.ReadStream; + WriteStream = legStreams.WriteStream; + } + var fs$ReadStream = fs2.ReadStream; + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype); + ReadStream.prototype.open = ReadStream$open; + } + var fs$WriteStream = fs2.WriteStream; + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype); + WriteStream.prototype.open = WriteStream$open; + } + Object.defineProperty(fs2, "ReadStream", { + get: function() { + return ReadStream; + }, + set: function(val) { + ReadStream = val; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(fs2, "WriteStream", { + get: function() { + return WriteStream; + }, + set: function(val) { + WriteStream = val; + }, + enumerable: true, + configurable: true + }); + var FileReadStream = ReadStream; + Object.defineProperty(fs2, "FileReadStream", { + get: function() { + return FileReadStream; + }, + set: function(val) { + FileReadStream = val; + }, + enumerable: true, + configurable: true + }); + var FileWriteStream = WriteStream; + Object.defineProperty(fs2, "FileWriteStream", { + get: function() { + return FileWriteStream; + }, + set: function(val) { + FileWriteStream = val; + }, + enumerable: true, + configurable: true + }); + function ReadStream(path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this; + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments); + } + function ReadStream$open() { + var that = this; + open(that.path, that.flags, that.mode, function(err, fd) { + if (err) { + if (that.autoClose) + that.destroy(); + that.emit("error", err); + } else { + that.fd = fd; + that.emit("open", fd); + that.read(); + } + }); + } + function WriteStream(path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this; + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments); + } + function WriteStream$open() { + var that = this; + open(that.path, that.flags, that.mode, function(err, fd) { + if (err) { + that.destroy(); + that.emit("error", err); + } else { + that.fd = fd; + that.emit("open", fd); + } + }); + } + function createReadStream(path, options) { + return new fs2.ReadStream(path, options); + } + function createWriteStream(path, options) { + return new fs2.WriteStream(path, options); + } + var fs$open = fs2.open; + fs2.open = open; + function open(path, flags, mode, cb) { + if (typeof mode === "function") + cb = mode, mode = null; + return go$open(path, flags, mode, cb); + function go$open(path2, flags2, mode2, cb2) { + return fs$open(path2, flags2, mode2, function(err, fd) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$open, [path2, flags2, mode2, cb2]]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + retry(); + } + }); + } + } + return fs2; + } + function enqueue(elem) { + debug("ENQUEUE", elem[0].name, elem[1]); + fs[gracefulQueue].push(elem); + } + function retry() { + var elem = fs[gracefulQueue].shift(); + if (elem) { + debug("RETRY", elem[0].name, elem[1]); + elem[0].apply(null, elem[1]); + } + } +}); + +// node_modules/fstream/lib/get-type.js +var require_get_type = __commonJS((exports2, module2) => { + module2.exports = getType; + function getType(st) { + var types = [ + "Directory", + "File", + "SymbolicLink", + "Link", + "BlockDevice", + "CharacterDevice", + "FIFO", + "Socket" + ]; + var type; + if (st.type && types.indexOf(st.type) !== -1) { + st[st.type] = true; + return st.type; + } + for (var i = 0, l = types.length; i < l; i++) { + type = types[i]; + var is = st[type] || st["is" + type]; + if (typeof is === "function") + is = is.call(st); + if (is) { + st[type] = true; + st.type = type; + return type; + } + } + return null; + } +}); + +// node_modules/fstream/lib/link-reader.js +var require_link_reader = __commonJS((exports2, module2) => { + module2.exports = LinkReader; + var fs = require_graceful_fs(); + var inherits2 = require_inherits(); + var Reader = require_reader(); + inherits2(LinkReader, Reader); + function LinkReader(props) { + var self2 = this; + if (!(self2 instanceof LinkReader)) { + throw new Error("LinkReader must be called as constructor."); + } + if (!(props.type === "Link" && props.Link || props.type === "SymbolicLink" && props.SymbolicLink)) { + throw new Error("Non-link type " + props.type); + } + Reader.call(self2, props); + } + LinkReader.prototype._stat = function(currentStat) { + var self2 = this; + fs.readlink(self2._path, function(er, linkpath) { + if (er) + return self2.error(er); + self2.linkpath = self2.props.linkpath = linkpath; + self2.emit("linkpath", linkpath); + Reader.prototype._stat.call(self2, currentStat); + }); + }; + LinkReader.prototype._read = function() { + var self2 = this; + if (self2._paused) + return; + if (!self2._ended) { + self2.emit("end"); + self2.emit("close"); + self2._ended = true; + } + }; +}); + +// node_modules/fstream/lib/dir-reader.js +var require_dir_reader = __commonJS((exports2, module2) => { + module2.exports = DirReader; + var fs = require_graceful_fs(); + var inherits2 = require_inherits(); + var path = require("path"); + var Reader = require_reader(); + var assert = require("assert").ok; + inherits2(DirReader, Reader); + function DirReader(props) { + var self2 = this; + if (!(self2 instanceof DirReader)) { + throw new Error("DirReader must be called as constructor."); + } + if (props.type !== "Directory" || !props.Directory) { + throw new Error("Non-directory type " + props.type); + } + self2.entries = null; + self2._index = -1; + self2._paused = false; + self2._length = -1; + if (props.sort) { + this.sort = props.sort; + } + Reader.call(this, props); + } + DirReader.prototype._getEntries = function() { + var self2 = this; + if (self2._gotEntries) + return; + self2._gotEntries = true; + fs.readdir(self2._path, function(er, entries) { + if (er) + return self2.error(er); + self2.entries = entries; + self2.emit("entries", entries); + if (self2._paused) + self2.once("resume", processEntries); + else + processEntries(); + function processEntries() { + self2._length = self2.entries.length; + if (typeof self2.sort === "function") { + self2.entries = self2.entries.sort(self2.sort.bind(self2)); + } + self2._read(); + } + }); + }; + DirReader.prototype._read = function() { + var self2 = this; + if (!self2.entries) + return self2._getEntries(); + if (self2._paused || self2._currentEntry || self2._aborted) { + return; + } + self2._index++; + if (self2._index >= self2.entries.length) { + if (!self2._ended) { + self2._ended = true; + self2.emit("end"); + self2.emit("close"); + } + return; + } + var p = path.resolve(self2._path, self2.entries[self2._index]); + assert(p !== self2._path); + assert(self2.entries[self2._index]); + self2._currentEntry = p; + fs[self2.props.follow ? "stat" : "lstat"](p, function(er, stat) { + if (er) + return self2.error(er); + var who = self2._proxy || self2; + stat.path = p; + stat.basename = path.basename(p); + stat.dirname = path.dirname(p); + var childProps = self2.getChildProps.call(who, stat); + childProps.path = p; + childProps.basename = path.basename(p); + childProps.dirname = path.dirname(p); + var entry = Reader(childProps, stat); + self2._currentEntry = entry; + entry.on("pause", function(who2) { + if (!self2._paused && !entry._disowned) { + self2.pause(who2); + } + }); + entry.on("resume", function(who2) { + if (self2._paused && !entry._disowned) { + self2.resume(who2); + } + }); + entry.on("stat", function(props) { + self2.emit("_entryStat", entry, props); + if (entry._aborted) + return; + if (entry._paused) { + entry.once("resume", function() { + self2.emit("entryStat", entry, props); + }); + } else + self2.emit("entryStat", entry, props); + }); + entry.on("ready", function EMITCHILD() { + if (self2._paused) { + entry.pause(self2); + return self2.once("resume", EMITCHILD); + } + if (entry.type === "Socket") { + self2.emit("socket", entry); + } else { + self2.emitEntry(entry); + } + }); + var ended = false; + entry.on("close", onend); + entry.on("disown", onend); + function onend() { + if (ended) + return; + ended = true; + self2.emit("childEnd", entry); + self2.emit("entryEnd", entry); + self2._currentEntry = null; + if (!self2._paused) { + self2._read(); + } + } + entry.on("error", function(er2) { + if (entry._swallowErrors) { + self2.warn(er2); + entry.emit("end"); + entry.emit("close"); + } else { + self2.emit("error", er2); + } + }); + [ + "child", + "childEnd", + "warn" + ].forEach(function(ev) { + entry.on(ev, self2.emit.bind(self2, ev)); + }); + }); + }; + DirReader.prototype.disown = function(entry) { + entry.emit("beforeDisown"); + entry._disowned = true; + entry.parent = entry.root = null; + if (entry === this._currentEntry) { + this._currentEntry = null; + } + entry.emit("disown"); + }; + DirReader.prototype.getChildProps = function() { + return { + depth: this.depth + 1, + root: this.root || this, + parent: this, + follow: this.follow, + filter: this.filter, + sort: this.props.sort, + hardlinks: this.props.hardlinks + }; + }; + DirReader.prototype.pause = function(who) { + var self2 = this; + if (self2._paused) + return; + who = who || self2; + self2._paused = true; + if (self2._currentEntry && self2._currentEntry.pause) { + self2._currentEntry.pause(who); + } + self2.emit("pause", who); + }; + DirReader.prototype.resume = function(who) { + var self2 = this; + if (!self2._paused) + return; + who = who || self2; + self2._paused = false; + self2.emit("resume", who); + if (self2._paused) { + return; + } + if (self2._currentEntry) { + if (self2._currentEntry.resume) + self2._currentEntry.resume(who); + } else + self2._read(); + }; + DirReader.prototype.emitEntry = function(entry) { + this.emit("entry", entry); + this.emit("child", entry); + }; +}); + +// node_modules/fstream/lib/file-reader.js +var require_file_reader = __commonJS((exports2, module2) => { + module2.exports = FileReader; + var fs = require_graceful_fs(); + var inherits2 = require_inherits(); + var Reader = require_reader(); + var EOF = {EOF: true}; + var CLOSE = {CLOSE: true}; + inherits2(FileReader, Reader); + function FileReader(props) { + var self2 = this; + if (!(self2 instanceof FileReader)) { + throw new Error("FileReader must be called as constructor."); + } + if (!(props.type === "Link" && props.Link || props.type === "File" && props.File)) { + throw new Error("Non-file type " + props.type); + } + self2._buffer = []; + self2._bytesEmitted = 0; + Reader.call(self2, props); + } + FileReader.prototype._getStream = function() { + var self2 = this; + var stream = self2._stream = fs.createReadStream(self2._path, self2.props); + if (self2.props.blksize) { + stream.bufferSize = self2.props.blksize; + } + stream.on("open", self2.emit.bind(self2, "open")); + stream.on("data", function(c) { + self2._bytesEmitted += c.length; + if (!c.length) { + return; + } else if (self2._paused || self2._buffer.length) { + self2._buffer.push(c); + self2._read(); + } else + self2.emit("data", c); + }); + stream.on("end", function() { + if (self2._paused || self2._buffer.length) { + self2._buffer.push(EOF); + self2._read(); + } else { + self2.emit("end"); + } + if (self2._bytesEmitted !== self2.props.size) { + self2.error("Didn't get expected byte count\nexpect: " + self2.props.size + "\nactual: " + self2._bytesEmitted); + } + }); + stream.on("close", function() { + if (self2._paused || self2._buffer.length) { + self2._buffer.push(CLOSE); + self2._read(); + } else { + self2.emit("close"); + } + }); + stream.on("error", function(e) { + self2.emit("error", e); + }); + self2._read(); + }; + FileReader.prototype._read = function() { + var self2 = this; + if (self2._paused) { + return; + } + if (!self2._stream) { + return self2._getStream(); + } + if (self2._buffer.length) { + var buf = self2._buffer; + for (var i = 0, l = buf.length; i < l; i++) { + var c = buf[i]; + if (c === EOF) { + self2.emit("end"); + } else if (c === CLOSE) { + self2.emit("close"); + } else { + self2.emit("data", c); + } + if (self2._paused) { + self2._buffer = buf.slice(i); + return; + } + } + self2._buffer.length = 0; + } + }; + FileReader.prototype.pause = function(who) { + var self2 = this; + if (self2._paused) + return; + who = who || self2; + self2._paused = true; + if (self2._stream) + self2._stream.pause(); + self2.emit("pause", who); + }; + FileReader.prototype.resume = function(who) { + var self2 = this; + if (!self2._paused) + return; + who = who || self2; + self2.emit("resume", who); + self2._paused = false; + if (self2._stream) + self2._stream.resume(); + self2._read(); + }; +}); + +// node_modules/fstream/lib/socket-reader.js +var require_socket_reader = __commonJS((exports2, module2) => { + module2.exports = SocketReader; + var inherits2 = require_inherits(); + var Reader = require_reader(); + inherits2(SocketReader, Reader); + function SocketReader(props) { + var self2 = this; + if (!(self2 instanceof SocketReader)) { + throw new Error("SocketReader must be called as constructor."); + } + if (!(props.type === "Socket" && props.Socket)) { + throw new Error("Non-socket type " + props.type); + } + Reader.call(self2, props); + } + SocketReader.prototype._read = function() { + var self2 = this; + if (self2._paused) + return; + if (!self2._ended) { + self2.emit("end"); + self2.emit("close"); + self2._ended = true; + } + }; +}); + +// node_modules/fstream/lib/proxy-reader.js +var require_proxy_reader = __commonJS((exports2, module2) => { + module2.exports = ProxyReader; + var Reader = require_reader(); + var getType = require_get_type(); + var inherits2 = require_inherits(); + var fs = require_graceful_fs(); + inherits2(ProxyReader, Reader); + function ProxyReader(props) { + var self2 = this; + if (!(self2 instanceof ProxyReader)) { + throw new Error("ProxyReader must be called as constructor."); + } + self2.props = props; + self2._buffer = []; + self2.ready = false; + Reader.call(self2, props); + } + ProxyReader.prototype._stat = function() { + var self2 = this; + var props = self2.props; + var stat = props.follow ? "stat" : "lstat"; + fs[stat](props.path, function(er, current) { + var type; + if (er || !current) { + type = "File"; + } else { + type = getType(current); + } + props[type] = true; + props.type = self2.type = type; + self2._old = current; + self2._addProxy(Reader(props, current)); + }); + }; + ProxyReader.prototype._addProxy = function(proxy) { + var self2 = this; + if (self2._proxyTarget) { + return self2.error("proxy already set"); + } + self2._proxyTarget = proxy; + proxy._proxy = self2; + [ + "error", + "data", + "end", + "close", + "linkpath", + "entry", + "entryEnd", + "child", + "childEnd", + "warn", + "stat" + ].forEach(function(ev) { + proxy.on(ev, self2.emit.bind(self2, ev)); + }); + self2.emit("proxy", proxy); + proxy.on("ready", function() { + self2.ready = true; + self2.emit("ready"); + }); + var calls = self2._buffer; + self2._buffer.length = 0; + calls.forEach(function(c) { + proxy[c[0]].apply(proxy, c[1]); + }); + }; + ProxyReader.prototype.pause = function() { + return this._proxyTarget ? this._proxyTarget.pause() : false; + }; + ProxyReader.prototype.resume = function() { + return this._proxyTarget ? this._proxyTarget.resume() : false; + }; +}); + +// node_modules/fstream/lib/reader.js +var require_reader = __commonJS((exports2, module2) => { + module2.exports = Reader; + var fs = require_graceful_fs(); + var Stream = require("stream").Stream; + var inherits2 = require_inherits(); + var path = require("path"); + var getType = require_get_type(); + var hardLinks = Reader.hardLinks = {}; + var Abstract = require_abstract(); + inherits2(Reader, Abstract); + var LinkReader = require_link_reader(); + function Reader(props, currentStat) { + var self2 = this; + if (!(self2 instanceof Reader)) + return new Reader(props, currentStat); + if (typeof props === "string") { + props = {path: props}; + } + var type; + var ClassType; + if (props.type && typeof props.type === "function") { + type = props.type; + ClassType = type; + } else { + type = getType(props); + ClassType = Reader; + } + if (currentStat && !type) { + type = getType(currentStat); + props[type] = true; + props.type = type; + } + switch (type) { + case "Directory": + ClassType = require_dir_reader(); + break; + case "Link": + case "File": + ClassType = require_file_reader(); + break; + case "SymbolicLink": + ClassType = LinkReader; + break; + case "Socket": + ClassType = require_socket_reader(); + break; + case null: + ClassType = require_proxy_reader(); + break; + } + if (!(self2 instanceof ClassType)) { + return new ClassType(props); + } + Abstract.call(self2); + if (!props.path) { + self2.error("Must provide a path", null, true); + } + self2.readable = true; + self2.writable = false; + self2.type = type; + self2.props = props; + self2.depth = props.depth = props.depth || 0; + self2.parent = props.parent || null; + self2.root = props.root || props.parent && props.parent.root || self2; + self2._path = self2.path = path.resolve(props.path); + if (process.platform === "win32") { + self2.path = self2._path = self2.path.replace(/\?/g, "_"); + if (self2._path.length >= 260) { + self2._swallowErrors = true; + self2._path = "\\\\?\\" + self2.path.replace(/\//g, "\\"); + } + } + self2.basename = props.basename = path.basename(self2.path); + self2.dirname = props.dirname = path.dirname(self2.path); + props.parent = props.root = null; + self2.size = props.size; + self2.filter = typeof props.filter === "function" ? props.filter : null; + if (props.sort === "alpha") + props.sort = alphasort; + self2._stat(currentStat); + } + function alphasort(a, b) { + return a === b ? 0 : a.toLowerCase() > b.toLowerCase() ? 1 : a.toLowerCase() < b.toLowerCase() ? -1 : a > b ? 1 : -1; + } + Reader.prototype._stat = function(currentStat) { + var self2 = this; + var props = self2.props; + var stat = props.follow ? "stat" : "lstat"; + if (currentStat) + process.nextTick(statCb.bind(null, null, currentStat)); + else + fs[stat](self2._path, statCb); + function statCb(er, props_) { + if (er) + return self2.error(er); + Object.keys(props_).forEach(function(k2) { + props[k2] = props_[k2]; + }); + if (self2.size !== void 0 && props.size !== self2.size) { + return self2.error("incorrect size"); + } + self2.size = props.size; + var type = getType(props); + var handleHardlinks = props.hardlinks !== false; + if (handleHardlinks && type !== "Directory" && props.nlink && props.nlink > 1) { + var k = props.dev + ":" + props.ino; + if (hardLinks[k] === self2._path || !hardLinks[k]) { + hardLinks[k] = self2._path; + } else { + type = self2.type = self2.props.type = "Link"; + self2.Link = self2.props.Link = true; + self2.linkpath = self2.props.linkpath = hardLinks[k]; + self2._stat = self2._read = LinkReader.prototype._read; + } + } + if (self2.type && self2.type !== type) { + self2.error("Unexpected type: " + type); + } + if (self2.filter) { + var who = self2._proxy || self2; + if (!self2.filter.call(who, who, props)) { + if (!self2._disowned) { + self2.abort(); + self2.emit("end"); + self2.emit("close"); + } + return; + } + } + var events = ["_stat", "stat", "ready"]; + var e = 0; + (function go() { + if (self2._aborted) { + self2.emit("end"); + self2.emit("close"); + return; + } + if (self2._paused && self2.type !== "Directory") { + self2.once("resume", go); + return; + } + var ev = events[e++]; + if (!ev) { + return self2._read(); + } + self2.emit(ev, props); + go(); + })(); + } + }; + Reader.prototype.pipe = function(dest) { + var self2 = this; + if (typeof dest.add === "function") { + self2.on("entry", function(entry) { + var ret2 = dest.add(entry); + if (ret2 === false) { + self2.pause(); + } + }); + } + return Stream.prototype.pipe.apply(this, arguments); + }; + Reader.prototype.pause = function(who) { + this._paused = true; + who = who || this; + this.emit("pause", who); + if (this._stream) + this._stream.pause(who); + }; + Reader.prototype.resume = function(who) { + this._paused = false; + who = who || this; + this.emit("resume", who); + if (this._stream) + this._stream.resume(who); + this._read(); + }; + Reader.prototype._read = function() { + this.error("Cannot read unknown type: " + this.type); + }; +}); + +// node_modules/fstream/node_modules/rimraf/rimraf.js +var require_rimraf2 = __commonJS((exports2, module2) => { + module2.exports = rimraf; + rimraf.sync = rimrafSync; + var assert = require("assert"); + var path = require("path"); + var fs = require("fs"); + var glob = void 0; + try { + glob = require_glob(); + } catch (_err) { + } + var _0666 = parseInt("666", 8); + var defaultGlobOpts = { + nosort: true, + silent: true + }; + var timeout = 0; + var isWindows = process.platform === "win32"; + function defaults(options) { + var methods = [ + "unlink", + "chmod", + "stat", + "lstat", + "rmdir", + "readdir" + ]; + methods.forEach(function(m) { + options[m] = options[m] || fs[m]; + m = m + "Sync"; + options[m] = options[m] || fs[m]; + }); + options.maxBusyTries = options.maxBusyTries || 3; + options.emfileWait = options.emfileWait || 1e3; + if (options.glob === false) { + options.disableGlob = true; + } + if (options.disableGlob !== true && glob === void 0) { + throw Error("glob dependency not found, set `options.disableGlob = true` if intentional"); + } + options.disableGlob = options.disableGlob || false; + options.glob = options.glob || defaultGlobOpts; + } + function rimraf(p, options, cb) { + if (typeof options === "function") { + cb = options; + options = {}; + } + assert(p, "rimraf: missing path"); + assert.equal(typeof p, "string", "rimraf: path should be a string"); + assert.equal(typeof cb, "function", "rimraf: callback function required"); + assert(options, "rimraf: invalid options argument provided"); + assert.equal(typeof options, "object", "rimraf: options should be object"); + defaults(options); + var busyTries = 0; + var errState = null; + var n = 0; + if (options.disableGlob || !glob.hasMagic(p)) + return afterGlob(null, [p]); + options.lstat(p, function(er, stat) { + if (!er) + return afterGlob(null, [p]); + glob(p, options.glob, afterGlob); + }); + function next(er) { + errState = errState || er; + if (--n === 0) + cb(errState); + } + function afterGlob(er, results) { + if (er) + return cb(er); + n = results.length; + if (n === 0) + return cb(); + results.forEach(function(p2) { + rimraf_(p2, options, function CB(er2) { + if (er2) { + if ((er2.code === "EBUSY" || er2.code === "ENOTEMPTY" || er2.code === "EPERM") && busyTries < options.maxBusyTries) { + busyTries++; + var time = busyTries * 100; + return setTimeout(function() { + rimraf_(p2, options, CB); + }, time); + } + if (er2.code === "EMFILE" && timeout < options.emfileWait) { + return setTimeout(function() { + rimraf_(p2, options, CB); + }, timeout++); + } + if (er2.code === "ENOENT") + er2 = null; + } + timeout = 0; + next(er2); + }); + }); + } + } + function rimraf_(p, options, cb) { + assert(p); + assert(options); + assert(typeof cb === "function"); + options.lstat(p, function(er, st) { + if (er && er.code === "ENOENT") + return cb(null); + if (er && er.code === "EPERM" && isWindows) + fixWinEPERM(p, options, er, cb); + if (st && st.isDirectory()) + return rmdir(p, options, er, cb); + options.unlink(p, function(er2) { + if (er2) { + if (er2.code === "ENOENT") + return cb(null); + if (er2.code === "EPERM") + return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb); + if (er2.code === "EISDIR") + return rmdir(p, options, er2, cb); + } + return cb(er2); + }); + }); + } + function fixWinEPERM(p, options, er, cb) { + assert(p); + assert(options); + assert(typeof cb === "function"); + if (er) + assert(er instanceof Error); + options.chmod(p, _0666, function(er2) { + if (er2) + cb(er2.code === "ENOENT" ? null : er); + else + options.stat(p, function(er3, stats) { + if (er3) + cb(er3.code === "ENOENT" ? null : er); + else if (stats.isDirectory()) + rmdir(p, options, er, cb); + else + options.unlink(p, cb); + }); + }); + } + function fixWinEPERMSync(p, options, er) { + assert(p); + assert(options); + if (er) + assert(er instanceof Error); + try { + options.chmodSync(p, _0666); + } catch (er2) { + if (er2.code === "ENOENT") + return; + else + throw er; + } + try { + var stats = options.statSync(p); + } catch (er3) { + if (er3.code === "ENOENT") + return; + else + throw er; + } + if (stats.isDirectory()) + rmdirSync(p, options, er); + else + options.unlinkSync(p); + } + function rmdir(p, options, originalEr, cb) { + assert(p); + assert(options); + if (originalEr) + assert(originalEr instanceof Error); + assert(typeof cb === "function"); + options.rmdir(p, function(er) { + if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) + rmkids(p, options, cb); + else if (er && er.code === "ENOTDIR") + cb(originalEr); + else + cb(er); + }); + } + function rmkids(p, options, cb) { + assert(p); + assert(options); + assert(typeof cb === "function"); + options.readdir(p, function(er, files) { + if (er) + return cb(er); + var n = files.length; + if (n === 0) + return options.rmdir(p, cb); + var errState; + files.forEach(function(f) { + rimraf(path.join(p, f), options, function(er2) { + if (errState) + return; + if (er2) + return cb(errState = er2); + if (--n === 0) + options.rmdir(p, cb); + }); + }); + }); + } + function rimrafSync(p, options) { + options = options || {}; + defaults(options); + assert(p, "rimraf: missing path"); + assert.equal(typeof p, "string", "rimraf: path should be a string"); + assert(options, "rimraf: missing options"); + assert.equal(typeof options, "object", "rimraf: options should be object"); + var results; + if (options.disableGlob || !glob.hasMagic(p)) { + results = [p]; + } else { + try { + options.lstatSync(p); + results = [p]; + } catch (er) { + results = glob.sync(p, options.glob); + } + } + if (!results.length) + return; + for (var i = 0; i < results.length; i++) { + var p = results[i]; + try { + var st = options.lstatSync(p); + } catch (er) { + if (er.code === "ENOENT") + return; + if (er.code === "EPERM" && isWindows) + fixWinEPERMSync(p, options, er); + } + try { + if (st && st.isDirectory()) + rmdirSync(p, options, null); + else + options.unlinkSync(p); + } catch (er) { + if (er.code === "ENOENT") + return; + if (er.code === "EPERM") + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er); + if (er.code !== "EISDIR") + throw er; + rmdirSync(p, options, er); + } + } + } + function rmdirSync(p, options, originalEr) { + assert(p); + assert(options); + if (originalEr) + assert(originalEr instanceof Error); + try { + options.rmdirSync(p); + } catch (er) { + if (er.code === "ENOENT") + return; + if (er.code === "ENOTDIR") + throw originalEr; + if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") + rmkidsSync(p, options); + } + } + function rmkidsSync(p, options) { + assert(p); + assert(options); + options.readdirSync(p).forEach(function(f) { + rimrafSync(path.join(p, f), options); + }); + var retries = isWindows ? 100 : 1; + var i = 0; + do { + var threw = true; + try { + var ret2 = options.rmdirSync(p, options); + threw = false; + return ret2; + } finally { + if (++i < retries && threw) + continue; + } + } while (true); + } +}); + +// node_modules/mkdirp/index.js +var require_mkdirp = __commonJS((exports2, module2) => { + var path = require("path"); + var fs = require("fs"); + var _0777 = parseInt("0777", 8); + module2.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; + function mkdirP(p, opts, f, made) { + if (typeof opts === "function") { + f = opts; + opts = {}; + } else if (!opts || typeof opts !== "object") { + opts = {mode: opts}; + } + var mode = opts.mode; + var xfs = opts.fs || fs; + if (mode === void 0) { + mode = _0777; + } + if (!made) + made = null; + var cb = f || function() { + }; + p = path.resolve(p); + xfs.mkdir(p, mode, function(er) { + if (!er) { + made = made || p; + return cb(null, made); + } + switch (er.code) { + case "ENOENT": + if (path.dirname(p) === p) + return cb(er); + mkdirP(path.dirname(p), opts, function(er2, made2) { + if (er2) + cb(er2, made2); + else + mkdirP(p, opts, cb, made2); + }); + break; + default: + xfs.stat(p, function(er2, stat) { + if (er2 || !stat.isDirectory()) + cb(er, made); + else + cb(null, made); + }); + break; + } + }); + } + mkdirP.sync = function sync(p, opts, made) { + if (!opts || typeof opts !== "object") { + opts = {mode: opts}; + } + var mode = opts.mode; + var xfs = opts.fs || fs; + if (mode === void 0) { + mode = _0777; + } + if (!made) + made = null; + p = path.resolve(p); + try { + xfs.mkdirSync(p, mode); + made = made || p; + } catch (err0) { + switch (err0.code) { + case "ENOENT": + made = sync(path.dirname(p), opts, made); + sync(p, opts, made); + break; + default: + var stat; + try { + stat = xfs.statSync(p); + } catch (err1) { + throw err0; + } + if (!stat.isDirectory()) + throw err0; + break; + } + } + return made; + }; +}); + +// node_modules/fstream/lib/collect.js +var require_collect = __commonJS((exports2, module2) => { + module2.exports = collect; + function collect(stream) { + if (stream._collected) + return; + if (stream._paused) + return stream.on("resume", collect.bind(null, stream)); + stream._collected = true; + stream.pause(); + stream.on("data", save); + stream.on("end", save); + var buf = []; + function save(b) { + if (typeof b === "string") + b = new Buffer(b); + if (Buffer.isBuffer(b) && !b.length) + return; + buf.push(b); + } + stream.on("entry", saveEntry); + var entryBuffer = []; + function saveEntry(e) { + collect(e); + entryBuffer.push(e); + } + stream.on("proxy", proxyPause); + function proxyPause(p) { + p.pause(); + } + stream.pipe = function(orig) { + return function(dest) { + var e = 0; + (function unblockEntry() { + var entry = entryBuffer[e++]; + if (!entry) + return resume(); + entry.on("end", unblockEntry); + if (dest) + dest.add(entry); + else + stream.emit("entry", entry); + })(); + function resume() { + stream.removeListener("entry", saveEntry); + stream.removeListener("data", save); + stream.removeListener("end", save); + stream.pipe = orig; + if (dest) + stream.pipe(dest); + buf.forEach(function(b) { + if (b) + stream.emit("data", b); + else + stream.emit("end"); + }); + stream.resume(); + } + return dest; + }; + }(stream.pipe); + } +}); + +// node_modules/fstream/lib/dir-writer.js +var require_dir_writer = __commonJS((exports2, module2) => { + module2.exports = DirWriter; + var Writer = require_writer(); + var inherits2 = require_inherits(); + var mkdir = require_mkdirp(); + var path = require("path"); + var collect = require_collect(); + inherits2(DirWriter, Writer); + function DirWriter(props) { + var self2 = this; + if (!(self2 instanceof DirWriter)) { + self2.error("DirWriter must be called as constructor.", null, true); + } + if (props.type !== "Directory" || !props.Directory) { + self2.error("Non-directory type " + props.type + " " + JSON.stringify(props), null, true); + } + Writer.call(this, props); + } + DirWriter.prototype._create = function() { + var self2 = this; + mkdir(self2._path, Writer.dirmode, function(er) { + if (er) + return self2.error(er); + self2.ready = true; + self2.emit("ready"); + self2._process(); + }); + }; + DirWriter.prototype.write = function() { + return true; + }; + DirWriter.prototype.end = function() { + this._ended = true; + this._process(); + }; + DirWriter.prototype.add = function(entry) { + var self2 = this; + collect(entry); + if (!self2.ready || self2._currentEntry) { + self2._buffer.push(entry); + return false; + } + if (self2._ended) { + return self2.error("add after end"); + } + self2._buffer.push(entry); + self2._process(); + return this._buffer.length === 0; + }; + DirWriter.prototype._process = function() { + var self2 = this; + if (self2._processing) + return; + var entry = self2._buffer.shift(); + if (!entry) { + self2.emit("drain"); + if (self2._ended) + self2._finish(); + return; + } + self2._processing = true; + self2.emit("entry", entry); + var p = entry; + var pp; + do { + pp = p._path || p.path; + if (pp === self2.root._path || pp === self2._path || pp && pp.indexOf(self2._path) === 0) { + self2._processing = false; + if (entry._collected) + entry.pipe(); + return self2._process(); + } + p = p.parent; + } while (p); + var props = { + parent: self2, + root: self2.root || self2, + type: entry.type, + depth: self2.depth + 1 + }; + pp = entry._path || entry.path || entry.props.path; + if (entry.parent) { + pp = pp.substr(entry.parent._path.length + 1); + } + props.path = path.join(self2.path, path.join("/", pp)); + props.filter = self2.filter; + Object.keys(entry.props).forEach(function(k) { + if (!props.hasOwnProperty(k)) { + props[k] = entry.props[k]; + } + }); + var child = self2._currentChild = new Writer(props); + child.on("ready", function() { + entry.pipe(child); + entry.resume(); + }); + child.on("error", function(er) { + if (child._swallowErrors) { + self2.warn(er); + child.emit("end"); + child.emit("close"); + } else { + self2.emit("error", er); + } + }); + child.on("close", onend); + var ended = false; + function onend() { + if (ended) + return; + ended = true; + self2._currentChild = null; + self2._processing = false; + self2._process(); + } + }; +}); + +// node_modules/fstream/lib/link-writer.js +var require_link_writer = __commonJS((exports2, module2) => { + module2.exports = LinkWriter; + var fs = require_graceful_fs(); + var Writer = require_writer(); + var inherits2 = require_inherits(); + var path = require("path"); + var rimraf = require_rimraf2(); + inherits2(LinkWriter, Writer); + function LinkWriter(props) { + var self2 = this; + if (!(self2 instanceof LinkWriter)) { + throw new Error("LinkWriter must be called as constructor."); + } + if (!(props.type === "Link" && props.Link || props.type === "SymbolicLink" && props.SymbolicLink)) { + throw new Error("Non-link type " + props.type); + } + if (props.linkpath === "") + props.linkpath = "."; + if (!props.linkpath) { + self2.error("Need linkpath property to create " + props.type); + } + Writer.call(this, props); + } + LinkWriter.prototype._create = function() { + var self2 = this; + var hard = self2.type === "Link" || process.platform === "win32"; + var link = hard ? "link" : "symlink"; + var lp = hard ? path.resolve(self2.dirname, self2.linkpath) : self2.linkpath; + if (hard) + return clobber(self2, lp, link); + fs.readlink(self2._path, function(er, p) { + if (p && p === lp) + return finish(self2); + clobber(self2, lp, link); + }); + }; + function clobber(self2, lp, link) { + rimraf(self2._path, function(er) { + if (er) + return self2.error(er); + create(self2, lp, link); + }); + } + function create(self2, lp, link) { + fs[link](lp, self2._path, function(er) { + if (er) { + if ((er.code === "ENOENT" || er.code === "EACCES" || er.code === "EPERM") && process.platform === "win32") { + self2.ready = true; + self2.emit("ready"); + self2.emit("end"); + self2.emit("close"); + self2.end = self2._finish = function() { + }; + } else + return self2.error(er); + } + finish(self2); + }); + } + function finish(self2) { + self2.ready = true; + self2.emit("ready"); + if (self2._ended && !self2._finished) + self2._finish(); + } + LinkWriter.prototype.end = function() { + this._ended = true; + if (this.ready) { + this._finished = true; + this._finish(); + } + }; +}); + +// node_modules/fstream/lib/file-writer.js +var require_file_writer = __commonJS((exports2, module2) => { + module2.exports = FileWriter; + var fs = require_graceful_fs(); + var Writer = require_writer(); + var inherits2 = require_inherits(); + var EOF = {}; + inherits2(FileWriter, Writer); + function FileWriter(props) { + var self2 = this; + if (!(self2 instanceof FileWriter)) { + throw new Error("FileWriter must be called as constructor."); + } + if (props.type !== "File" || !props.File) { + throw new Error("Non-file type " + props.type); + } + self2._buffer = []; + self2._bytesWritten = 0; + Writer.call(this, props); + } + FileWriter.prototype._create = function() { + var self2 = this; + if (self2._stream) + return; + var so = {}; + if (self2.props.flags) + so.flags = self2.props.flags; + so.mode = Writer.filemode; + if (self2._old && self2._old.blksize) + so.bufferSize = self2._old.blksize; + self2._stream = fs.createWriteStream(self2._path, so); + self2._stream.on("open", function() { + self2.ready = true; + self2._buffer.forEach(function(c) { + if (c === EOF) + self2._stream.end(); + else + self2._stream.write(c); + }); + self2.emit("ready"); + self2.emit("drain"); + }); + self2._stream.on("error", function(er) { + self2.emit("error", er); + }); + self2._stream.on("drain", function() { + self2.emit("drain"); + }); + self2._stream.on("close", function() { + self2._finish(); + }); + }; + FileWriter.prototype.write = function(c) { + var self2 = this; + self2._bytesWritten += c.length; + if (!self2.ready) { + if (!Buffer.isBuffer(c) && typeof c !== "string") { + throw new Error("invalid write data"); + } + self2._buffer.push(c); + return false; + } + var ret2 = self2._stream.write(c); + if (ret2 === false && self2._stream._queue) { + return self2._stream._queue.length <= 2; + } else { + return ret2; + } + }; + FileWriter.prototype.end = function(c) { + var self2 = this; + if (c) + self2.write(c); + if (!self2.ready) { + self2._buffer.push(EOF); + return false; + } + return self2._stream.end(); + }; + FileWriter.prototype._finish = function() { + var self2 = this; + if (typeof self2.size === "number" && self2._bytesWritten !== self2.size) { + self2.error("Did not get expected byte count.\nexpect: " + self2.size + "\nactual: " + self2._bytesWritten); + } + Writer.prototype._finish.call(self2); + }; +}); + +// node_modules/fstream/lib/proxy-writer.js +var require_proxy_writer = __commonJS((exports2, module2) => { + module2.exports = ProxyWriter; + var Writer = require_writer(); + var getType = require_get_type(); + var inherits2 = require_inherits(); + var collect = require_collect(); + var fs = require("fs"); + inherits2(ProxyWriter, Writer); + function ProxyWriter(props) { + var self2 = this; + if (!(self2 instanceof ProxyWriter)) { + throw new Error("ProxyWriter must be called as constructor."); + } + self2.props = props; + self2._needDrain = false; + Writer.call(self2, props); + } + ProxyWriter.prototype._stat = function() { + var self2 = this; + var props = self2.props; + var stat = props.follow ? "stat" : "lstat"; + fs[stat](props.path, function(er, current) { + var type; + if (er || !current) { + type = "File"; + } else { + type = getType(current); + } + props[type] = true; + props.type = self2.type = type; + self2._old = current; + self2._addProxy(Writer(props, current)); + }); + }; + ProxyWriter.prototype._addProxy = function(proxy) { + var self2 = this; + if (self2._proxy) { + return self2.error("proxy already set"); + } + self2._proxy = proxy; + [ + "ready", + "error", + "close", + "pipe", + "drain", + "warn" + ].forEach(function(ev) { + proxy.on(ev, self2.emit.bind(self2, ev)); + }); + self2.emit("proxy", proxy); + var calls = self2._buffer; + calls.forEach(function(c) { + proxy[c[0]].apply(proxy, c[1]); + }); + self2._buffer.length = 0; + if (self2._needsDrain) + self2.emit("drain"); + }; + ProxyWriter.prototype.add = function(entry) { + collect(entry); + if (!this._proxy) { + this._buffer.push(["add", [entry]]); + this._needDrain = true; + return false; + } + return this._proxy.add(entry); + }; + ProxyWriter.prototype.write = function(c) { + if (!this._proxy) { + this._buffer.push(["write", [c]]); + this._needDrain = true; + return false; + } + return this._proxy.write(c); + }; + ProxyWriter.prototype.end = function(c) { + if (!this._proxy) { + this._buffer.push(["end", [c]]); + return false; + } + return this._proxy.end(c); + }; +}); + +// node_modules/fstream/lib/writer.js +var require_writer = __commonJS((exports2, module2) => { + module2.exports = Writer; + var fs = require_graceful_fs(); + var inherits2 = require_inherits(); + var rimraf = require_rimraf2(); + var mkdir = require_mkdirp(); + var path = require("path"); + var umask = process.platform === "win32" ? 0 : process.umask(); + var getType = require_get_type(); + var Abstract = require_abstract(); + inherits2(Writer, Abstract); + Writer.dirmode = parseInt("0777", 8) & ~umask; + Writer.filemode = parseInt("0666", 8) & ~umask; + var DirWriter = require_dir_writer(); + var LinkWriter = require_link_writer(); + var FileWriter = require_file_writer(); + var ProxyWriter = require_proxy_writer(); + function Writer(props, current) { + var self2 = this; + if (typeof props === "string") { + props = {path: props}; + } + var type = getType(props); + var ClassType = Writer; + switch (type) { + case "Directory": + ClassType = DirWriter; + break; + case "File": + ClassType = FileWriter; + break; + case "Link": + case "SymbolicLink": + ClassType = LinkWriter; + break; + case null: + default: + ClassType = ProxyWriter; + break; + } + if (!(self2 instanceof ClassType)) + return new ClassType(props); + Abstract.call(self2); + if (!props.path) + self2.error("Must provide a path", null, true); + self2.type = props.type; + self2.props = props; + self2.depth = props.depth || 0; + self2.clobber = props.clobber === false ? props.clobber : true; + self2.parent = props.parent || null; + self2.root = props.root || props.parent && props.parent.root || self2; + self2._path = self2.path = path.resolve(props.path); + if (process.platform === "win32") { + self2.path = self2._path = self2.path.replace(/\?/g, "_"); + if (self2._path.length >= 260) { + self2._swallowErrors = true; + self2._path = "\\\\?\\" + self2.path.replace(/\//g, "\\"); + } + } + self2.basename = path.basename(props.path); + self2.dirname = path.dirname(props.path); + self2.linkpath = props.linkpath || null; + props.parent = props.root = null; + self2.size = props.size; + if (typeof props.mode === "string") { + props.mode = parseInt(props.mode, 8); + } + self2.readable = false; + self2.writable = true; + self2._buffer = []; + self2.ready = false; + self2.filter = typeof props.filter === "function" ? props.filter : null; + self2._stat(current); + } + Writer.prototype._create = function() { + var self2 = this; + fs[self2.props.follow ? "stat" : "lstat"](self2._path, function(er) { + if (er) { + return self2.warn("Cannot create " + self2._path + "\nUnsupported type: " + self2.type, "ENOTSUP"); + } + self2._finish(); + }); + }; + Writer.prototype._stat = function(current) { + var self2 = this; + var props = self2.props; + var stat = props.follow ? "stat" : "lstat"; + var who = self2._proxy || self2; + if (current) + statCb(null, current); + else + fs[stat](self2._path, statCb); + function statCb(er, current2) { + if (self2.filter && !self2.filter.call(who, who, current2)) { + self2._aborted = true; + self2.emit("end"); + self2.emit("close"); + return; + } + if (er || !current2) { + return create(self2); + } + self2._old = current2; + var currentType = getType(current2); + if (currentType !== self2.type || self2.type === "File" && current2.nlink > 1) { + return rimraf(self2._path, function(er2) { + if (er2) + return self2.error(er2); + self2._old = null; + create(self2); + }); + } + create(self2); + } + }; + function create(self2) { + mkdir(path.dirname(self2._path), Writer.dirmode, function(er, made) { + if (er) + return self2.error(er); + self2._madeDir = made; + return self2._create(); + }); + } + function endChmod(self2, want, current, path2, cb) { + var wantMode = want.mode; + var chmod = want.follow || self2.type !== "SymbolicLink" ? "chmod" : "lchmod"; + if (!fs[chmod]) + return cb(); + if (typeof wantMode !== "number") + return cb(); + var curMode = current.mode & parseInt("0777", 8); + wantMode = wantMode & parseInt("0777", 8); + if (wantMode === curMode) + return cb(); + fs[chmod](path2, wantMode, cb); + } + function endChown(self2, want, current, path2, cb) { + if (process.platform === "win32") + return cb(); + if (!process.getuid || process.getuid() !== 0) + return cb(); + if (typeof want.uid !== "number" && typeof want.gid !== "number") + return cb(); + if (current.uid === want.uid && current.gid === want.gid) + return cb(); + var chown = self2.props.follow || self2.type !== "SymbolicLink" ? "chown" : "lchown"; + if (!fs[chown]) + return cb(); + if (typeof want.uid !== "number") + want.uid = current.uid; + if (typeof want.gid !== "number") + want.gid = current.gid; + fs[chown](path2, want.uid, want.gid, cb); + } + function endUtimes(self2, want, current, path2, cb) { + if (!fs.utimes || process.platform === "win32") + return cb(); + var utimes = want.follow || self2.type !== "SymbolicLink" ? "utimes" : "lutimes"; + if (utimes === "lutimes" && !fs[utimes]) { + utimes = "utimes"; + } + if (!fs[utimes]) + return cb(); + var curA = current.atime; + var curM = current.mtime; + var meA = want.atime; + var meM = want.mtime; + if (meA === void 0) + meA = curA; + if (meM === void 0) + meM = curM; + if (!isDate(meA)) + meA = new Date(meA); + if (!isDate(meM)) + meA = new Date(meM); + if (meA.getTime() === curA.getTime() && meM.getTime() === curM.getTime()) + return cb(); + fs[utimes](path2, meA, meM, cb); + } + Writer.prototype._finish = function() { + var self2 = this; + if (self2._finishing) + return; + self2._finishing = true; + var todo = 0; + var errState = null; + var done = false; + if (self2._old) { + self2._old.atime = new Date(0); + self2._old.mtime = new Date(0); + setProps(self2._old); + } else { + var stat = self2.props.follow ? "stat" : "lstat"; + fs[stat](self2._path, function(er, current) { + if (er) { + if (er.code === "ENOENT" && (self2.type === "Link" || self2.type === "SymbolicLink") && process.platform === "win32") { + self2.ready = true; + self2.emit("ready"); + self2.emit("end"); + self2.emit("close"); + self2.end = self2._finish = function() { + }; + return; + } else + return self2.error(er); + } + setProps(self2._old = current); + }); + } + return; + function setProps(current) { + todo += 3; + endChmod(self2, self2.props, current, self2._path, next("chmod")); + endChown(self2, self2.props, current, self2._path, next("chown")); + endUtimes(self2, self2.props, current, self2._path, next("utimes")); + } + function next(what) { + return function(er) { + if (errState) + return; + if (er) { + er.fstream_finish_call = what; + return self2.error(errState = er); + } + if (--todo > 0) + return; + if (done) + return; + done = true; + if (!self2._madeDir) + return end(); + else + endMadeDir(self2, self2._path, end); + function end(er2) { + if (er2) { + er2.fstream_finish_call = "setupMadeDir"; + return self2.error(er2); + } + self2.emit("end"); + self2.emit("close"); + } + }; + } + }; + function endMadeDir(self2, p, cb) { + var made = self2._madeDir; + var d = path.dirname(p); + endMadeDir_(self2, d, function(er) { + if (er) + return cb(er); + if (d === made) { + return cb(); + } + endMadeDir(self2, d, cb); + }); + } + function endMadeDir_(self2, p, cb) { + var dirProps = {}; + Object.keys(self2.props).forEach(function(k) { + dirProps[k] = self2.props[k]; + if (k === "mode" && self2.type !== "Directory") { + dirProps[k] = dirProps[k] | parseInt("0111", 8); + } + }); + var todo = 3; + var errState = null; + fs.stat(p, function(er, current) { + if (er) + return cb(errState = er); + endChmod(self2, dirProps, current, p, next); + endChown(self2, dirProps, current, p, next); + endUtimes(self2, dirProps, current, p, next); + }); + function next(er) { + if (errState) + return; + if (er) + return cb(errState = er); + if (--todo === 0) + return cb(); + } + } + Writer.prototype.pipe = function() { + this.error("Can't pipe from writable stream"); + }; + Writer.prototype.add = function() { + this.error("Can't add to non-Directory type"); + }; + Writer.prototype.write = function() { + return true; + }; + function objectToString(d) { + return Object.prototype.toString.call(d); + } + function isDate(d) { + return typeof d === "object" && objectToString(d) === "[object Date]"; + } +}); + +// node_modules/fstream/fstream.js +var require_fstream = __commonJS((exports2) => { + exports2.Abstract = require_abstract(); + exports2.Reader = require_reader(); + exports2.Writer = require_writer(); + exports2.File = { + Reader: require_file_reader(), + Writer: require_file_writer() + }; + exports2.Dir = { + Reader: require_dir_reader(), + Writer: require_dir_writer() + }; + exports2.Link = { + Reader: require_link_reader(), + Writer: require_link_writer() + }; + exports2.Proxy = { + Reader: require_proxy_reader(), + Writer: require_proxy_writer() + }; + exports2.Reader.Dir = exports2.DirReader = exports2.Dir.Reader; + exports2.Reader.File = exports2.FileReader = exports2.File.Reader; + exports2.Reader.Link = exports2.LinkReader = exports2.Link.Reader; + exports2.Reader.Proxy = exports2.ProxyReader = exports2.Proxy.Reader; + exports2.Writer.Dir = exports2.DirWriter = exports2.Dir.Writer; + exports2.Writer.File = exports2.FileWriter = exports2.File.Writer; + exports2.Writer.Link = exports2.LinkWriter = exports2.Link.Writer; + exports2.Writer.Proxy = exports2.ProxyWriter = exports2.Proxy.Writer; + exports2.collect = require_collect(); +}); + +// node_modules/unzipper/lib/extract.js +var require_extract = __commonJS((exports2, module2) => { + module2.exports = Extract; + var Parse = require_parse3(); + var Writer = require_fstream().Writer; + var path = require("path"); + var stream = require("stream"); + var duplexer2 = require_duplexer2(); + var Promise2 = require_bluebird(); + function Extract(opts) { + opts.path = path.resolve(path.normalize(opts.path)); + var parser = new Parse(opts); + var outStream = new stream.Writable({objectMode: true}); + outStream._write = function(entry, encoding, cb) { + if (entry.type == "Directory") + return cb(); + var extractPath = path.join(opts.path, entry.path); + if (extractPath.indexOf(opts.path) != 0) { + return cb(); + } + const writer = opts.getWriter ? opts.getWriter({path: extractPath}) : Writer({path: extractPath}); + entry.pipe(writer).on("error", cb).on("close", cb); + }; + var extract = duplexer2(parser, outStream); + parser.once("crx-header", function(crxHeader) { + extract.crxHeader = crxHeader; + }); + parser.pipe(outStream).on("finish", function() { + extract.emit("close"); + }); + extract.promise = function() { + return new Promise2(function(resolve, reject) { + extract.on("close", resolve); + extract.on("error", reject); + }); + }; + return extract; + } +}); + +// node_modules/big-integer/BigInteger.js +var require_BigInteger = __commonJS((exports2, module2) => { + var bigInt = function(undefined2) { + "use strict"; + var BASE = 1e7, LOG_BASE = 7, MAX_INT = 9007199254740992, MAX_INT_ARR = smallToArray(MAX_INT), DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"; + var supportsNativeBigInt = typeof BigInt === "function"; + function Integer(v, radix, alphabet, caseSensitive) { + if (typeof v === "undefined") + return Integer[0]; + if (typeof radix !== "undefined") + return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive); + return parseValue(v); + } + function BigInteger(value, sign) { + this.value = value; + this.sign = sign; + this.isSmall = false; + } + BigInteger.prototype = Object.create(Integer.prototype); + function SmallInteger(value) { + this.value = value; + this.sign = value < 0; + this.isSmall = true; + } + SmallInteger.prototype = Object.create(Integer.prototype); + function NativeBigInt(value) { + this.value = value; + } + NativeBigInt.prototype = Object.create(Integer.prototype); + function isPrecise(n) { + return -MAX_INT < n && n < MAX_INT; + } + function smallToArray(n) { + if (n < 1e7) + return [n]; + if (n < 1e14) + return [n % 1e7, Math.floor(n / 1e7)]; + return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)]; + } + function arrayToSmall(arr) { + trim(arr); + var length = arr.length; + if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) { + switch (length) { + case 0: + return 0; + case 1: + return arr[0]; + case 2: + return arr[0] + arr[1] * BASE; + default: + return arr[0] + (arr[1] + arr[2] * BASE) * BASE; + } + } + return arr; + } + function trim(v) { + var i2 = v.length; + while (v[--i2] === 0) + ; + v.length = i2 + 1; + } + function createArray(length) { + var x = new Array(length); + var i2 = -1; + while (++i2 < length) { + x[i2] = 0; + } + return x; + } + function truncate(n) { + if (n > 0) + return Math.floor(n); + return Math.ceil(n); + } + function add(a, b) { + var l_a = a.length, l_b = b.length, r = new Array(l_a), carry = 0, base = BASE, sum, i2; + for (i2 = 0; i2 < l_b; i2++) { + sum = a[i2] + b[i2] + carry; + carry = sum >= base ? 1 : 0; + r[i2] = sum - carry * base; + } + while (i2 < l_a) { + sum = a[i2] + carry; + carry = sum === base ? 1 : 0; + r[i2++] = sum - carry * base; + } + if (carry > 0) + r.push(carry); + return r; + } + function addAny(a, b) { + if (a.length >= b.length) + return add(a, b); + return add(b, a); + } + function addSmall(a, carry) { + var l = a.length, r = new Array(l), base = BASE, sum, i2; + for (i2 = 0; i2 < l; i2++) { + sum = a[i2] - base + carry; + carry = Math.floor(sum / base); + r[i2] = sum - carry * base; + carry += 1; + } + while (carry > 0) { + r[i2++] = carry % base; + carry = Math.floor(carry / base); + } + return r; + } + BigInteger.prototype.add = function(v) { + var n = parseValue(v); + if (this.sign !== n.sign) { + return this.subtract(n.negate()); + } + var a = this.value, b = n.value; + if (n.isSmall) { + return new BigInteger(addSmall(a, Math.abs(b)), this.sign); + } + return new BigInteger(addAny(a, b), this.sign); + }; + BigInteger.prototype.plus = BigInteger.prototype.add; + SmallInteger.prototype.add = function(v) { + var n = parseValue(v); + var a = this.value; + if (a < 0 !== n.sign) { + return this.subtract(n.negate()); + } + var b = n.value; + if (n.isSmall) { + if (isPrecise(a + b)) + return new SmallInteger(a + b); + b = smallToArray(Math.abs(b)); + } + return new BigInteger(addSmall(b, Math.abs(a)), a < 0); + }; + SmallInteger.prototype.plus = SmallInteger.prototype.add; + NativeBigInt.prototype.add = function(v) { + return new NativeBigInt(this.value + parseValue(v).value); + }; + NativeBigInt.prototype.plus = NativeBigInt.prototype.add; + function subtract(a, b) { + var a_l = a.length, b_l = b.length, r = new Array(a_l), borrow = 0, base = BASE, i2, difference; + for (i2 = 0; i2 < b_l; i2++) { + difference = a[i2] - borrow - b[i2]; + if (difference < 0) { + difference += base; + borrow = 1; + } else + borrow = 0; + r[i2] = difference; + } + for (i2 = b_l; i2 < a_l; i2++) { + difference = a[i2] - borrow; + if (difference < 0) + difference += base; + else { + r[i2++] = difference; + break; + } + r[i2] = difference; + } + for (; i2 < a_l; i2++) { + r[i2] = a[i2]; + } + trim(r); + return r; + } + function subtractAny(a, b, sign) { + var value; + if (compareAbs(a, b) >= 0) { + value = subtract(a, b); + } else { + value = subtract(b, a); + sign = !sign; + } + value = arrayToSmall(value); + if (typeof value === "number") { + if (sign) + value = -value; + return new SmallInteger(value); + } + return new BigInteger(value, sign); + } + function subtractSmall(a, b, sign) { + var l = a.length, r = new Array(l), carry = -b, base = BASE, i2, difference; + for (i2 = 0; i2 < l; i2++) { + difference = a[i2] + carry; + carry = Math.floor(difference / base); + difference %= base; + r[i2] = difference < 0 ? difference + base : difference; + } + r = arrayToSmall(r); + if (typeof r === "number") { + if (sign) + r = -r; + return new SmallInteger(r); + } + return new BigInteger(r, sign); + } + BigInteger.prototype.subtract = function(v) { + var n = parseValue(v); + if (this.sign !== n.sign) { + return this.add(n.negate()); + } + var a = this.value, b = n.value; + if (n.isSmall) + return subtractSmall(a, Math.abs(b), this.sign); + return subtractAny(a, b, this.sign); + }; + BigInteger.prototype.minus = BigInteger.prototype.subtract; + SmallInteger.prototype.subtract = function(v) { + var n = parseValue(v); + var a = this.value; + if (a < 0 !== n.sign) { + return this.add(n.negate()); + } + var b = n.value; + if (n.isSmall) { + return new SmallInteger(a - b); + } + return subtractSmall(b, Math.abs(a), a >= 0); + }; + SmallInteger.prototype.minus = SmallInteger.prototype.subtract; + NativeBigInt.prototype.subtract = function(v) { + return new NativeBigInt(this.value - parseValue(v).value); + }; + NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract; + BigInteger.prototype.negate = function() { + return new BigInteger(this.value, !this.sign); + }; + SmallInteger.prototype.negate = function() { + var sign = this.sign; + var small = new SmallInteger(-this.value); + small.sign = !sign; + return small; + }; + NativeBigInt.prototype.negate = function() { + return new NativeBigInt(-this.value); + }; + BigInteger.prototype.abs = function() { + return new BigInteger(this.value, false); + }; + SmallInteger.prototype.abs = function() { + return new SmallInteger(Math.abs(this.value)); + }; + NativeBigInt.prototype.abs = function() { + return new NativeBigInt(this.value >= 0 ? this.value : -this.value); + }; + function multiplyLong(a, b) { + var a_l = a.length, b_l = b.length, l = a_l + b_l, r = createArray(l), base = BASE, product, carry, i2, a_i, b_j; + for (i2 = 0; i2 < a_l; ++i2) { + a_i = a[i2]; + for (var j = 0; j < b_l; ++j) { + b_j = b[j]; + product = a_i * b_j + r[i2 + j]; + carry = Math.floor(product / base); + r[i2 + j] = product - carry * base; + r[i2 + j + 1] += carry; + } + } + trim(r); + return r; + } + function multiplySmall(a, b) { + var l = a.length, r = new Array(l), base = BASE, carry = 0, product, i2; + for (i2 = 0; i2 < l; i2++) { + product = a[i2] * b + carry; + carry = Math.floor(product / base); + r[i2] = product - carry * base; + } + while (carry > 0) { + r[i2++] = carry % base; + carry = Math.floor(carry / base); + } + return r; + } + function shiftLeft(x, n) { + var r = []; + while (n-- > 0) + r.push(0); + return r.concat(x); + } + function multiplyKaratsuba(x, y) { + var n = Math.max(x.length, y.length); + if (n <= 30) + return multiplyLong(x, y); + n = Math.ceil(n / 2); + var b = x.slice(n), a = x.slice(0, n), d = y.slice(n), c = y.slice(0, n); + var ac = multiplyKaratsuba(a, c), bd = multiplyKaratsuba(b, d), abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d)); + var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n)); + trim(product); + return product; + } + function useKaratsuba(l1, l2) { + return -0.012 * l1 - 0.012 * l2 + 15e-6 * l1 * l2 > 0; + } + BigInteger.prototype.multiply = function(v) { + var n = parseValue(v), a = this.value, b = n.value, sign = this.sign !== n.sign, abs; + if (n.isSmall) { + if (b === 0) + return Integer[0]; + if (b === 1) + return this; + if (b === -1) + return this.negate(); + abs = Math.abs(b); + if (abs < BASE) { + return new BigInteger(multiplySmall(a, abs), sign); + } + b = smallToArray(abs); + } + if (useKaratsuba(a.length, b.length)) + return new BigInteger(multiplyKaratsuba(a, b), sign); + return new BigInteger(multiplyLong(a, b), sign); + }; + BigInteger.prototype.times = BigInteger.prototype.multiply; + function multiplySmallAndArray(a, b, sign) { + if (a < BASE) { + return new BigInteger(multiplySmall(b, a), sign); + } + return new BigInteger(multiplyLong(b, smallToArray(a)), sign); + } + SmallInteger.prototype._multiplyBySmall = function(a) { + if (isPrecise(a.value * this.value)) { + return new SmallInteger(a.value * this.value); + } + return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign); + }; + BigInteger.prototype._multiplyBySmall = function(a) { + if (a.value === 0) + return Integer[0]; + if (a.value === 1) + return this; + if (a.value === -1) + return this.negate(); + return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign); + }; + SmallInteger.prototype.multiply = function(v) { + return parseValue(v)._multiplyBySmall(this); + }; + SmallInteger.prototype.times = SmallInteger.prototype.multiply; + NativeBigInt.prototype.multiply = function(v) { + return new NativeBigInt(this.value * parseValue(v).value); + }; + NativeBigInt.prototype.times = NativeBigInt.prototype.multiply; + function square(a) { + var l = a.length, r = createArray(l + l), base = BASE, product, carry, i2, a_i, a_j; + for (i2 = 0; i2 < l; i2++) { + a_i = a[i2]; + carry = 0 - a_i * a_i; + for (var j = i2; j < l; j++) { + a_j = a[j]; + product = 2 * (a_i * a_j) + r[i2 + j] + carry; + carry = Math.floor(product / base); + r[i2 + j] = product - carry * base; + } + r[i2 + l] = carry; + } + trim(r); + return r; + } + BigInteger.prototype.square = function() { + return new BigInteger(square(this.value), false); + }; + SmallInteger.prototype.square = function() { + var value = this.value * this.value; + if (isPrecise(value)) + return new SmallInteger(value); + return new BigInteger(square(smallToArray(Math.abs(this.value))), false); + }; + NativeBigInt.prototype.square = function(v) { + return new NativeBigInt(this.value * this.value); + }; + function divMod1(a, b) { + var a_l = a.length, b_l = b.length, base = BASE, result = createArray(b.length), divisorMostSignificantDigit = b[b_l - 1], lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)), remainder = multiplySmall(a, lambda), divisor = multiplySmall(b, lambda), quotientDigit, shift, carry, borrow, i2, l, q; + if (remainder.length <= a_l) + remainder.push(0); + divisor.push(0); + divisorMostSignificantDigit = divisor[b_l - 1]; + for (shift = a_l - b_l; shift >= 0; shift--) { + quotientDigit = base - 1; + if (remainder[shift + b_l] !== divisorMostSignificantDigit) { + quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit); + } + carry = 0; + borrow = 0; + l = divisor.length; + for (i2 = 0; i2 < l; i2++) { + carry += quotientDigit * divisor[i2]; + q = Math.floor(carry / base); + borrow += remainder[shift + i2] - (carry - q * base); + carry = q; + if (borrow < 0) { + remainder[shift + i2] = borrow + base; + borrow = -1; + } else { + remainder[shift + i2] = borrow; + borrow = 0; + } + } + while (borrow !== 0) { + quotientDigit -= 1; + carry = 0; + for (i2 = 0; i2 < l; i2++) { + carry += remainder[shift + i2] - base + divisor[i2]; + if (carry < 0) { + remainder[shift + i2] = carry + base; + carry = 0; + } else { + remainder[shift + i2] = carry; + carry = 1; + } + } + borrow += carry; + } + result[shift] = quotientDigit; + } + remainder = divModSmall(remainder, lambda)[0]; + return [arrayToSmall(result), arrayToSmall(remainder)]; + } + function divMod2(a, b) { + var a_l = a.length, b_l = b.length, result = [], part = [], base = BASE, guess, xlen, highx, highy, check; + while (a_l) { + part.unshift(a[--a_l]); + trim(part); + if (compareAbs(part, b) < 0) { + result.push(0); + continue; + } + xlen = part.length; + highx = part[xlen - 1] * base + part[xlen - 2]; + highy = b[b_l - 1] * base + b[b_l - 2]; + if (xlen > b_l) { + highx = (highx + 1) * base; + } + guess = Math.ceil(highx / highy); + do { + check = multiplySmall(b, guess); + if (compareAbs(check, part) <= 0) + break; + guess--; + } while (guess); + result.push(guess); + part = subtract(part, check); + } + result.reverse(); + return [arrayToSmall(result), arrayToSmall(part)]; + } + function divModSmall(value, lambda) { + var length = value.length, quotient = createArray(length), base = BASE, i2, q, remainder, divisor; + remainder = 0; + for (i2 = length - 1; i2 >= 0; --i2) { + divisor = remainder * base + value[i2]; + q = truncate(divisor / lambda); + remainder = divisor - q * lambda; + quotient[i2] = q | 0; + } + return [quotient, remainder | 0]; + } + function divModAny(self2, v) { + var value, n = parseValue(v); + if (supportsNativeBigInt) { + return [new NativeBigInt(self2.value / n.value), new NativeBigInt(self2.value % n.value)]; + } + var a = self2.value, b = n.value; + var quotient; + if (b === 0) + throw new Error("Cannot divide by zero"); + if (self2.isSmall) { + if (n.isSmall) { + return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)]; + } + return [Integer[0], self2]; + } + if (n.isSmall) { + if (b === 1) + return [self2, Integer[0]]; + if (b == -1) + return [self2.negate(), Integer[0]]; + var abs = Math.abs(b); + if (abs < BASE) { + value = divModSmall(a, abs); + quotient = arrayToSmall(value[0]); + var remainder = value[1]; + if (self2.sign) + remainder = -remainder; + if (typeof quotient === "number") { + if (self2.sign !== n.sign) + quotient = -quotient; + return [new SmallInteger(quotient), new SmallInteger(remainder)]; + } + return [new BigInteger(quotient, self2.sign !== n.sign), new SmallInteger(remainder)]; + } + b = smallToArray(abs); + } + var comparison = compareAbs(a, b); + if (comparison === -1) + return [Integer[0], self2]; + if (comparison === 0) + return [Integer[self2.sign === n.sign ? 1 : -1], Integer[0]]; + if (a.length + b.length <= 200) + value = divMod1(a, b); + else + value = divMod2(a, b); + quotient = value[0]; + var qSign = self2.sign !== n.sign, mod = value[1], mSign = self2.sign; + if (typeof quotient === "number") { + if (qSign) + quotient = -quotient; + quotient = new SmallInteger(quotient); + } else + quotient = new BigInteger(quotient, qSign); + if (typeof mod === "number") { + if (mSign) + mod = -mod; + mod = new SmallInteger(mod); + } else + mod = new BigInteger(mod, mSign); + return [quotient, mod]; + } + BigInteger.prototype.divmod = function(v) { + var result = divModAny(this, v); + return { + quotient: result[0], + remainder: result[1] + }; + }; + NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod; + BigInteger.prototype.divide = function(v) { + return divModAny(this, v)[0]; + }; + NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function(v) { + return new NativeBigInt(this.value / parseValue(v).value); + }; + SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide; + BigInteger.prototype.mod = function(v) { + return divModAny(this, v)[1]; + }; + NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function(v) { + return new NativeBigInt(this.value % parseValue(v).value); + }; + SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod; + BigInteger.prototype.pow = function(v) { + var n = parseValue(v), a = this.value, b = n.value, value, x, y; + if (b === 0) + return Integer[1]; + if (a === 0) + return Integer[0]; + if (a === 1) + return Integer[1]; + if (a === -1) + return n.isEven() ? Integer[1] : Integer[-1]; + if (n.sign) { + return Integer[0]; + } + if (!n.isSmall) + throw new Error("The exponent " + n.toString() + " is too large."); + if (this.isSmall) { + if (isPrecise(value = Math.pow(a, b))) + return new SmallInteger(truncate(value)); + } + x = this; + y = Integer[1]; + while (true) { + if (b & true) { + y = y.times(x); + --b; + } + if (b === 0) + break; + b /= 2; + x = x.square(); + } + return y; + }; + SmallInteger.prototype.pow = BigInteger.prototype.pow; + NativeBigInt.prototype.pow = function(v) { + var n = parseValue(v); + var a = this.value, b = n.value; + var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2); + if (b === _0) + return Integer[1]; + if (a === _0) + return Integer[0]; + if (a === _1) + return Integer[1]; + if (a === BigInt(-1)) + return n.isEven() ? Integer[1] : Integer[-1]; + if (n.isNegative()) + return new NativeBigInt(_0); + var x = this; + var y = Integer[1]; + while (true) { + if ((b & _1) === _1) { + y = y.times(x); + --b; + } + if (b === _0) + break; + b /= _2; + x = x.square(); + } + return y; + }; + BigInteger.prototype.modPow = function(exp, mod) { + exp = parseValue(exp); + mod = parseValue(mod); + if (mod.isZero()) + throw new Error("Cannot take modPow with modulus 0"); + var r = Integer[1], base = this.mod(mod); + if (exp.isNegative()) { + exp = exp.multiply(Integer[-1]); + base = base.modInv(mod); + } + while (exp.isPositive()) { + if (base.isZero()) + return Integer[0]; + if (exp.isOdd()) + r = r.multiply(base).mod(mod); + exp = exp.divide(2); + base = base.square().mod(mod); + } + return r; + }; + NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow; + function compareAbs(a, b) { + if (a.length !== b.length) { + return a.length > b.length ? 1 : -1; + } + for (var i2 = a.length - 1; i2 >= 0; i2--) { + if (a[i2] !== b[i2]) + return a[i2] > b[i2] ? 1 : -1; + } + return 0; + } + BigInteger.prototype.compareAbs = function(v) { + var n = parseValue(v), a = this.value, b = n.value; + if (n.isSmall) + return 1; + return compareAbs(a, b); + }; + SmallInteger.prototype.compareAbs = function(v) { + var n = parseValue(v), a = Math.abs(this.value), b = n.value; + if (n.isSmall) { + b = Math.abs(b); + return a === b ? 0 : a > b ? 1 : -1; + } + return -1; + }; + NativeBigInt.prototype.compareAbs = function(v) { + var a = this.value; + var b = parseValue(v).value; + a = a >= 0 ? a : -a; + b = b >= 0 ? b : -b; + return a === b ? 0 : a > b ? 1 : -1; + }; + BigInteger.prototype.compare = function(v) { + if (v === Infinity) { + return -1; + } + if (v === -Infinity) { + return 1; + } + var n = parseValue(v), a = this.value, b = n.value; + if (this.sign !== n.sign) { + return n.sign ? 1 : -1; + } + if (n.isSmall) { + return this.sign ? -1 : 1; + } + return compareAbs(a, b) * (this.sign ? -1 : 1); + }; + BigInteger.prototype.compareTo = BigInteger.prototype.compare; + SmallInteger.prototype.compare = function(v) { + if (v === Infinity) { + return -1; + } + if (v === -Infinity) { + return 1; + } + var n = parseValue(v), a = this.value, b = n.value; + if (n.isSmall) { + return a == b ? 0 : a > b ? 1 : -1; + } + if (a < 0 !== n.sign) { + return a < 0 ? -1 : 1; + } + return a < 0 ? 1 : -1; + }; + SmallInteger.prototype.compareTo = SmallInteger.prototype.compare; + NativeBigInt.prototype.compare = function(v) { + if (v === Infinity) { + return -1; + } + if (v === -Infinity) { + return 1; + } + var a = this.value; + var b = parseValue(v).value; + return a === b ? 0 : a > b ? 1 : -1; + }; + NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare; + BigInteger.prototype.equals = function(v) { + return this.compare(v) === 0; + }; + NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals; + BigInteger.prototype.notEquals = function(v) { + return this.compare(v) !== 0; + }; + NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals; + BigInteger.prototype.greater = function(v) { + return this.compare(v) > 0; + }; + NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater; + BigInteger.prototype.lesser = function(v) { + return this.compare(v) < 0; + }; + NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser; + BigInteger.prototype.greaterOrEquals = function(v) { + return this.compare(v) >= 0; + }; + NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals; + BigInteger.prototype.lesserOrEquals = function(v) { + return this.compare(v) <= 0; + }; + NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals; + BigInteger.prototype.isEven = function() { + return (this.value[0] & 1) === 0; + }; + SmallInteger.prototype.isEven = function() { + return (this.value & 1) === 0; + }; + NativeBigInt.prototype.isEven = function() { + return (this.value & BigInt(1)) === BigInt(0); + }; + BigInteger.prototype.isOdd = function() { + return (this.value[0] & 1) === 1; + }; + SmallInteger.prototype.isOdd = function() { + return (this.value & 1) === 1; + }; + NativeBigInt.prototype.isOdd = function() { + return (this.value & BigInt(1)) === BigInt(1); + }; + BigInteger.prototype.isPositive = function() { + return !this.sign; + }; + SmallInteger.prototype.isPositive = function() { + return this.value > 0; + }; + NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive; + BigInteger.prototype.isNegative = function() { + return this.sign; + }; + SmallInteger.prototype.isNegative = function() { + return this.value < 0; + }; + NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative; + BigInteger.prototype.isUnit = function() { + return false; + }; + SmallInteger.prototype.isUnit = function() { + return Math.abs(this.value) === 1; + }; + NativeBigInt.prototype.isUnit = function() { + return this.abs().value === BigInt(1); + }; + BigInteger.prototype.isZero = function() { + return false; + }; + SmallInteger.prototype.isZero = function() { + return this.value === 0; + }; + NativeBigInt.prototype.isZero = function() { + return this.value === BigInt(0); + }; + BigInteger.prototype.isDivisibleBy = function(v) { + var n = parseValue(v); + if (n.isZero()) + return false; + if (n.isUnit()) + return true; + if (n.compareAbs(2) === 0) + return this.isEven(); + return this.mod(n).isZero(); + }; + NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy; + function isBasicPrime(v) { + var n = v.abs(); + if (n.isUnit()) + return false; + if (n.equals(2) || n.equals(3) || n.equals(5)) + return true; + if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) + return false; + if (n.lesser(49)) + return true; + } + function millerRabinTest(n, a) { + var nPrev = n.prev(), b = nPrev, r = 0, d, t, i2, x; + while (b.isEven()) + b = b.divide(2), r++; + next: + for (i2 = 0; i2 < a.length; i2++) { + if (n.lesser(a[i2])) + continue; + x = bigInt(a[i2]).modPow(b, n); + if (x.isUnit() || x.equals(nPrev)) + continue; + for (d = r - 1; d != 0; d--) { + x = x.square().mod(n); + if (x.isUnit()) + return false; + if (x.equals(nPrev)) + continue next; + } + return false; + } + return true; + } + BigInteger.prototype.isPrime = function(strict) { + var isPrime = isBasicPrime(this); + if (isPrime !== undefined2) + return isPrime; + var n = this.abs(); + var bits = n.bitLength(); + if (bits <= 64) + return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]); + var logN = Math.log(2) * bits.toJSNumber(); + var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN); + for (var a = [], i2 = 0; i2 < t; i2++) { + a.push(bigInt(i2 + 2)); + } + return millerRabinTest(n, a); + }; + NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime; + BigInteger.prototype.isProbablePrime = function(iterations, rng) { + var isPrime = isBasicPrime(this); + if (isPrime !== undefined2) + return isPrime; + var n = this.abs(); + var t = iterations === undefined2 ? 5 : iterations; + for (var a = [], i2 = 0; i2 < t; i2++) { + a.push(bigInt.randBetween(2, n.minus(2), rng)); + } + return millerRabinTest(n, a); + }; + NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime; + BigInteger.prototype.modInv = function(n) { + var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR; + while (!newR.isZero()) { + q = r.divide(newR); + lastT = t; + lastR = r; + t = newT; + r = newR; + newT = lastT.subtract(q.multiply(newT)); + newR = lastR.subtract(q.multiply(newR)); + } + if (!r.isUnit()) + throw new Error(this.toString() + " and " + n.toString() + " are not co-prime"); + if (t.compare(0) === -1) { + t = t.add(n); + } + if (this.isNegative()) { + return t.negate(); + } + return t; + }; + NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv; + BigInteger.prototype.next = function() { + var value = this.value; + if (this.sign) { + return subtractSmall(value, 1, this.sign); + } + return new BigInteger(addSmall(value, 1), this.sign); + }; + SmallInteger.prototype.next = function() { + var value = this.value; + if (value + 1 < MAX_INT) + return new SmallInteger(value + 1); + return new BigInteger(MAX_INT_ARR, false); + }; + NativeBigInt.prototype.next = function() { + return new NativeBigInt(this.value + BigInt(1)); + }; + BigInteger.prototype.prev = function() { + var value = this.value; + if (this.sign) { + return new BigInteger(addSmall(value, 1), true); + } + return subtractSmall(value, 1, this.sign); + }; + SmallInteger.prototype.prev = function() { + var value = this.value; + if (value - 1 > -MAX_INT) + return new SmallInteger(value - 1); + return new BigInteger(MAX_INT_ARR, true); + }; + NativeBigInt.prototype.prev = function() { + return new NativeBigInt(this.value - BigInt(1)); + }; + var powersOfTwo = [1]; + while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) + powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]); + var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1]; + function shift_isSmall(n) { + return Math.abs(n) <= BASE; + } + BigInteger.prototype.shiftLeft = function(v) { + var n = parseValue(v).toJSNumber(); + if (!shift_isSmall(n)) { + throw new Error(String(n) + " is too large for shifting."); + } + if (n < 0) + return this.shiftRight(-n); + var result = this; + if (result.isZero()) + return result; + while (n >= powers2Length) { + result = result.multiply(highestPower2); + n -= powers2Length - 1; + } + return result.multiply(powersOfTwo[n]); + }; + NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft; + BigInteger.prototype.shiftRight = function(v) { + var remQuo; + var n = parseValue(v).toJSNumber(); + if (!shift_isSmall(n)) { + throw new Error(String(n) + " is too large for shifting."); + } + if (n < 0) + return this.shiftLeft(-n); + var result = this; + while (n >= powers2Length) { + if (result.isZero() || result.isNegative() && result.isUnit()) + return result; + remQuo = divModAny(result, highestPower2); + result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0]; + n -= powers2Length - 1; + } + remQuo = divModAny(result, powersOfTwo[n]); + return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0]; + }; + NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight; + function bitwise(x, y, fn) { + y = parseValue(y); + var xSign = x.isNegative(), ySign = y.isNegative(); + var xRem = xSign ? x.not() : x, yRem = ySign ? y.not() : y; + var xDigit = 0, yDigit = 0; + var xDivMod = null, yDivMod = null; + var result = []; + while (!xRem.isZero() || !yRem.isZero()) { + xDivMod = divModAny(xRem, highestPower2); + xDigit = xDivMod[1].toJSNumber(); + if (xSign) { + xDigit = highestPower2 - 1 - xDigit; + } + yDivMod = divModAny(yRem, highestPower2); + yDigit = yDivMod[1].toJSNumber(); + if (ySign) { + yDigit = highestPower2 - 1 - yDigit; + } + xRem = xDivMod[0]; + yRem = yDivMod[0]; + result.push(fn(xDigit, yDigit)); + } + var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0); + for (var i2 = result.length - 1; i2 >= 0; i2 -= 1) { + sum = sum.multiply(highestPower2).add(bigInt(result[i2])); + } + return sum; + } + BigInteger.prototype.not = function() { + return this.negate().prev(); + }; + NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not; + BigInteger.prototype.and = function(n) { + return bitwise(this, n, function(a, b) { + return a & b; + }); + }; + NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and; + BigInteger.prototype.or = function(n) { + return bitwise(this, n, function(a, b) { + return a | b; + }); + }; + NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or; + BigInteger.prototype.xor = function(n) { + return bitwise(this, n, function(a, b) { + return a ^ b; + }); + }; + NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor; + var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I; + function roughLOB(n) { + var v = n.value, x = typeof v === "number" ? v | LOBMASK_I : typeof v === "bigint" ? v | BigInt(LOBMASK_I) : v[0] + v[1] * BASE | LOBMASK_BI; + return x & -x; + } + function integerLogarithm(value, base) { + if (base.compareTo(value) <= 0) { + var tmp = integerLogarithm(value, base.square(base)); + var p = tmp.p; + var e = tmp.e; + var t = p.multiply(base); + return t.compareTo(value) <= 0 ? {p: t, e: e * 2 + 1} : {p, e: e * 2}; + } + return {p: bigInt(1), e: 0}; + } + BigInteger.prototype.bitLength = function() { + var n = this; + if (n.compareTo(bigInt(0)) < 0) { + n = n.negate().subtract(bigInt(1)); + } + if (n.compareTo(bigInt(0)) === 0) { + return bigInt(0); + } + return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1)); + }; + NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength; + function max(a, b) { + a = parseValue(a); + b = parseValue(b); + return a.greater(b) ? a : b; + } + function min(a, b) { + a = parseValue(a); + b = parseValue(b); + return a.lesser(b) ? a : b; + } + function gcd(a, b) { + a = parseValue(a).abs(); + b = parseValue(b).abs(); + if (a.equals(b)) + return a; + if (a.isZero()) + return b; + if (b.isZero()) + return a; + var c = Integer[1], d, t; + while (a.isEven() && b.isEven()) { + d = min(roughLOB(a), roughLOB(b)); + a = a.divide(d); + b = b.divide(d); + c = c.multiply(d); + } + while (a.isEven()) { + a = a.divide(roughLOB(a)); + } + do { + while (b.isEven()) { + b = b.divide(roughLOB(b)); + } + if (a.greater(b)) { + t = b; + b = a; + a = t; + } + b = b.subtract(a); + } while (!b.isZero()); + return c.isUnit() ? a : a.multiply(c); + } + function lcm(a, b) { + a = parseValue(a).abs(); + b = parseValue(b).abs(); + return a.divide(gcd(a, b)).multiply(b); + } + function randBetween(a, b, rng) { + a = parseValue(a); + b = parseValue(b); + var usedRNG = rng || Math.random; + var low = min(a, b), high = max(a, b); + var range = high.subtract(low).add(1); + if (range.isSmall) + return low.add(Math.floor(usedRNG() * range)); + var digits = toBase(range, BASE).value; + var result = [], restricted = true; + for (var i2 = 0; i2 < digits.length; i2++) { + var top = restricted ? digits[i2] : BASE; + var digit = truncate(usedRNG() * top); + result.push(digit); + if (digit < top) + restricted = false; + } + return low.add(Integer.fromArray(result, BASE, false)); + } + var parseBase = function(text, base, alphabet, caseSensitive) { + alphabet = alphabet || DEFAULT_ALPHABET; + text = String(text); + if (!caseSensitive) { + text = text.toLowerCase(); + alphabet = alphabet.toLowerCase(); + } + var length = text.length; + var i2; + var absBase = Math.abs(base); + var alphabetValues = {}; + for (i2 = 0; i2 < alphabet.length; i2++) { + alphabetValues[alphabet[i2]] = i2; + } + for (i2 = 0; i2 < length; i2++) { + var c = text[i2]; + if (c === "-") + continue; + if (c in alphabetValues) { + if (alphabetValues[c] >= absBase) { + if (c === "1" && absBase === 1) + continue; + throw new Error(c + " is not a valid digit in base " + base + "."); + } + } + } + base = parseValue(base); + var digits = []; + var isNegative = text[0] === "-"; + for (i2 = isNegative ? 1 : 0; i2 < text.length; i2++) { + var c = text[i2]; + if (c in alphabetValues) + digits.push(parseValue(alphabetValues[c])); + else if (c === "<") { + var start = i2; + do { + i2++; + } while (text[i2] !== ">" && i2 < text.length); + digits.push(parseValue(text.slice(start + 1, i2))); + } else + throw new Error(c + " is not a valid character"); + } + return parseBaseFromArray(digits, base, isNegative); + }; + function parseBaseFromArray(digits, base, isNegative) { + var val = Integer[0], pow = Integer[1], i2; + for (i2 = digits.length - 1; i2 >= 0; i2--) { + val = val.add(digits[i2].times(pow)); + pow = pow.times(base); + } + return isNegative ? val.negate() : val; + } + function stringify(digit, alphabet) { + alphabet = alphabet || DEFAULT_ALPHABET; + if (digit < alphabet.length) { + return alphabet[digit]; + } + return "<" + digit + ">"; + } + function toBase(n, base) { + base = bigInt(base); + if (base.isZero()) { + if (n.isZero()) + return {value: [0], isNegative: false}; + throw new Error("Cannot convert nonzero numbers to base 0."); + } + if (base.equals(-1)) { + if (n.isZero()) + return {value: [0], isNegative: false}; + if (n.isNegative()) + return { + value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber())).map(Array.prototype.valueOf, [1, 0])), + isNegative: false + }; + var arr = Array.apply(null, Array(n.toJSNumber() - 1)).map(Array.prototype.valueOf, [0, 1]); + arr.unshift([1]); + return { + value: [].concat.apply([], arr), + isNegative: false + }; + } + var neg = false; + if (n.isNegative() && base.isPositive()) { + neg = true; + n = n.abs(); + } + if (base.isUnit()) { + if (n.isZero()) + return {value: [0], isNegative: false}; + return { + value: Array.apply(null, Array(n.toJSNumber())).map(Number.prototype.valueOf, 1), + isNegative: neg + }; + } + var out = []; + var left = n, divmod; + while (left.isNegative() || left.compareAbs(base) >= 0) { + divmod = left.divmod(base); + left = divmod.quotient; + var digit = divmod.remainder; + if (digit.isNegative()) { + digit = base.minus(digit).abs(); + left = left.next(); + } + out.push(digit.toJSNumber()); + } + out.push(left.toJSNumber()); + return {value: out.reverse(), isNegative: neg}; + } + function toBaseString(n, base, alphabet) { + var arr = toBase(n, base); + return (arr.isNegative ? "-" : "") + arr.value.map(function(x) { + return stringify(x, alphabet); + }).join(""); + } + BigInteger.prototype.toArray = function(radix) { + return toBase(this, radix); + }; + SmallInteger.prototype.toArray = function(radix) { + return toBase(this, radix); + }; + NativeBigInt.prototype.toArray = function(radix) { + return toBase(this, radix); + }; + BigInteger.prototype.toString = function(radix, alphabet) { + if (radix === undefined2) + radix = 10; + if (radix !== 10) + return toBaseString(this, radix, alphabet); + var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit; + while (--l >= 0) { + digit = String(v[l]); + str += zeros.slice(digit.length) + digit; + } + var sign = this.sign ? "-" : ""; + return sign + str; + }; + SmallInteger.prototype.toString = function(radix, alphabet) { + if (radix === undefined2) + radix = 10; + if (radix != 10) + return toBaseString(this, radix, alphabet); + return String(this.value); + }; + NativeBigInt.prototype.toString = SmallInteger.prototype.toString; + NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function() { + return this.toString(); + }; + BigInteger.prototype.valueOf = function() { + return parseInt(this.toString(), 10); + }; + BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf; + SmallInteger.prototype.valueOf = function() { + return this.value; + }; + SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf; + NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function() { + return parseInt(this.toString(), 10); + }; + function parseStringValue(v) { + if (isPrecise(+v)) { + var x = +v; + if (x === truncate(x)) + return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x); + throw new Error("Invalid integer: " + v); + } + var sign = v[0] === "-"; + if (sign) + v = v.slice(1); + var split = v.split(/e/i); + if (split.length > 2) + throw new Error("Invalid integer: " + split.join("e")); + if (split.length === 2) { + var exp = split[1]; + if (exp[0] === "+") + exp = exp.slice(1); + exp = +exp; + if (exp !== truncate(exp) || !isPrecise(exp)) + throw new Error("Invalid integer: " + exp + " is not a valid exponent."); + var text = split[0]; + var decimalPlace = text.indexOf("."); + if (decimalPlace >= 0) { + exp -= text.length - decimalPlace - 1; + text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1); + } + if (exp < 0) + throw new Error("Cannot include negative exponent part for integers"); + text += new Array(exp + 1).join("0"); + v = text; + } + var isValid = /^([0-9][0-9]*)$/.test(v); + if (!isValid) + throw new Error("Invalid integer: " + v); + if (supportsNativeBigInt) { + return new NativeBigInt(BigInt(sign ? "-" + v : v)); + } + var r = [], max2 = v.length, l = LOG_BASE, min2 = max2 - l; + while (max2 > 0) { + r.push(+v.slice(min2, max2)); + min2 -= l; + if (min2 < 0) + min2 = 0; + max2 -= l; + } + trim(r); + return new BigInteger(r, sign); + } + function parseNumberValue(v) { + if (supportsNativeBigInt) { + return new NativeBigInt(BigInt(v)); + } + if (isPrecise(v)) { + if (v !== truncate(v)) + throw new Error(v + " is not an integer."); + return new SmallInteger(v); + } + return parseStringValue(v.toString()); + } + function parseValue(v) { + if (typeof v === "number") { + return parseNumberValue(v); + } + if (typeof v === "string") { + return parseStringValue(v); + } + if (typeof v === "bigint") { + return new NativeBigInt(v); + } + return v; + } + for (var i = 0; i < 1e3; i++) { + Integer[i] = parseValue(i); + if (i > 0) + Integer[-i] = parseValue(-i); + } + Integer.one = Integer[1]; + Integer.zero = Integer[0]; + Integer.minusOne = Integer[-1]; + Integer.max = max; + Integer.min = min; + Integer.gcd = gcd; + Integer.lcm = lcm; + Integer.isInstance = function(x) { + return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; + }; + Integer.randBetween = randBetween; + Integer.fromArray = function(digits, base, isNegative) { + return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative); + }; + return Integer; + }(); + if (typeof module2 !== "undefined" && module2.hasOwnProperty("exports")) { + module2.exports = bigInt; + } + if (typeof define === "function" && define.amd) { + define(function() { + return bigInt; + }); + } +}); + +// node_modules/unzipper/lib/Decrypt.js +var require_Decrypt = __commonJS((exports2, module2) => { + var bigInt = require_BigInteger(); + var Stream = require("stream"); + if (!Stream.Writable || !Stream.Writable.prototype.destroy) + Stream = require_readable(); + var table; + function generateTable() { + var poly = 3988292384, c, n, k; + table = []; + for (n = 0; n < 256; n++) { + c = n; + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ c >>> 1 : c = c >>> 1; + table[n] = c >>> 0; + } + } + function crc(ch, crc2) { + if (!table) + generateTable(); + if (ch.charCodeAt) + ch = ch.charCodeAt(0); + return bigInt(crc2).shiftRight(8).and(16777215).xor(table[bigInt(crc2).xor(ch).and(255)]).value; + } + function Decrypt() { + if (!(this instanceof Decrypt)) + return new Decrypt(); + this.key0 = 305419896; + this.key1 = 591751049; + this.key2 = 878082192; + } + Decrypt.prototype.update = function(h) { + this.key0 = crc(h, this.key0); + this.key1 = bigInt(this.key0).and(255).and(4294967295).add(this.key1); + this.key1 = bigInt(this.key1).multiply(134775813).add(1).and(4294967295).value; + this.key2 = crc(bigInt(this.key1).shiftRight(24).and(255), this.key2); + }; + Decrypt.prototype.decryptByte = function(c) { + var k = bigInt(this.key2).or(2); + c = c ^ bigInt(k).multiply(bigInt(k ^ 1)).shiftRight(8).and(255); + this.update(c); + return c; + }; + Decrypt.prototype.stream = function() { + var stream = Stream.Transform(), self2 = this; + stream._transform = function(d, e, cb) { + for (var i = 0; i < d.length; i++) { + d[i] = self2.decryptByte(d[i]); + } + this.push(d); + cb(); + }; + return stream; + }; + module2.exports = Decrypt; +}); + +// node_modules/unzipper/lib/Open/unzip.js +var require_unzip = __commonJS((exports2, module2) => { + var Promise2 = require_bluebird(); + var Decrypt = require_Decrypt(); + var PullStream = require_PullStream(); + var Stream = require("stream"); + var binary = require_binary(); + var zlib = require("zlib"); + var parseExtraField = require_parseExtraField(); + var Buffer2 = require_Buffer(); + var parseDateTime = require_parseDateTime(); + if (!Stream.Writable || !Stream.Writable.prototype.destroy) + Stream = require_readable(); + module2.exports = function unzip(source, offset, _password, directoryVars) { + var file = PullStream(), entry = Stream.PassThrough(); + var req = source.stream(offset); + req.pipe(file).on("error", function(e) { + entry.emit("error", e); + }); + entry.vars = file.pull(30).then(function(data) { + var vars = binary.parse(data).word32lu("signature").word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").vars; + vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime); + return file.pull(vars.fileNameLength).then(function(fileName) { + vars.fileName = fileName.toString("utf8"); + return file.pull(vars.extraFieldLength); + }).then(function(extraField) { + var checkEncryption; + vars.extra = parseExtraField(extraField, vars); + if (directoryVars && directoryVars.compressedSize) + vars = directoryVars; + if (vars.flags & 1) + checkEncryption = file.pull(12).then(function(header) { + if (!_password) + throw new Error("MISSING_PASSWORD"); + var decrypt = Decrypt(); + String(_password).split("").forEach(function(d) { + decrypt.update(d); + }); + for (var i = 0; i < header.length; i++) + header[i] = decrypt.decryptByte(header[i]); + vars.decrypt = decrypt; + vars.compressedSize -= 12; + var check = vars.flags & 8 ? vars.lastModifiedTime >> 8 & 255 : vars.crc32 >> 24 & 255; + if (header[11] !== check) + throw new Error("BAD_PASSWORD"); + return vars; + }); + return Promise2.resolve(checkEncryption).then(function() { + entry.emit("vars", vars); + return vars; + }); + }); + }); + entry.vars.then(function(vars) { + var fileSizeKnown = !(vars.flags & 8) || vars.compressedSize > 0, eof; + var inflater = vars.compressionMethod ? zlib.createInflateRaw() : Stream.PassThrough(); + if (fileSizeKnown) { + entry.size = vars.uncompressedSize; + eof = vars.compressedSize; + } else { + eof = Buffer2.alloc(4); + eof.writeUInt32LE(134695760, 0); + } + var stream = file.stream(eof); + if (vars.decrypt) + stream = stream.pipe(vars.decrypt.stream()); + stream.pipe(inflater).on("error", function(err) { + entry.emit("error", err); + }).pipe(entry).on("finish", function() { + if (req.abort) + req.abort(); + else if (req.close) + req.close(); + else if (req.push) + req.push(); + else + console.log("warning - unable to close stream"); + }); + }).catch(function(e) { + entry.emit("error", e); + }); + return entry; + }; +}); + +// node_modules/unzipper/lib/Open/directory.js +var require_directory = __commonJS((exports2, module2) => { + var binary = require_binary(); + var PullStream = require_PullStream(); + var unzip = require_unzip(); + var Promise2 = require_bluebird(); + var BufferStream = require_BufferStream(); + var parseExtraField = require_parseExtraField(); + var Buffer2 = require_Buffer(); + var path = require("path"); + var Writer = require_fstream().Writer; + var parseDateTime = require_parseDateTime(); + var signature = Buffer2.alloc(4); + signature.writeUInt32LE(101010256, 0); + function getCrxHeader(source) { + var sourceStream = source.stream(0).pipe(PullStream()); + return sourceStream.pull(4).then(function(data) { + var signature2 = data.readUInt32LE(0); + if (signature2 === 875721283) { + var crxHeader; + return sourceStream.pull(12).then(function(data2) { + crxHeader = binary.parse(data2).word32lu("version").word32lu("pubKeyLength").word32lu("signatureLength").vars; + }).then(function() { + return sourceStream.pull(crxHeader.pubKeyLength + crxHeader.signatureLength); + }).then(function(data2) { + crxHeader.publicKey = data2.slice(0, crxHeader.pubKeyLength); + crxHeader.signature = data2.slice(crxHeader.pubKeyLength); + crxHeader.size = 16 + crxHeader.pubKeyLength + crxHeader.signatureLength; + return crxHeader; + }); + } + }); + } + function getZip64CentralDirectory(source, zip64CDL) { + var d64loc = binary.parse(zip64CDL).word32lu("signature").word32lu("diskNumber").word64lu("offsetToStartOfCentralDirectory").word32lu("numberOfDisks").vars; + if (d64loc.signature != 117853008) { + throw new Error("invalid zip64 end of central dir locator signature (0x07064b50): 0x" + d64loc.signature.toString(16)); + } + var dir64 = PullStream(); + source.stream(d64loc.offsetToStartOfCentralDirectory).pipe(dir64); + return dir64.pull(56); + } + function parseZip64DirRecord(dir64record) { + var vars = binary.parse(dir64record).word32lu("signature").word64lu("sizeOfCentralDirectory").word16lu("version").word16lu("versionsNeededToExtract").word32lu("diskNumber").word32lu("diskStart").word64lu("numberOfRecordsOnDisk").word64lu("numberOfRecords").word64lu("sizeOfCentralDirectory").word64lu("offsetToStartOfCentralDirectory").vars; + if (vars.signature != 101075792) { + throw new Error("invalid zip64 end of central dir locator signature (0x06064b50): 0x0" + vars.signature.toString(16)); + } + return vars; + } + module2.exports = function centralDirectory(source, options) { + var endDir = PullStream(), records = PullStream(), tailSize = options && options.tailSize || 80, sourceSize, crxHeader, startOffset, vars; + if (options && options.crx) + crxHeader = getCrxHeader(source); + return source.size().then(function(size) { + sourceSize = size; + source.stream(Math.max(0, size - tailSize)).on("error", function(error) { + endDir.emit("error", error); + }).pipe(endDir); + return endDir.pull(signature); + }).then(function() { + return Promise2.props({directory: endDir.pull(22), crxHeader}); + }).then(function(d) { + var data = d.directory; + startOffset = d.crxHeader && d.crxHeader.size || 0; + vars = binary.parse(data).word32lu("signature").word16lu("diskNumber").word16lu("diskStart").word16lu("numberOfRecordsOnDisk").word16lu("numberOfRecords").word32lu("sizeOfCentralDirectory").word32lu("offsetToStartOfCentralDirectory").word16lu("commentLength").vars; + if (vars.numberOfRecords == 65535 || vars.numberOfRecords == 65535 || vars.offsetToStartOfCentralDirectory == 4294967295) { + const zip64CDLSize = 20; + const zip64CDLOffset = sourceSize - (tailSize - endDir.match + zip64CDLSize); + const zip64CDLStream = PullStream(); + source.stream(zip64CDLOffset).pipe(zip64CDLStream); + return zip64CDLStream.pull(zip64CDLSize).then(function(d2) { + return getZip64CentralDirectory(source, d2); + }).then(function(dir64record) { + vars = parseZip64DirRecord(dir64record); + }); + } else { + vars.offsetToStartOfCentralDirectory += startOffset; + } + }).then(function() { + source.stream(vars.offsetToStartOfCentralDirectory).pipe(records); + vars.extract = function(opts) { + if (!opts || !opts.path) + throw new Error("PATH_MISSING"); + return vars.files.then(function(files) { + return Promise2.map(files, function(entry) { + if (entry.type == "Directory") + return; + var extractPath = path.join(opts.path, entry.path); + if (extractPath.indexOf(opts.path) != 0) { + return; + } + var writer = opts.getWriter ? opts.getWriter({path: extractPath}) : Writer({path: extractPath}); + return new Promise2(function(resolve, reject) { + entry.stream(opts.password).on("error", reject).pipe(writer).on("close", resolve).on("error", reject); + }); + }, opts.concurrency > 1 ? {concurrency: opts.concurrency || void 0} : void 0); + }); + }; + vars.files = Promise2.mapSeries(Array(vars.numberOfRecords), function() { + return records.pull(46).then(function(data) { + var vars2 = binary.parse(data).word32lu("signature").word16lu("versionMadeBy").word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").word16lu("fileCommentLength").word16lu("diskNumber").word16lu("internalFileAttributes").word32lu("externalFileAttributes").word32lu("offsetToLocalFileHeader").vars; + vars2.offsetToLocalFileHeader += startOffset; + vars2.lastModifiedDateTime = parseDateTime(vars2.lastModifiedDate, vars2.lastModifiedTime); + return records.pull(vars2.fileNameLength).then(function(fileNameBuffer) { + vars2.pathBuffer = fileNameBuffer; + vars2.path = fileNameBuffer.toString("utf8"); + vars2.isUnicode = vars2.flags & 17; + return records.pull(vars2.extraFieldLength); + }).then(function(extraField) { + vars2.extra = parseExtraField(extraField, vars2); + return records.pull(vars2.fileCommentLength); + }).then(function(comment) { + vars2.comment = comment; + vars2.type = vars2.uncompressedSize === 0 && /[\/\\]$/.test(vars2.path) ? "Directory" : "File"; + vars2.stream = function(_password) { + return unzip(source, vars2.offsetToLocalFileHeader, _password, vars2); + }; + vars2.buffer = function(_password) { + return BufferStream(vars2.stream(_password)); + }; + return vars2; + }); + }); + }); + return Promise2.props(vars); + }); + }; +}); + +// node_modules/unzipper/lib/Open/index.js +var require_Open = __commonJS((exports2, module2) => { + var fs = require_graceful_fs(); + var Promise2 = require_bluebird(); + var directory = require_directory(); + var Stream = require("stream"); + if (!Stream.Writable || !Stream.Writable.prototype.destroy) + Stream = require_readable(); + module2.exports = { + buffer: function(buffer, options) { + var source = { + stream: function(offset, length) { + var stream = Stream.PassThrough(); + stream.end(buffer.slice(offset, length)); + return stream; + }, + size: function() { + return Promise2.resolve(buffer.length); + } + }; + return directory(source, options); + }, + file: function(filename, options) { + var source = { + stream: function(offset, length) { + return fs.createReadStream(filename, {start: offset, end: length && offset + length}); + }, + size: function() { + return new Promise2(function(resolve, reject) { + fs.stat(filename, function(err, d) { + if (err) + reject(err); + else + resolve(d.size); + }); + }); + } + }; + return directory(source, options); + }, + url: function(request, params, options) { + if (typeof params === "string") + params = {url: params}; + if (!params.url) + throw "URL missing"; + params.headers = params.headers || {}; + var source = { + stream: function(offset, length) { + var options2 = Object.create(params); + options2.headers = Object.create(params.headers); + options2.headers.range = "bytes=" + offset + "-" + (length ? length : ""); + return request(options2); + }, + size: function() { + return new Promise2(function(resolve, reject) { + var req = request(params); + req.on("response", function(d) { + req.abort(); + if (!d.headers["content-length"]) + reject(new Error("Missing content length header")); + else + resolve(d.headers["content-length"]); + }).on("error", reject); + }); + } + }; + return directory(source, options); + }, + s3: function(client, params, options) { + var source = { + size: function() { + return new Promise2(function(resolve, reject) { + client.headObject(params, function(err, d) { + if (err) + reject(err); + else + resolve(d.ContentLength); + }); + }); + }, + stream: function(offset, length) { + var d = {}; + for (var key in params) + d[key] = params[key]; + d.Range = "bytes=" + offset + "-" + (length ? length : ""); + return client.getObject(d).createReadStream(); + } + }; + return directory(source, options); + } + }; +}); + +// node_modules/unzipper/unzip.js +var require_unzip2 = __commonJS((exports2) => { + "use strict"; + require_listenercount(); + require_buffer_indexof_polyfill(); + require_setImmediate(); + exports2.Parse = require_parse3(); + exports2.ParseOne = require_parseOne(); + exports2.Extract = require_extract(); + exports2.Open = require_Open(); +}); + +// node_modules/isexe/windows.js +var require_windows = __commonJS((exports2, module2) => { + module2.exports = isexe; + isexe.sync = sync; + var fs = require("fs"); + function checkPathExt(path, options) { + var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT; + if (!pathext) { + return true; + } + pathext = pathext.split(";"); + if (pathext.indexOf("") !== -1) { + return true; + } + for (var i = 0; i < pathext.length; i++) { + var p = pathext[i].toLowerCase(); + if (p && path.substr(-p.length).toLowerCase() === p) { + return true; + } + } + return false; + } + function checkStat(stat, path, options) { + if (!stat.isSymbolicLink() && !stat.isFile()) { + return false; + } + return checkPathExt(path, options); + } + function isexe(path, options, cb) { + fs.stat(path, function(er, stat) { + cb(er, er ? false : checkStat(stat, path, options)); + }); + } + function sync(path, options) { + return checkStat(fs.statSync(path), path, options); + } +}); + +// node_modules/isexe/mode.js +var require_mode = __commonJS((exports2, module2) => { + module2.exports = isexe; + isexe.sync = sync; + var fs = require("fs"); + function isexe(path, options, cb) { + fs.stat(path, function(er, stat) { + cb(er, er ? false : checkStat(stat, options)); + }); + } + function sync(path, options) { + return checkStat(fs.statSync(path), options); + } + function checkStat(stat, options) { + return stat.isFile() && checkMode(stat, options); + } + function checkMode(stat, options) { + var mod = stat.mode; + var uid = stat.uid; + var gid = stat.gid; + var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid(); + var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid(); + var u = parseInt("100", 8); + var g = parseInt("010", 8); + var o = parseInt("001", 8); + var ug = u | g; + var ret2 = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0; + return ret2; + } +}); + +// node_modules/isexe/index.js +var require_isexe = __commonJS((exports2, module2) => { + var fs = require("fs"); + var core; + if (process.platform === "win32" || global.TESTING_WINDOWS) { + core = require_windows(); + } else { + core = require_mode(); + } + module2.exports = isexe; + isexe.sync = sync; + function isexe(path, options, cb) { + if (typeof options === "function") { + cb = options; + options = {}; + } + if (!cb) { + if (typeof Promise !== "function") { + throw new TypeError("callback not provided"); + } + return new Promise(function(resolve, reject) { + isexe(path, options || {}, function(er, is) { + if (er) { + reject(er); + } else { + resolve(is); + } + }); + }); + } + core(path, options || {}, function(er, is) { + if (er) { + if (er.code === "EACCES" || options && options.ignoreErrors) { + er = null; + is = false; + } + } + cb(er, is); + }); + } + function sync(path, options) { + try { + return core.sync(path, options || {}); + } catch (er) { + if (options && options.ignoreErrors || er.code === "EACCES") { + return false; + } else { + throw er; + } + } + } +}); + +// node_modules/which/which.js +var require_which = __commonJS((exports2, module2) => { + var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys"; + var path = require("path"); + var COLON = isWindows ? ";" : ":"; + var isexe = require_isexe(); + var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), {code: "ENOENT"}); + var getPathInfo = (cmd, opt) => { + const colon = opt.colon || COLON; + const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [ + ...isWindows ? [process.cwd()] : [], + ...(opt.path || process.env.PATH || "").split(colon) + ]; + const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : ""; + const pathExt = isWindows ? pathExtExe.split(colon) : [""]; + if (isWindows) { + if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") + pathExt.unshift(""); + } + return { + pathEnv, + pathExt, + pathExtExe + }; + }; + var which = (cmd, opt, cb) => { + if (typeof opt === "function") { + cb = opt; + opt = {}; + } + if (!opt) + opt = {}; + const {pathEnv, pathExt, pathExtExe} = getPathInfo(cmd, opt); + const found = []; + const step = (i) => new Promise((resolve, reject) => { + if (i === pathEnv.length) + return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd)); + const ppRaw = pathEnv[i]; + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw; + const pCmd = path.join(pathPart, cmd); + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; + resolve(subStep(p, i, 0)); + }); + const subStep = (p, i, ii) => new Promise((resolve, reject) => { + if (ii === pathExt.length) + return resolve(step(i + 1)); + const ext = pathExt[ii]; + isexe(p + ext, {pathExt: pathExtExe}, (er, is) => { + if (!er && is) { + if (opt.all) + found.push(p + ext); + else + return resolve(p + ext); + } + return resolve(subStep(p, i, ii + 1)); + }); + }); + return cb ? step(0).then((res) => cb(null, res), cb) : step(0); + }; + var whichSync = (cmd, opt) => { + opt = opt || {}; + const {pathEnv, pathExt, pathExtExe} = getPathInfo(cmd, opt); + const found = []; + for (let i = 0; i < pathEnv.length; i++) { + const ppRaw = pathEnv[i]; + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw; + const pCmd = path.join(pathPart, cmd); + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; + for (let j = 0; j < pathExt.length; j++) { + const cur = p + pathExt[j]; + try { + const is = isexe.sync(cur, {pathExt: pathExtExe}); + if (is) { + if (opt.all) + found.push(cur); + else + return cur; + } + } catch (ex) { + } + } + } + if (opt.all && found.length) + return found; + if (opt.nothrow) + return null; + throw getNotFoundError(cmd); + }; + module2.exports = which; + which.sync = whichSync; +}); + +// node_modules/@clangd/install/out/src/index.js +var require_src = __commonJS((exports2) => { + "use strict"; + var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __asyncValues = exports2 && exports2.__asyncValues || function(o) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n) { + i[n] = o[n] && function(v) { + return new Promise(function(resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; + } + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function(v2) { + resolve({value: v2, done: d}); + }, reject); + } + }; + Object.defineProperty(exports2, "__esModule", {value: true}); + var abort_controller_1 = require_abort_controller(); + var child_process = require("child_process"); + var fs = require("fs"); + var node_fetch_1 = require_lib(); + var os = require("os"); + var path = require("path"); + var readdirp = require_readdirp(); + var rimraf = require_rimraf(); + var semver = require_semver2(); + var stream = require("stream"); + var unzipper = require_unzip2(); + var util_1 = require("util"); + var which = require_which(); + function prepare2(ui, checkUpdate) { + return __awaiter(this, void 0, void 0, function* () { + try { + var absPath = yield util_1.promisify(which)(ui.clangdPath); + } catch (e) { + return {clangdPath: null, background: recover(ui)}; + } + return { + clangdPath: absPath, + background: checkUpdate ? checkUpdates2(false, ui) : Promise.resolve() + }; + }); + } + exports2.prepare = prepare2; + function installLatest2(ui) { + return __awaiter(this, void 0, void 0, function* () { + const abort = new abort_controller_1.AbortController(); + try { + const release = yield Github.latestRelease(); + const asset = yield Github.chooseAsset(release); + ui.clangdPath = yield Install.install(release, asset, abort, ui); + ui.promptReload(`clangd ${release.name} is now installed.`); + } catch (e) { + if (!abort.signal.aborted) { + console.error("Failed to install clangd: ", e); + const message = `Failed to install clangd language server: ${e} +You may want to install it manually.`; + ui.showHelp(message, installURL); + } + } + }); + } + exports2.installLatest = installLatest2; + function checkUpdates2(requested, ui) { + return __awaiter(this, void 0, void 0, function* () { + try { + var release = yield Github.latestRelease(); + yield Github.chooseAsset(release); + var upgrade = yield Version.upgrade(release, ui.clangdPath); + } catch (e) { + console.log("Failed to check for clangd update: ", e); + if (requested) + ui.error(`Failed to check for clangd update: ${e}`); + return; + } + console.log("Checking for clangd update: available=", upgrade.new, " installed=", upgrade.old); + if (!upgrade.upgrade) { + if (requested) + ui.info(`clangd is up-to-date (you have ${upgrade.old}, latest is ${upgrade.new})`); + return; + } + ui.promptUpdate(upgrade.old, upgrade.new); + }); + } + exports2.checkUpdates = checkUpdates2; + function recover(ui) { + return __awaiter(this, void 0, void 0, function* () { + try { + const release = yield Github.latestRelease(); + yield Github.chooseAsset(release); + ui.promptInstall(release.name); + } catch (e) { + console.error("Auto-install failed: ", e); + ui.showHelp("The clangd language server is not installed.", installURL); + } + }); + } + var installURL = "https://clangd.llvm.org/installation.html"; + var githubReleaseURL = "https://api.github.com/repos/clangd/clangd/releases/latest"; + function fakeGitHubReleaseURL(u) { + githubReleaseURL = u; + } + exports2.fakeGitHubReleaseURL = fakeGitHubReleaseURL; + var lddCommand = "ldd"; + function fakeLddCommand(l) { + lddCommand = l; + } + exports2.fakeLddCommand = fakeLddCommand; + var Github; + (function(Github2) { + function latestRelease() { + return __awaiter(this, void 0, void 0, function* () { + const response = yield node_fetch_1.default(githubReleaseURL); + if (!response.ok) { + console.log(response.url, response.status, response.statusText); + throw new Error(`Can't fetch release: ${response.statusText}`); + } + return yield response.json(); + }); + } + Github2.latestRelease = latestRelease; + function chooseAsset(release) { + return __awaiter(this, void 0, void 0, function* () { + const variants = { + win32: "windows", + linux: "linux", + darwin: "mac" + }; + const variant = variants[os.platform()]; + if (variant == "linux") { + const minGlibc = new semver.Range("2.18"); + const oldGlibc = yield Version.oldGlibc(minGlibc); + if (oldGlibc) { + throw new Error(`The clangd release is not compatible with your system (glibc ${oldGlibc.raw} < ${minGlibc.raw}). Try to install it using your package manager instead.`); + } + } + if (variant && (os.arch() == "x64" || variant == "windows")) { + const asset = release.assets.find((a) => a.name.indexOf(variant) >= 0); + if (asset) + return asset; + } + throw new Error(`No clangd ${release.name} binary available for ${os.platform()}/${os.arch()}`); + }); + } + Github2.chooseAsset = chooseAsset; + })(Github || (Github = {})); + var Install; + (function(Install2) { + function install2(release, asset, abort, ui) { + return __awaiter(this, void 0, void 0, function* () { + const dirs = yield createDirs(ui); + const extractRoot = path.join(dirs.install, release.tag_name); + if (yield util_1.promisify(fs.exists)(extractRoot)) { + const reuse = yield ui.shouldReuse(release.name); + if (reuse === void 0) { + abort.abort(); + throw new Error(`clangd ${release.name} already installed!`); + } + if (reuse) { + let files = (yield readdirp.promise(extractRoot)).map((e) => e.fullPath); + return findExecutable(files); + } else { + yield util_1.promisify(rimraf)(extractRoot); + } + } + const zipFile = path.join(dirs.download, asset.name); + yield download(asset.browser_download_url, zipFile, abort, ui); + const archive = yield unzipper.Open.file(zipFile); + const executable = findExecutable(archive.files.map((f) => f.path)); + yield ui.slow(`Extracting ${asset.name}`, archive.extract({path: extractRoot})); + const clangdPath = path.join(extractRoot, executable); + yield fs.promises.chmod(clangdPath, 493); + yield fs.promises.unlink(zipFile); + return clangdPath; + }); + } + Install2.install = install2; + function createDirs(ui) { + return __awaiter(this, void 0, void 0, function* () { + const install3 = path.join(ui.storagePath, "install"); + const download2 = path.join(ui.storagePath, "download"); + for (const dir of [install3, download2]) + yield fs.promises.mkdir(dir, {recursive: true}); + return {install: install3, download: download2}; + }); + } + function findExecutable(paths) { + const filename = os.platform() == "win32" ? "clangd.exe" : "clangd"; + const entry = paths.find((f) => path.posix.basename(f) == filename || path.win32.basename(f) == filename); + if (entry == null) + throw new Error("Didn't find a clangd executable!"); + return entry; + } + function download(url, dest, abort, ui) { + return __awaiter(this, void 0, void 0, function* () { + console.log("Downloading ", url, " to ", dest); + return ui.progress(`Downloading ${path.basename(dest)}`, abort, (progress) => __awaiter(this, void 0, void 0, function* () { + const response = yield node_fetch_1.default(url, {signal: abort.signal}); + if (!response.ok) + throw new Error(`Failed to download $url`); + const size = Number(response.headers.get("content-length")); + let read = 0; + response.body.on("data", (chunk) => { + read += chunk.length; + progress(read / size); + }); + const out = fs.createWriteStream(dest); + yield util_1.promisify(stream.pipeline)(response.body, out).catch((e) => { + fs.unlink(dest, (_) => null); + throw e; + }); + })); + }); + } + })(Install || (Install = {})); + var Version; + (function(Version2) { + function upgrade(release, clangdPath) { + return __awaiter(this, void 0, void 0, function* () { + const releasedVer = released(release); + const installedVer = yield installed(clangdPath); + return { + old: installedVer.raw, + new: releasedVer.raw, + upgrade: rangeGreater(releasedVer, installedVer) + }; + }); + } + Version2.upgrade = upgrade; + const loose = { + loose: true + }; + function installed(clangdPath) { + return __awaiter(this, void 0, void 0, function* () { + const output = yield run(clangdPath, ["--version"]); + console.log(clangdPath, " --version output: ", output); + const prefix = "clangd version "; + if (!output.startsWith(prefix)) + throw new Error(`Couldn't parse clangd --version output: ${output}`); + const rawVersion = output.substr(prefix.length).split(" ", 1)[0]; + return new semver.Range(rawVersion, loose); + }); + } + function released(release) { + return !semver.validRange(release.tag_name, loose) && semver.validRange(release.name, loose) ? new semver.Range(release.name, loose) : new semver.Range(release.tag_name, loose); + } + function oldGlibc(min) { + return __awaiter(this, void 0, void 0, function* () { + const output = yield run(lddCommand, ["--version"]); + const line = output.split("\n", 1)[0]; + const match = line.match(/^ldd .*glibc.* (\d+(?:\.\d+)+)[^ ]*$/i); + if (!match || !semver.validRange(match[1], loose)) { + console.error(`Can't glibc version from ldd --version output: ${line}`); + return null; + } + const version = new semver.Range(match[1], loose); + console.log("glibc is", version.raw, "min is", min.raw); + return rangeGreater(min, version) ? version : null; + }); + } + Version2.oldGlibc = oldGlibc; + function run(command, flags) { + var e_1, _a; + return __awaiter(this, void 0, void 0, function* () { + const child = child_process.spawn(command, flags, {stdio: ["ignore", "pipe", "ignore"]}); + let output = ""; + try { + for (var _b = __asyncValues(child.stdout), _c; _c = yield _b.next(), !_c.done; ) { + const chunk = _c.value; + output += chunk; + } + } catch (e_1_1) { + e_1 = {error: e_1_1}; + } finally { + try { + if (_c && !_c.done && (_a = _b.return)) + yield _a.call(_b); + } finally { + if (e_1) + throw e_1.error; + } + } + return output; + }); + } + function rangeGreater(newVer, oldVer) { + return semver.gtr(semver.minVersion(newVer), oldVer); + } + })(Version || (Version = {})); +}); + +// src/index.ts +__markAsModule(exports); +__export(exports, { + activate: () => activate2 +}); +var import_coc7 = __toModule(require("coc.nvim")); + +// src/cmds.ts +var import_coc = __toModule(require("coc.nvim")); +var import_vscode_languageserver_protocol = __toModule(require_main3()); +var SwitchSourceHeaderRequest; +(function(SwitchSourceHeaderRequest2) { + SwitchSourceHeaderRequest2.type = new import_vscode_languageserver_protocol.RequestType("textDocument/switchSourceHeader"); +})(SwitchSourceHeaderRequest || (SwitchSourceHeaderRequest = {})); +var SymbolInfoRequest; +(function(SymbolInfoRequest2) { + SymbolInfoRequest2.type = new import_vscode_languageserver_protocol.RequestType("textDocument/symbolInfo"); +})(SymbolInfoRequest || (SymbolInfoRequest = {})); +function switchSourceHeader(ctx) { + return async () => { + if (!ctx.client) { + return; + } + const doc = await import_coc.workspace.document; + if (!doc) { + return; + } + const params = { + uri: doc.uri + }; + const dest = await ctx.client.sendRequest(SwitchSourceHeaderRequest.type.method, params); + if (!dest) { + import_coc.window.showMessage(`Didn't find a corresponding file.`); + return; + } + await import_coc.workspace.jumpTo(dest); + }; +} +function symbolInfo(ctx) { + return async () => { + if (!ctx.client) { + return; + } + const doc = await import_coc.workspace.document; + if (!doc) { + return; + } + const position = await import_coc.window.getCursorPosition(); + const params = { + textDocument: {uri: doc.uri}, + position + }; + const details = await ctx.client.sendRequest(SymbolInfoRequest.type.method, params); + if (!details.length) { + return; + } + const detail = details[0]; + import_coc.window.showMessage(`name: ${detail.name}, containerName: ${detail.containerName}, usr: ${detail.usr}`); + }; +} + +// src/ctx.ts +var import_coc4 = __toModule(require("coc.nvim")); + +// src/config.ts +var import_coc2 = __toModule(require("coc.nvim")); +var Config = class { + constructor() { + this.cfg = import_coc2.workspace.getConfiguration("clangd"); + } + get enabled() { + return this.cfg.get("enabled"); + } + get disableDiagnostics() { + return this.cfg.get("disableDiagnostics"); + } + get disableSnippetCompletion() { + return this.cfg.get("disableSnippetCompletion"); + } + get disableCompletion() { + return this.cfg.get("disableCompletion"); + } + get arguments() { + return this.cfg.get("arguments", []); + } + get trace() { + return this.cfg.get("trace", ""); + } + get fallbackFlags() { + return this.cfg.get("fallbackFlags", []); + } + get semanticHighlighting() { + return this.cfg.get("semanticHighlighting"); + } + get showDBChangedNotification() { + return this.cfg.get("showDBChangedNotification"); + } + get compilationDatabasePath() { + return this.cfg.get("compilationDatabasePath"); + } + get serverCompletionRanking() { + return this.cfg.get("serverCompletionRanking"); + } +}; + +// src/semantic-highlighting.ts +var import_coc3 = __toModule(require("coc.nvim")); +var import_vscode_languageserver_protocol2 = __toModule(require_main3()); +var SemanticHighlightingFeature = class { + constructor(client, context) { + this.scopeTable = []; + this.bufTokens = {}; + context.subscriptions.push(client.onDidChangeState(({newState}) => { + if (newState === import_coc3.State.Running) { + const notification = new import_vscode_languageserver_protocol2.NotificationType("textDocument/semanticHighlighting"); + client.onNotification(notification, this.handleNotification.bind(this)); + } + })); + } + dispose() { + } + initialize(capabilities) { + const serverCapabilities = capabilities; + if (!serverCapabilities.semanticHighlighting) + return; + this.scopeTable = serverCapabilities.semanticHighlighting.scopes; + } + fillClientCapabilities(capabilities) { + const textDocumentCapabilities = capabilities.textDocument; + textDocumentCapabilities.semanticHighlightingCapabilities = { + semanticHighlighting: true + }; + } + async handleNotification(params) { + const doc = import_coc3.workspace.getDocument(params.textDocument.uri); + if (!(doc.bufnr in this.bufTokens)) + this.bufTokens[doc.bufnr] = []; + const lines = this.bufTokens[doc.bufnr]; + for (const line of params.lines) { + while (line.line >= lines.length) + lines.push([]); + lines[line.line] = this.decodeTokens(line.tokens); + } + const symbols = []; + const skipped = []; + for (const [line, tokens] of lines.entries()) { + for (const token of tokens) { + if (token.kind === "InactiveCode") { + skipped.push(import_vscode_languageserver_protocol2.Range.create(line, token.character, line, token.character + token.length)); + } else { + symbols.push({ + id: 0, + kind: token.kind, + ranges: [import_vscode_languageserver_protocol2.Range.create(line, token.character, line, token.character + token.length)], + parentKind: "Unknown", + storage: "None" + }); + } + } + } + await import_coc3.workspace.nvim.call("lsp_cxx_hl#hl#notify_symbols", [doc.bufnr, symbols]); + if (skipped.length) { + await import_coc3.workspace.nvim.call("lsp_cxx_hl#hl#notify_skipped", [doc.bufnr, skipped]); + } + } + decodeTokens(tokens) { + const scopeMask = 65535; + const lenShift = 16; + const uint32Size = 4; + const buf = Buffer.from(tokens, "base64"); + const retTokens = []; + for (let i = 0, end = buf.length / uint32Size; i < end; i += 2) { + const start = buf.readUInt32BE(i * uint32Size); + const lenKind = buf.readUInt32BE((i + 1) * uint32Size); + const scopeIndex = lenKind & scopeMask; + const len = lenKind >>> lenShift; + const kind = this.scopeTable[scopeIndex][0]; + retTokens.push({character: start, scopeIndex, length: len, kind: this.decodeKind(kind)}); + } + return retTokens; + } + decodeKind(kind) { + switch (kind) { + case "entity.name.function.cpp": + return "Function"; + case "entity.name.function.method.cpp": + return "Method"; + case "entity.name.function.method.static.cpp": + return "StaticMethod"; + case "variable.other.cpp": + return "Variable"; + case "variable.other.local.cpp": + return "LocalVariable"; + case "variable.parameter.cpp": + return "Parameter"; + case "variable.other.field.cpp": + return "Field"; + case "variable.other.field.static.cpp": + return "StaticField"; + case "entity.name.type.class.cpp": + return "Class"; + case "entity.name.type.enum.cpp": + return "Enum"; + case "variable.other.enummember.cpp": + return "EnumConstant"; + case "entity.name.type.typedef.cpp": + return "Typedef"; + case "entity.name.type.dependent.cpp": + return "DependentType"; + case "entity.name.other.dependent.cpp": + return "DependentName"; + case "entity.name.namespace.cpp": + return "Namespace"; + case "entity.name.type.template.cpp": + return "TemplateParameter"; + case "entity.name.type.concept.cpp": + return "Concept"; + case "storage.type.primitive.cpp": + return "Primitive"; + case "entity.name.function.preprocessor.cpp": + return "Macro"; + case "meta.disabled": + return "InactiveCode"; + default: + return "Unknown"; + } + } +}; + +// src/ctx.ts +var ClangdExtensionFeature = class { + constructor() { + } + dispose() { + } + initialize() { + } + fillClientCapabilities(capabilities) { + const extendedCompletionCapabilities = capabilities.textDocument.completion; + if (extendedCompletionCapabilities) { + extendedCompletionCapabilities.editsNearCursor = true; + } + } +}; +var Ctx = class { + constructor(context) { + this.context = context; + this.client = null; + this.config = new Config(); + } + async startServer(bin, ...features) { + const old = this.client; + if (old) { + await old.stop(); + } + const exec = { + command: bin, + args: this.config.arguments + }; + if (!!this.config.trace) { + exec.options = {env: {CLANGD_TRACE: this.config.trace}}; + } + const serverOptions = exec; + const outputChannel = import_coc4.window.createOutputChannel("clangd"); + const initializationOptions = {clangdFileStatus: true, fallbackFlags: this.config.fallbackFlags}; + if (this.config.compilationDatabasePath) { + initializationOptions.compilationDatabasePath = this.config.compilationDatabasePath; + } + const clientOptions = { + documentSelector: [ + {scheme: "file", language: "c"}, + {scheme: "file", language: "cpp"}, + {scheme: "file", language: "objc"}, + {scheme: "file", language: "objcpp"}, + {scheme: "file", language: "objective-c"}, + {scheme: "file", language: "objective-cpp"}, + {scheme: "file", language: "cuda"}, + {scheme: "file", language: "arduino"} + ], + initializationOptions, + disableDiagnostics: this.config.disableDiagnostics, + disableSnippetCompletion: this.config.disableSnippetCompletion, + disableCompletion: this.config.disableCompletion, + outputChannel, + middleware: { + provideOnTypeFormattingEdits: (document2, position, ch, options, token, next) => { + const line = document2.getText(import_coc4.Range.create(position.line, 0, position.line, position.character)); + if (!line.trim().length) + return; + if (ch === "\n") + ch = ""; + return next(document2, position, ch, options, token); + }, + provideCompletionItem: async (document2, position, context, token, next) => { + const list = await next(document2, position, context, token); + if (!list) + return []; + if (!this.config.serverCompletionRanking) + return list; + const items = (Array.isArray(list) ? list : list.items).map((item) => { + var _a; + const start = (_a = item.textEdit) == null ? void 0 : _a.range.start; + if (start) { + const prefix = document2.getText(import_coc4.Range.create(start, position)); + if (prefix) + item.filterText = prefix + "_" + item.filterText; + } + return item; + }); + return {items, isIncomplete: true}; + }, + provideWorkspaceSymbols: async (query, token, next) => { + const symbols = await next(query, token); + if (!symbols) + return; + return symbols.map((symbol) => { + if (query.includes("::")) { + if (symbol.containerName) { + symbol.name = `${symbol.containerName}::${symbol.name}`; + } + symbol.containerName = ""; + } + return symbol; + }); + } + } + }; + const client = new import_coc4.LanguageClient("clangd", serverOptions, clientOptions); + client.registerFeature(new ClangdExtensionFeature()); + if (this.config.semanticHighlighting) { + const lspCxx = await import_coc4.workspace.nvim.call("exists", "g:lsp_cxx_hl_loaded"); + if (lspCxx === 1) { + client.registerFeature(new SemanticHighlightingFeature(client, this.context)); + } + } + for (const feature of features) + client.registerFeature(feature); + this.context.subscriptions.push(import_coc4.services.registLanguageClient(client)); + await client.onReady(); + this.client = client; + } + get subscriptions() { + return this.context.subscriptions; + } +}; + +// src/file_status.ts +var import_coc5 = __toModule(require("coc.nvim")); +var FileStatus = class { + constructor() { + this.statuses = new Map(); + this.statusBarItem = import_coc5.window.createStatusBarItem(0); + } + onFileUpdated(status) { + this.statuses.set(status.uri, status); + this.updateStatus(); + } + async updateStatus() { + const doc = await import_coc5.workspace.document; + if (!doc) { + return; + } + const status = this.statuses.get(doc.uri); + if (!status || status.state === "idle") { + this.statusBarItem.hide(); + return; + } + this.statusBarItem.text = `clangd: ` + status.state; + this.statusBarItem.show(); + } + clear() { + this.statuses.clear(); + this.statusBarItem.hide(); + } + dispose() { + this.statusBarItem.dispose(); + } +}; + +// node_modules/event-target-shim/dist/event-target-shim.mjs +var privateData = new WeakMap(); +var wrappers = new WeakMap(); +function pd(event) { + const retv = privateData.get(event); + console.assert(retv != null, "'this' is expected an Event object, but got", event); + return retv; +} +function setCancelFlag(data) { + if (data.passiveListener != null) { + if (typeof console !== "undefined" && typeof console.error === "function") { + console.error("Unable to preventDefault inside passive event listener invocation.", data.passiveListener); + } + return; + } + if (!data.event.cancelable) { + return; + } + data.canceled = true; + if (typeof data.event.preventDefault === "function") { + data.event.preventDefault(); + } +} +function Event2(eventTarget, event) { + privateData.set(this, { + eventTarget, + event, + eventPhase: 2, + currentTarget: eventTarget, + canceled: false, + stopped: false, + immediateStopped: false, + passiveListener: null, + timeStamp: event.timeStamp || Date.now() + }); + Object.defineProperty(this, "isTrusted", {value: false, enumerable: true}); + const keys = Object.keys(event); + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + if (!(key in this)) { + Object.defineProperty(this, key, defineRedirectDescriptor(key)); + } + } +} +Event2.prototype = { + get type() { + return pd(this).event.type; + }, + get target() { + return pd(this).eventTarget; + }, + get currentTarget() { + return pd(this).currentTarget; + }, + composedPath() { + const currentTarget = pd(this).currentTarget; + if (currentTarget == null) { + return []; + } + return [currentTarget]; + }, + get NONE() { + return 0; + }, + get CAPTURING_PHASE() { + return 1; + }, + get AT_TARGET() { + return 2; + }, + get BUBBLING_PHASE() { + return 3; + }, + get eventPhase() { + return pd(this).eventPhase; + }, + stopPropagation() { + const data = pd(this); + data.stopped = true; + if (typeof data.event.stopPropagation === "function") { + data.event.stopPropagation(); + } + }, + stopImmediatePropagation() { + const data = pd(this); + data.stopped = true; + data.immediateStopped = true; + if (typeof data.event.stopImmediatePropagation === "function") { + data.event.stopImmediatePropagation(); + } + }, + get bubbles() { + return Boolean(pd(this).event.bubbles); + }, + get cancelable() { + return Boolean(pd(this).event.cancelable); + }, + preventDefault() { + setCancelFlag(pd(this)); + }, + get defaultPrevented() { + return pd(this).canceled; + }, + get composed() { + return Boolean(pd(this).event.composed); + }, + get timeStamp() { + return pd(this).timeStamp; + }, + get srcElement() { + return pd(this).eventTarget; + }, + get cancelBubble() { + return pd(this).stopped; + }, + set cancelBubble(value) { + if (!value) { + return; + } + const data = pd(this); + data.stopped = true; + if (typeof data.event.cancelBubble === "boolean") { + data.event.cancelBubble = true; + } + }, + get returnValue() { + return !pd(this).canceled; + }, + set returnValue(value) { + if (!value) { + setCancelFlag(pd(this)); + } + }, + initEvent() { + } +}; +Object.defineProperty(Event2.prototype, "constructor", { + value: Event2, + configurable: true, + writable: true +}); +if (typeof window !== "undefined" && typeof window.Event !== "undefined") { + Object.setPrototypeOf(Event2.prototype, window.Event.prototype); + wrappers.set(window.Event.prototype, Event2); +} +function defineRedirectDescriptor(key) { + return { + get() { + return pd(this).event[key]; + }, + set(value) { + pd(this).event[key] = value; + }, + configurable: true, + enumerable: true + }; +} +function defineCallDescriptor(key) { + return { + value() { + const event = pd(this).event; + return event[key].apply(event, arguments); + }, + configurable: true, + enumerable: true + }; +} +function defineWrapper(BaseEvent, proto) { + const keys = Object.keys(proto); + if (keys.length === 0) { + return BaseEvent; + } + function CustomEvent2(eventTarget, event) { + BaseEvent.call(this, eventTarget, event); + } + CustomEvent2.prototype = Object.create(BaseEvent.prototype, { + constructor: {value: CustomEvent2, configurable: true, writable: true} + }); + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + if (!(key in BaseEvent.prototype)) { + const descriptor = Object.getOwnPropertyDescriptor(proto, key); + const isFunc = typeof descriptor.value === "function"; + Object.defineProperty(CustomEvent2.prototype, key, isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key)); + } + } + return CustomEvent2; +} +function getWrapper(proto) { + if (proto == null || proto === Object.prototype) { + return Event2; + } + let wrapper = wrappers.get(proto); + if (wrapper == null) { + wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto); + wrappers.set(proto, wrapper); + } + return wrapper; +} +function wrapEvent(eventTarget, event) { + const Wrapper = getWrapper(Object.getPrototypeOf(event)); + return new Wrapper(eventTarget, event); +} +function isStopped(event) { + return pd(event).immediateStopped; +} +function setEventPhase(event, eventPhase) { + pd(event).eventPhase = eventPhase; +} +function setCurrentTarget(event, currentTarget) { + pd(event).currentTarget = currentTarget; +} +function setPassiveListener(event, passiveListener) { + pd(event).passiveListener = passiveListener; +} +var listenersMap = new WeakMap(); +var CAPTURE = 1; +var BUBBLE = 2; +var ATTRIBUTE = 3; +function isObject2(x) { + return x !== null && typeof x === "object"; +} +function getListeners(eventTarget) { + const listeners = listenersMap.get(eventTarget); + if (listeners == null) { + throw new TypeError("'this' is expected an EventTarget object, but got another value."); + } + return listeners; +} +function defineEventAttributeDescriptor(eventName) { + return { + get() { + const listeners = getListeners(this); + let node = listeners.get(eventName); + while (node != null) { + if (node.listenerType === ATTRIBUTE) { + return node.listener; + } + node = node.next; + } + return null; + }, + set(listener) { + if (typeof listener !== "function" && !isObject2(listener)) { + listener = null; + } + const listeners = getListeners(this); + let prev = null; + let node = listeners.get(eventName); + while (node != null) { + if (node.listenerType === ATTRIBUTE) { + if (prev !== null) { + prev.next = node.next; + } else if (node.next !== null) { + listeners.set(eventName, node.next); + } else { + listeners.delete(eventName); + } + } else { + prev = node; + } + node = node.next; + } + if (listener !== null) { + const newNode = { + listener, + listenerType: ATTRIBUTE, + passive: false, + once: false, + next: null + }; + if (prev === null) { + listeners.set(eventName, newNode); + } else { + prev.next = newNode; + } + } + }, + configurable: true, + enumerable: true + }; +} +function defineEventAttribute(eventTargetPrototype, eventName) { + Object.defineProperty(eventTargetPrototype, `on${eventName}`, defineEventAttributeDescriptor(eventName)); +} +function defineCustomEventTarget(eventNames) { + function CustomEventTarget() { + EventTarget.call(this); + } + CustomEventTarget.prototype = Object.create(EventTarget.prototype, { + constructor: { + value: CustomEventTarget, + configurable: true, + writable: true + } + }); + for (let i = 0; i < eventNames.length; ++i) { + defineEventAttribute(CustomEventTarget.prototype, eventNames[i]); + } + return CustomEventTarget; +} +function EventTarget() { + if (this instanceof EventTarget) { + listenersMap.set(this, new Map()); + return; + } + if (arguments.length === 1 && Array.isArray(arguments[0])) { + return defineCustomEventTarget(arguments[0]); + } + if (arguments.length > 0) { + const types = new Array(arguments.length); + for (let i = 0; i < arguments.length; ++i) { + types[i] = arguments[i]; + } + return defineCustomEventTarget(types); + } + throw new TypeError("Cannot call a class as a function"); +} +EventTarget.prototype = { + addEventListener(eventName, listener, options) { + if (listener == null) { + return; + } + if (typeof listener !== "function" && !isObject2(listener)) { + throw new TypeError("'listener' should be a function or an object."); + } + const listeners = getListeners(this); + const optionsIsObj = isObject2(options); + const capture = optionsIsObj ? Boolean(options.capture) : Boolean(options); + const listenerType = capture ? CAPTURE : BUBBLE; + const newNode = { + listener, + listenerType, + passive: optionsIsObj && Boolean(options.passive), + once: optionsIsObj && Boolean(options.once), + next: null + }; + let node = listeners.get(eventName); + if (node === void 0) { + listeners.set(eventName, newNode); + return; + } + let prev = null; + while (node != null) { + if (node.listener === listener && node.listenerType === listenerType) { + return; + } + prev = node; + node = node.next; + } + prev.next = newNode; + }, + removeEventListener(eventName, listener, options) { + if (listener == null) { + return; + } + const listeners = getListeners(this); + const capture = isObject2(options) ? Boolean(options.capture) : Boolean(options); + const listenerType = capture ? CAPTURE : BUBBLE; + let prev = null; + let node = listeners.get(eventName); + while (node != null) { + if (node.listener === listener && node.listenerType === listenerType) { + if (prev !== null) { + prev.next = node.next; + } else if (node.next !== null) { + listeners.set(eventName, node.next); + } else { + listeners.delete(eventName); + } + return; + } + prev = node; + node = node.next; + } + }, + dispatchEvent(event) { + if (event == null || typeof event.type !== "string") { + throw new TypeError('"event.type" should be a string.'); + } + const listeners = getListeners(this); + const eventName = event.type; + let node = listeners.get(eventName); + if (node == null) { + return true; + } + const wrappedEvent = wrapEvent(this, event); + let prev = null; + while (node != null) { + if (node.once) { + if (prev !== null) { + prev.next = node.next; + } else if (node.next !== null) { + listeners.set(eventName, node.next); + } else { + listeners.delete(eventName); + } + } else { + prev = node; + } + setPassiveListener(wrappedEvent, node.passive ? node.listener : null); + if (typeof node.listener === "function") { + try { + node.listener.call(this, wrappedEvent); + } catch (err) { + if (typeof console !== "undefined" && typeof console.error === "function") { + console.error(err); + } + } + } else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") { + node.listener.handleEvent(wrappedEvent); + } + if (isStopped(wrappedEvent)) { + break; + } + node = node.next; + } + setPassiveListener(wrappedEvent, null); + setEventPhase(wrappedEvent, 0); + setCurrentTarget(wrappedEvent, null); + return !wrappedEvent.defaultPrevented; + } +}; +Object.defineProperty(EventTarget.prototype, "constructor", { + value: EventTarget, + configurable: true, + writable: true +}); +if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") { + Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype); +} + +// src/install.ts +var common = __toModule(require_src()); +var coc = __toModule(require("coc.nvim")); +var UI = class { + constructor(context, config) { + this.context = context; + this.config = config; + } + get storagePath() { + return this.context.storagePath; + } + slow(title, result) { + coc.window.showMessage(title + "..."); + return result; + } + error(s) { + coc.window.showMessage(s, "error"); + } + info(s) { + coc.window.showMessage(s); + } + progress(title, _cancel, body) { + return this.slow(title, body(() => { + })); + } + async shouldReuse(release) { + coc.window.showMessage(`Reusing existing ${release} installation in ${this.storagePath}`); + return true; + } + async promptReload() { + await coc.commands.executeCommand("editor.action.restart"); + } + showHelp(message, url) { + message += ` See ${url}.`; + coc.window.showMessage(message); + } + async promptUpdate(oldVersion, newVersion) { + const message = `clangd ${newVersion} is available (you have ${oldVersion}). :CocCommand clangd.install, or :CocSettings to disable clangd.checkUpdates.`; + coc.window.showMessage(message); + } + async promptInstall(version) { + const message = `clangd was not found on your PATH. :CocCommand clangd.install will install ${version}.`; + coc.window.showMessage(message); + } + get clangdPath() { + return this.config.get("path"); + } + set clangdPath(p) { + this.config.update("path", p, true); + } +}; +async function activate(context) { + const cfg = coc.workspace.getConfiguration("clangd"); + const ui = new UI(context, cfg); + context.subscriptions.push(coc.commands.registerCommand("clangd.install", async () => common.installLatest(ui))); + context.subscriptions.push(coc.commands.registerCommand("clangd.update", async () => common.checkUpdates(true, ui))); + const status = await common.prepare(ui, cfg.get("checkUpdates", false)); + return status.clangdPath; +} + +// src/reload.ts +var import_coc6 = __toModule(require("coc.nvim")); +var import_path = __toModule(require("path")); +var ReloadFeature = class { + constructor(ctx, activate3) { + this.ctx = ctx; + this.activate = activate3; + } + dispose() { + } + initialize(caps) { + var _a; + if ((_a = caps.compilationDatabase) == null ? void 0 : _a.automaticReload) { + return; + } + const fileWatcher = import_coc6.workspace.createFileSystemWatcher("**/{compile_commands.json,compile_flags.txt}"); + this.ctx.subscriptions.push(fileWatcher, fileWatcher.onDidChange((e) => this.reload(e.fsPath)), fileWatcher.onDidCreate((e) => this.reload(e.fsPath))); + } + fillClientCapabilities() { + } + async reload(url) { + const notification = this.ctx.config.showDBChangedNotification; + if (notification) { + const msg = `${import_path.basename(url)} has changed, clangd is reloading...`; + import_coc6.window.showMessage(msg); + } + for (const sub of this.ctx.subscriptions) { + try { + sub.dispose(); + } catch (e) { + console.error(e); + } + } + this.activate(); + if (notification) + import_coc6.window.showMessage(`clangd has reloaded`); + } +}; + +// src/index.ts +async function activate2(context) { + var _a; + const ctx = new Ctx(context); + if (!ctx.config.enabled) { + return; + } + const service = import_coc7.services.getService("clangd"); + if (service) { + import_coc7.window.showMessage(`Looks like you've configured clangd in coc-settings.json, you should remove it to use coc-clangd`, "warning"); + return; + } + const clangdPath = await activate(context); + if (!clangdPath) { + return; + } + try { + await ctx.startServer(clangdPath, new ReloadFeature(ctx, () => activate2(context))); + } catch (e) { + return; + } + const fileStatus = new FileStatus(); + context.subscriptions.push(fileStatus, import_coc7.commands.registerCommand("clangd.switchSourceHeader", switchSourceHeader(ctx)), import_coc7.commands.registerCommand("clangd.symbolInfo", symbolInfo(ctx)), ctx.client.onDidChangeState((e) => { + var _a2; + if (e.newState === import_coc7.State.Running) { + (_a2 = ctx.client) == null ? void 0 : _a2.onNotification("textDocument/clangd.fileStatus", (status) => { + fileStatus.onFileUpdated(status); + }); + } else if (e.newState === import_coc7.State.Stopped) { + fileStatus.clear(); + } + }), import_coc7.workspace.onDidOpenTextDocument(() => { + fileStatus.updateStatus(); + })); + (_a = ctx.client) == null ? void 0 : _a.onNotification("textDocument/clangd.fileStatus", (status) => { + fileStatus.onFileUpdated(status); + }); +} diff --git a/coc/extensions/node_modules/coc-clangd/package.json b/coc/extensions/node_modules/coc-clangd/package.json new file mode 100644 index 0000000..8440b81 --- /dev/null +++ b/coc/extensions/node_modules/coc-clangd/package.json @@ -0,0 +1,166 @@ +{ + "name": "coc-clangd", + "version": "0.9.0", + "description": "clangd extension for coc.nvim", + "author": "Heyward Fann ", + "license": "Apache-2.0 WITH LLVM-exception", + "main": "lib/index.js", + "keywords": [ + "coc.nvim" + ], + "engines": { + "coc": "^0.0.80" + }, + "repository": { + "type": "git", + "url": "https://github.com/clangd/coc-clangd.git" + }, + "scripts": { + "clean": "rimraf lib", + "build": "node esbuild.js", + "lint": "eslint src --ext ts", + "prepare": "node esbuild.js" + }, + "devDependencies": { + "@clangd/install": "^0.1.3", + "@types/node": "10.12.0", + "@types/which": "^2.0.0", + "@typescript-eslint/eslint-plugin": "^4.5.0", + "@typescript-eslint/parser": "^4.5.0", + "coc.nvim": "^0.0.81-next.2", + "esbuild": "^0.8.42", + "eslint": "^7.11.0", + "eslint-config-prettier": "^7.0.0", + "eslint-plugin-prettier": "^3.1.4", + "prettier": "^2.1.2", + "rimraf": "^3.0.1", + "typescript": "^4.0.3", + "vscode-languageserver-protocol": "^3.15.3" + }, + "activationEvents": [ + "onLanguage:c", + "onLanguage:cpp", + "onLanguage:cuda", + "onLanguage:objc", + "onLanguage:objcpp", + "onLanguage:arduino", + "onLanguage:objective-c", + "onLanguage:objective-cpp", + "workspaceContains:**/compile_commands.json", + "workspaceContains:**/compile_flags.txt" + ], + "rootPatterns": [ + { + "patterns": [ + "compile_commands.json", + "compile_flags.txt" + ] + } + ], + "contributes": { + "configuration": { + "type": "object", + "title": "coc-clangd configuration", + "properties": { + "clangd.enabled": { + "type": "boolean", + "default": true, + "description": "Enable coc-clangd extension" + }, + "clangd.disableDiagnostics": { + "type": "boolean", + "default": false, + "description": "Disable diagnostics from clangd" + }, + "clangd.disableCompletion": { + "type": "boolean", + "default": false, + "description": "Disable completion source from clangd" + }, + "clangd.disableSnippetCompletion": { + "type": "boolean", + "default": false, + "description": "Disable completion snippet from clangd" + }, + "clangd.compilationDatabasePath": { + "type": "string", + "default": "", + "description": "Specifies the directory containing the compilation database" + }, + "clangd.path": { + "type": "string", + "default": "clangd", + "description": "The path to clangd executable, e.g.: /usr/bin/clangd" + }, + "clangd.arguments": { + "type": "array", + "default": [], + "items": { + "type": "string" + }, + "description": "Arguments for clangd server" + }, + "clangd.trace": { + "type": "string", + "description": "Names a file that clangd should log a performance trace to, in chrome trace-viewer JSON format." + }, + "clangd.fallbackFlags": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "description": "Extra clang flags used to parse files when no compilation database is found." + }, + "clangd.semanticHighlighting": { + "type": "boolean", + "default": false, + "description": "Enable semantic highlighting in clangd, requires jackguo380/vim-lsp-cxx-highlight to work" + }, + "clangd.showDBChangedNotification": { + "type": "boolean", + "default": true, + "description": "Show notifications while DB files changed" + }, + "clangd.serverCompletionRanking": { + "type": "boolean", + "default": true, + "description": "Always rank completion items on the server as you type. This produces more accurate results at the cost of higher latency than client-side filtering." + }, + "clangd.checkUpdates": { + "type": "boolean", + "default": false, + "description": "Check for clangd language server updates on startup." + }, + "suggest.detailMaxLength": { + "type": "number", + "description": "Max length of detail that should be shown in popup menu.", + "default": 50 + }, + "diagnostic.format": { + "type": "string", + "description": "Define the diagnostic format. Available parts: source, code, severity, message", + "default": "%message\n[%source:%code]" + } + } + }, + "commands": [ + { + "command": "clangd.switchSourceHeader", + "title": "Switch between source/header" + }, + { + "command": "clangd.symbolInfo", + "title": "Resolve symbol info under the cursor" + }, + { + "command": "clangd.install", + "title": "Install latest clangd language server binary release" + }, + { + "command": "clangd.update", + "title": "Check for updates to clangd language server" + } + ] + } +} diff --git a/coc/extensions/node_modules/coc-go/.editorconfig b/coc/extensions/node_modules/coc-go/.editorconfig new file mode 100644 index 0000000..38b2b1b --- /dev/null +++ b/coc/extensions/node_modules/coc-go/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +indent_size = 4 diff --git a/coc/extensions/node_modules/coc-go/.eslintignore b/coc/extensions/node_modules/coc-go/.eslintignore new file mode 100644 index 0000000..75ba1f5 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/.eslintignore @@ -0,0 +1,2 @@ +/lib +node_modules diff --git a/coc/extensions/node_modules/coc-go/.eslintrc b/coc/extensions/node_modules/coc-go/.eslintrc new file mode 100644 index 0000000..b6dd4f6 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/.eslintrc @@ -0,0 +1,17 @@ +{ + "root": true, + "extends": ["josa-typescript"], + "env": { + "mocha": true + }, + "rules": { + "no-extra-semi": "error", + "sort-imports": [ + "error", + { + "ignoreCase": false, + "ignoreDeclarationSort": true + } + ] + } +} diff --git a/coc/extensions/node_modules/coc-go/.github/workflows/main.yml b/coc/extensions/node_modules/coc-go/.github/workflows/main.yml new file mode 100644 index 0000000..34f5df4 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/.github/workflows/main.yml @@ -0,0 +1,19 @@ +name: Main + +on: push + +jobs: + main: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + node: [10, 12] # 14 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: { node-version: "${{ matrix.node }}" } + - run: yarn --frozen-lockfile + - run: yarn build + - run: yarn lint + - run: yarn test diff --git a/coc/extensions/node_modules/coc-go/.github/workflows/update-settings.yml b/coc/extensions/node_modules/coc-go/.github/workflows/update-settings.yml new file mode 100644 index 0000000..e2794ab --- /dev/null +++ b/coc/extensions/node_modules/coc-go/.github/workflows/update-settings.yml @@ -0,0 +1,32 @@ +name: update-settings + +on: + push: + schedule: + - cron: '0 * * * *' + +jobs: + main: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: { node-version: '12' } + - run: ./scripts/update-commands.js + - run: ./scripts/update-options.js + - run: ./scripts/update-options-interface.js + - run: ./scripts/update-snippets.js + - run: ./scripts/update-tables.sh + - run: git diff + - run: yarn --frozen-lockfile + - run: yarn build + - run: yarn lint + - run: yarn test + - uses: EndBug/add-and-commit@v5 + with: + push: true + author_name: Github Action + author_email: josa@gesell.me + message: '[auto] Update Settings' + env: + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' diff --git a/coc/extensions/node_modules/coc-go/.vim/coc-settings.json b/coc/extensions/node_modules/coc-go/.vim/coc-settings.json new file mode 100644 index 0000000..cf57209 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/.vim/coc-settings.json @@ -0,0 +1,11 @@ +{ + "coc.preferences.formatOnSaveFiletypes": ["javascript", "typescript", "json"], + + "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, + "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, + "javascript.format.semicolons": "remove", + + "eslint.autoFix": true, + "eslint.autoFixOnSave": true, + "prettier.disableLanguages": ["typescript"] +} diff --git a/coc/extensions/node_modules/coc-go/LICENSE b/coc/extensions/node_modules/coc-go/LICENSE new file mode 100644 index 0000000..cd365bf --- /dev/null +++ b/coc/extensions/node_modules/coc-go/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Josa Gesell + +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/coc/extensions/node_modules/coc-go/README.md b/coc/extensions/node_modules/coc-go/README.md new file mode 100644 index 0000000..cffc3d5 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/README.md @@ -0,0 +1,185 @@ +# coc-go + +Go language server extension using [`gopls`](https://github.com/golang/go/wiki/gopls) +for [`coc.nvim`](https://github.com/neoclide/coc.nvim). + +## Install + +In your vim/neovim, run this command: + +``` +:CocInstall coc-go +``` + +## Features + +See [`gopls`](https://github.com/golang/tools/blob/master/gopls/README.md) + +## Commands + +Additional to commands provided by gopls, this extensions provides these commands: + +| Key | Description | +|---------------------------------|----------------------------------------------------| +| **`go.impl.cursor`** | Generate interface stubs | +| **`go.install.gomodifytags`** | Install / update gomodifytags | +| **`go.install.goplay`** | Install / update goplay | +| **`go.install.gopls`** | Install / update gopls | +| **`go.install.gotests`** | Install / update gotests | +| **`go.install.impl`** | Install / update impl | +| **`go.install.tools`** | Install / update all tools | +| **`go.playground`** | Run on go playground | +| **`go.tags.add`** | Add tags to struct fields | +| **`go.tags.add.line`** | Add tags to struct field in current line | +| **`go.tags.add.prompt`** | Add tags to struct fields (prompt) | +| **`go.tags.clear`** | Remove all tags from struct fields | +| **`go.tags.clear.line`** | Remove all tags from struct fields in current line | +| **`go.tags.remove`** | Remove tags from struct fields | +| **`go.tags.remove.line`** | Remove tags from struct field in current line | +| **`go.tags.remove.prompt`** | Remove tags from struct fields (prompt) | +| **`go.test.generate.exported`** | Generate unit tests for exported functions in file | +| **`go.test.generate.file`** | Generate unit tests for file | +| **`go.test.generate.function`** | Generate unit tests for current function | +| **`go.test.toggle`** | Toggle test file | +| **`go.version`** | Print extension version | + +### Examples + +- **Add or Remove specific tags** + + ``` + CocCommand go.tags.add yaml + CocCommand go.tags.add yaml json xml + CocCommand go.tags.remove xml + ``` + +- **Add missing imports on save** + + ```viml + autocmd BufWritePre *.go :silent call CocAction('runCommand', 'editor.action.organizeImport') + ``` + +- **Map Keys to command** + + ```viml + autocmd FileType go nmap gtj :CocCommand go.tags.add json + autocmd FileType go nmap gty :CocCommand go.tags.add yaml + autocmd FileType go nmap gtx :CocCommand go.tags.clear + ``` + +## Snippets + +Snippets are imported from [`microsoft/vscode-go`](https://github.com/microsoft/vscode-go) +and require [`coc-snippets`](https://github.com/neoclide/coc-snippets) to be +installed. + +## Configuration options + +| Key | Description | Default | +|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------| +| **`go.checkForUpdates`** | **EXPERIMENTAL** Check for gopls updates on start. | disabled | +| **`go.disable`** | Disable gopls features | {} | +| ‣ `completion` | Disable completion feature (Change requires `:CocRestart`) | false | +| ‣ `diagnostics` | Disable handle diagnostics (Change requires `:CocRestart`) | false | +| ‣ `workspaceFolders` | Disable workspaceFolders feature (Change requires `:CocRestart`) | false | +| **`go.enable`** | Enable Go extension | true | +| **`go.goplsArgs`** | Arguments passed to `gopls` (Change requires `:CocRestart`) | | +| **`go.goplsEnv`** | ENV passed to `gopls` (Change requires `:CocRestart`) | | +| **`go.goplsOptions`** | See [`gopls` documentation](https://github.com/golang/tools/blob/master/gopls/doc/settings.md ) | | +| ‣ `allowImplicitNetworkAccess` | **This setting is experimental and may be deleted.** allowImplicitNetworkAccess disables GOPROXY=off, allowing implicit module downloads rather than requiring user action. | false | +| ‣ `allowModfileModifications` | **This setting is experimental and may be deleted.** allowModfileModifications disables -mod=readonly, allowing imports from out-of-scope modules. | false | +| ‣ `analyses` | analyses specify analyses that the user would like to enable or disable. | | +| ‣ `annotations` | **This setting is experimental and may be deleted.** annotations specifies the various kinds of optimization diagnostics that should be reported by the gc_details command. | | +| ‣ `buildFlags` | buildFlags is the set of flags passed on to the build system when invoked. | | +| ‣ `codelenses` | codelenses overrides the enabled/disabled state of code lenses. | | +| ‣ `completionBudget` | **This setting is for debugging purposes only.** completionBudget is the soft latency goal for completion requests. | 100ms | +| ‣ `directoryFilters` | directoryFilters can be used to exclude unwanted directories from the workspace. | | +| ‣ `env` | env adds environment variables to external commands run by `gopls`, most notably `go list`. | | +| ‣ `expandWorkspaceToModule` | **This setting is experimental and may be deleted.** expandWorkspaceToModule instructs `gopls` to adjust the scope of the workspace to find the best available module root. | true | +| ‣ `experimentalDiagnosticsDelay` | **This setting is experimental and may be deleted.** experimentalDiagnosticsDelay controls the amount of time that gopls waits after the most recent file modification before computing deep diagnostics. | 250ms | +| ‣ `experimentalPackageCacheKey` | **This setting is experimental and may be deleted.** experimentalPackageCacheKey controls whether to use a coarser cache key for package type information to increase cache hits. | true | +| ‣ `experimentalWorkspaceModule` | **This setting is experimental and may be deleted.** experimentalWorkspaceModule opts a user into the experimental support for multi-module workspaces. | false | +| ‣ `gofumpt` | gofumpt indicates if we should run gofumpt formatting. | false | +| ‣ `hoverKind` | hoverKind controls the information that appears in the hover text. | FullDocumentation | +| ‣ `importShortcut` | importShortcut specifies whether import statements should link to documentation or go to definitions. | Both | +| ‣ `linkTarget` | linkTarget controls where documentation links go. | pkg.go.dev | +| ‣ `linksInHover` | linksInHover toggles the presence of links to documentation in hover. | true | +| ‣ `local` | local is the equivalent of the `goimports -local` flag, which puts imports beginning with this string after third-party packages. | | +| ‣ `matcher` | **This is an advanced setting and should not be configured by most `gopls` users.** matcher sets the algorithm that is used when calculating completion candidates. | Fuzzy | +| ‣ `semanticTokens` | **This setting is experimental and may be deleted.** semanticTokens controls whether the LSP server will send semantic tokens to the client. | false | +| ‣ `staticcheck` | **This setting is experimental and may be deleted.** staticcheck enables additional analyses from staticcheck.io. | false | +| ‣ `symbolMatcher` | **This is an advanced setting and should not be configured by most `gopls` users.** symbolMatcher sets the algorithm that is used when finding workspace symbols. | Fuzzy | +| ‣ `symbolStyle` | **This is an advanced setting and should not be configured by most `gopls` users.** symbolStyle controls how symbols are qualified in symbol responses. | Dynamic | +| ‣ `usePlaceholders` | placeholders enables placeholders for function parameters or struct fields in completion responses. | false | +| ‣ `verboseOutput` | **This setting is for debugging purposes only.** verboseOutput enables additional debug logging. | false | +| **`go.goplsPath`** | Path to `gopls` bin (Change requires `:CocRestart`) | | +| **`go.goplsUseDaemon`** | Run gopls as daemon | true | +| **`go.tags`** | | | +| ‣ `options` | Comma separated tag=options pairs to be used by `go.tags.add` command | json=omitempty | +| ‣ `skipUnexported` | If true, skip unexported fields | false | +| ‣ `tags` | Comma separated tags to be used by `go.tags.add` command | json | +| ‣ `transform` | Transformation rule used by `go.tags.add` command to add tags | snakecase | +| **`go.tests`** | | | +| ‣ `generateFlags` | Additional command line flags to pass to `gotests` for generating tests. | [] | +| **`go.trace.server`** | Trace level of gopls | off | + +Trigger completion in `coc-settings.json` to get complete list. + +### Example Configuration + +```json +{ + "go.goplsOptions": { + "completeUnimported": true + } +} +``` + +## Development + +1. Run `yarn build` or `yarn build:watch` +2. Link extension: `yarn run link` / `yarn run unlink` + +## Tools + +- [`gomodifytags`](http://github.com/fatih/gomodifytags) - [BSD](https://github.com/fatih/gomodifytags/blob/master/LICENSE) +- [`goplay`](http://github.com/haya14busa/goplay) - [MIT](https://github.com/haya14busa/goplay/blob/master/LICENSE) +- [`gopls`](https://golang.org/x/tools/cmd/gopls) +- [`gotests`](http://github.com/cweill/gotests) - [Apache](https://github.com/cweill/gotests/blob/develop/LICENSE) +- [`impl`](https://github.com/josharian/impl) - [MIT](https://github.com/josharian/impl/blob/master/LICENSE.txt) + +## FAQ + +### How does `coc-go` compare to `vim-go`? + +With `coc-go` I do not aim to recreate the features of `vim-go`. For now, the +main goal is to provide a convenient way to install `gopls` and use it with +`coc.nvim`. + +If you need more than the features provided by `gopls`, you are probably better +of with [`vim-go`](https://github.com/fatih/vim-go) or +[`govim`](https://github.com/govim/govim). + +### How to use `coc-go` with wasm? + +Add this to you (local) `coc-settings.json` (run `:CocLocalConfig`). + +```json +{ + "go.goplsEnv": { + "GOOS": "js", + "GOARCH": "wasm", + } +} +``` + +### Running `gopls` as a daemon + +`coc-go` runs `gopls` as shared daemon by passing `-remote=auto` to `gopls`. To +disable this behavior set `go.goplsUseDaemon` to `false`. + +See [Running gopls as a daemon](https://github.com/golang/tools/blob/master/gopls/doc/daemon.md) for more information. + +## License + +[MIT © Josa Gesell](LICENSE). diff --git a/coc/extensions/node_modules/coc-go/debug/Dockerfile b/coc/extensions/node_modules/coc-go/debug/Dockerfile new file mode 100644 index 0000000..af61947 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/debug/Dockerfile @@ -0,0 +1,20 @@ +FROM alpine + +RUN apk add --no-cache \ + bash \ + neovim \ + curl \ + nodejs \ + yarn \ + go +RUN \ + mkdir -p ~/.local/share/nvim/site/pack/coc/start \ + && cd ~/.local/share/nvim/site/pack/coc/start \ + && curl -sS --fail -L https://github.com/neoclide/coc.nvim/archive/release.tar.gz|tar xzfv - + +RUN nvim -c 'CocInstall -sync coc-go |q' +qall + +RUN mkdir -p /root/.config/nvim/undo +ADD init.vim /root/.config/nvim/init.vim + +WORKDIR /workdir diff --git a/coc/extensions/node_modules/coc-go/debug/init.vim b/coc/extensions/node_modules/coc-go/debug/init.vim new file mode 100644 index 0000000..be72a6b --- /dev/null +++ b/coc/extensions/node_modules/coc-go/debug/init.vim @@ -0,0 +1,196 @@ +set number " Show: Line numbers +set cursorline " Hilight current curser line +set noshowmode " Hide: -- INSERT -- +set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,space:·,trail:· +set list " Show white space +set tabstop=2 +set shiftwidth=2 +set expandtab +set nowrap +set colorcolumn=80,120 +set mouse=a +" set clipboard+=unnamedplus +set nobackup +set noswapfile +set undodir=~/.config/nvim/undo +set undofile +set conceallevel=0 +autocmd BufEnter * if &filetype != 'nerdtree' && &filetype != 'help' | set conceallevel=0 | endif +set cmdheight=1 +set shortmess+=c +set signcolumn=yes +set updatetime=300 +set hidden +set spell spelllang=en_us,de_de +set splitbelow +set splitright +highlight clear CocHighlightText +highlight CocHighlightText cterm=underline gui=underline +set hlsearch " Highlight search results. +set ignorecase " Make searching case insensitive +set smartcase " ... unless the query has capital letters. +set incsearch " Incremental search. +set gdefault " Use 'g' flag by default with :s/foo/bar/. +set magic " Use 'magic' patterns (extended regular expressions). +set nofoldenable " Never fold (by defauld, override for sim languages) +set inccommand=split + +exec 'set wildignore=' . join([ + \ '.sass-cache', + \ '\.DS_Store', + \ '\.git$', + \ '\~$', + \ '\.swp$', + \ 'gin-bin', + \ '*/node_modules/*', + \ ], ',') + +set noautochdir +set signcolumn=yes +set autoread + +let &scrolloff = 4 +if exists('##CompleteChanged') && exists('*nvim_open_win') + set pumblend=10 + set wildoptions=pum +endif + + +let mapleader="," +let maplocalleader = "-" +" +" select tabs +nnoremap :tabnext +nnoremap :tabprevious + +" move tabs +nnoremap m :tabm +1 +nnoremap m :tabm -1 +" open and close tabs +" nnoremap :tabnew +nnoremap :quit + +nnoremap :split term://zshi + + + + +" Use tab for trigger completion with characters ahead and navigate. +" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by +" other plugin before putting this into your config. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion. +inoremap coc#refresh() + +" Use to confirm completion, `u` means break undo chain at current +" position. Coc only does snippet and additional edit on confirm. +" could be remapped by other vim plugin, try `:verbose imap `. +if exists('*complete_info') + inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" +else + inoremap pumvisible() ? "\" : "\u\" +endif + +" Use `[g` and `]g` to navigate diagnostics +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" GoTo code navigation. +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K to show documentation in preview window. +nnoremap K :call show_documentation() + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + else + call CocAction('doHover') + endif +endfunction + +" Highlight the symbol and its references when holding the cursor. +autocmd CursorHold * silent call CocActionAsync('highlight') + + +augroup mygroup + autocmd! + " Setup formatexpr specified filetype(s). + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " Update signature help on jump placeholder. + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +" Applying codeAction to the selected region. +" Example: `aap` for current paragraph +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap keys for applying codeAction to the current line. +nmap ac (coc-codeaction-line) +" Apply AutoFix to problem on the current line. +nmap qf (coc-fix-current) + +" Introduce function text object +" NOTE: Requires 'textDocument.documentSymbol' support from the language server. +xmap if (coc-funcobj-i) +xmap af (coc-funcobj-a) +omap if (coc-funcobj-i) +omap af (coc-funcobj-a) + +" Use for selections ranges. +" NOTE: Requires 'textDocument/selectionRange' support from the language server. +" coc-tsserver, coc-python are the examples of servers that support it. +" nmap (coc-range-select) +xmap (coc-range-select) + +" Add `:Format` command to format current buffer. +command! -nargs=0 Format :call CocAction('format') + +" Add `:Fold` command to fold current buffer. +command! -nargs=? Fold :call CocAction('fold', ) + +" Add `:OR` command for organize imports of the current buffer. +command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') + +" Mappings using CoCList: +" Symbol renaming. +nmap rn (coc-rename) + +" Formatting selected code. +xmap f (coc-format-selected) +nmap f (coc-format-selected) + +nnoremap d :CocFzfList diagnostics --current-buf +nnoremap c :CocFzfList commands +nnoremap o :CocFzfList outline +nnoremap s :CocFzfList symbols + + + +" nnoremap j :CocNext +" nnoremap k :CocPrev + + +autocmd BufWritePre *.go :call CocAction('organizeImport') + +autocmd FileType go nmap gta :call CocAction('runCommand', 'go.tags.add') +autocmd FileType go nmap gtl :call CocAction('runCommand', 'go.tags.add.line') +autocmd FileType go nmap gtr :call CocAction('runCommand', 'go.tags.remove') +autocmd FileType go nmap gtj :call CocAction('runCommand', 'go.tags.add', 'json') +autocmd FileType go nmap gty :call CocAction('runCommand', 'go.tags.add', 'yaml') +autocmd FileType go nmap gtx :call CocAction('runCommand', 'go.tags.clear') + diff --git a/coc/extensions/node_modules/coc-go/lib/binaries.js b/coc/extensions/node_modules/coc-go/lib/binaries.js new file mode 100644 index 0000000..d67ffd5 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/binaries.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TOOLS = exports.IMPL = exports.GOPLAY = exports.GOTESTS = exports.GOMODIFYTAGS = exports.GOPLS = void 0; +exports.GOPLS = 'golang.org/x/tools/gopls'; +exports.GOMODIFYTAGS = 'github.com/fatih/gomodifytags'; +exports.GOTESTS = "github.com/cweill/gotests/..."; +exports.GOPLAY = "github.com/haya14busa/goplay/cmd/goplay"; +exports.IMPL = "github.com/josharian/impl"; +exports.TOOLS = [ + exports.GOPLS, + exports.GOMODIFYTAGS, + exports.GOTESTS, + exports.GOPLAY, + exports.IMPL, +]; +//# sourceMappingURL=binaries.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/commands.js b/coc/extensions/node_modules/coc-go/lib/commands.js new file mode 100644 index 0000000..193ec80 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/commands.js @@ -0,0 +1,104 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.installTools = exports.installImpl = exports.installGoplay = exports.installGotests = exports.installGomodifytags = exports.checkGopls = exports.installGopls = exports.version = void 0; +const tslib_1 = require("tslib"); +const path_1 = tslib_1.__importDefault(require("path")); +const fs_1 = tslib_1.__importDefault(require("fs")); +const coc_nvim_1 = require("coc.nvim"); +const tools_1 = require("./utils/tools"); +const checktag_1 = tslib_1.__importDefault(require("./utils/checktag")); +const binaries_1 = require("./binaries"); +const versions_1 = require("./utils/versions"); +async function version() { + const v1 = await pkgVersion(); + const v2 = await goplsVersion() || 'unknown'; + coc_nvim_1.window.showMessage(`Version: coc-go ${v1}; gopls ${v2}`, 'more'); +} +exports.version = version; +async function installGopls(client) { + await tools_1.installGoBin(binaries_1.GOPLS, true, goplsVersion); + if (client.needsStop()) { + await client.stop(); + client.restart(); + } +} +exports.installGopls = installGopls; +async function checkGopls(client, mode) { + const [current, latest] = await Promise.all([ + goplsVersion(), + checktag_1.default("golang/tools", /^gopls\//), + ]); + try { + let install = false; + switch (versions_1.compareVersions(latest, current)) { + case 0: + coc_nvim_1.window.showMessage(`[gopls] up-to-date: ${current}`, 'more'); + break; + case 1: + switch (mode) { + case 'install': + install = true; + break; + case 'ask': + install = await coc_nvim_1.window.showPrompt(`[gopls] Install update? ${current} => ${latest}`); + break; + case 'inform': + coc_nvim_1.window.showMessage(`[gopls] update available: ${current} => ${latest}`); + break; + } + break; + case -1: + coc_nvim_1.window.showMessage(`[gopls] current: ${current} | latest: ${latest}`, 'more'); + break; + } + if (install) { + await installGopls(client); + } + } + catch (e) { + coc_nvim_1.window.showMessage(e.toString(), 'error'); + } +} +exports.checkGopls = checkGopls; +async function pkgVersion() { + try { + const pkgPath = path_1.default.resolve(__dirname, '..', 'package.json'); + const pkgContent = await fs_1.default.promises.readFile(pkgPath, 'utf8'); + return JSON.parse(pkgContent).version; + } + catch (err) { + console.error(err); + } + return ''; +} +async function goplsVersion() { + const [, versionOut] = await tools_1.runGoTool("gopls", ["version"]); + const m = versionOut.trim().match(/\s{4}golang\.org\/x\/tools\/gopls@(v?\d+\.\d+\.\d+) .*/); + if (m && versions_1.isValidVersion(m[1])) { + return m[1].replace(/^v/, ''); + } + return ''; +} +async function installGomodifytags() { + await tools_1.installGoBin(binaries_1.GOMODIFYTAGS, true); +} +exports.installGomodifytags = installGomodifytags; +async function installGotests() { + await tools_1.installGoBin(binaries_1.GOTESTS, true); +} +exports.installGotests = installGotests; +async function installGoplay() { + await tools_1.installGoBin(binaries_1.GOPLAY, true); +} +exports.installGoplay = installGoplay; +async function installImpl() { + await tools_1.installGoBin(binaries_1.IMPL, true); +} +exports.installImpl = installImpl; +async function installTools() { + for (const tool of binaries_1.TOOLS) { + await tools_1.installGoBin(tool, true); + } +} +exports.installTools = installTools; +//# sourceMappingURL=commands.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/editor.js b/coc/extensions/node_modules/coc-go/lib/editor.js new file mode 100644 index 0000000..9985957 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/editor.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.activeTextDocument = void 0; +const coc_nvim_1 = require("coc.nvim"); +async function activeTextDocument() { + const doc = await coc_nvim_1.workspace.document; + if (doc.filetype != 'go') { + throw "Not a go document"; + } + return doc.textDocument; +} +exports.activeTextDocument = activeTextDocument; +//# sourceMappingURL=editor.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/extension.js b/coc/extensions/node_modules/coc-go/lib/extension.js new file mode 100644 index 0000000..904ae24 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/extension.js @@ -0,0 +1,110 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.activate = void 0; +const coc_nvim_1 = require("coc.nvim"); +const child_process_1 = require("child_process"); +const tools_1 = require("./utils/tools"); +const commands_1 = require("./commands"); +const modify_tags_1 = require("./utils/modify-tags"); +const config_1 = require("./utils/config"); +const editor_1 = require("./editor"); +const binaries_1 = require("./binaries"); +const tests_1 = require("./utils/tests"); +const playground_1 = require("./utils/playground"); +const impl_1 = require("./utils/impl"); +const restartConfigs = [ + 'go.goplsArgs', + 'go.goplsOptions', + 'go.goplsPath', + 'go.goplsUseDaemon', +]; +async function activate(context) { + config_1.setStoragePath(context.storagePath); + if (config_1.getConfig().enable === false) { + return; + } + registerGeneral(context); + registerGopls(context); + registerTest(context); + registerTags(context); + registerPlaygroud(context); + registerGoImpl(context); + registerTools(context); +} +exports.activate = activate; +async function registerGeneral(context) { + context.subscriptions.push(coc_nvim_1.commands.registerCommand("go.version", () => commands_1.version())); +} +async function registerGopls(context) { + const config = config_1.getConfig(); + const command = await goplsPath(config.goplsPath); + if (!command) { + return; + } + const args = config.goplsArgs ? [...config.goplsArgs] : []; + if (config.goplsUseDaemon !== false && !args.find(arg => arg.startsWith('-remote'))) { + // Use daemon by default + args.push('-remote=auto'); + } + // TMPDIR needs to be resetted, because its altered by coc.nvim, which breaks + // the automatic deamon launching of gopls. + // See: https://github.com/neoclide/coc.nvim/commit/bdd9a9e1401fe6fdd57a9bd078e3651ecf1e0202 + const tmpdir = await coc_nvim_1.workspace.nvim.eval('$TMPDIR'); + const server = () => { + return new Promise(resolve => { + resolve(child_process_1.spawn(command, args, { + cwd: coc_nvim_1.workspace.cwd, + env: Object.assign(Object.assign(Object.assign({}, process.env), { TMPDIR: tmpdir }), config.goplsEnv), + })); + }); + }; + // https://github.com/neoclide/coc.nvim/blob/master/src/language-client/client.ts#L684 + const clientOptions = { + documentSelector: ['go', 'gomod'], + initializationOptions: () => config_1.getConfig().goplsOptions, + disableWorkspaceFolders: config.disable.workspaceFolders, + disableDiagnostics: config.disable.diagnostics, + disableCompletion: config.disable.completion, + }; + const client = new coc_nvim_1.LanguageClient('go', 'gopls', server, clientOptions); + if (config.checkForUpdates !== 'disabled' && !config.goplsPath) { + await commands_1.checkGopls(client, config.checkForUpdates); + } + context.subscriptions.push(coc_nvim_1.services.registLanguageClient(client), + // restart gopls if options changed + coc_nvim_1.workspace.onDidChangeConfiguration(async (e) => { + if (restartConfigs.find(k => e.affectsConfiguration(k))) { + await client.stop(); + client.restart(); + } + }), coc_nvim_1.commands.registerCommand("go.install.gopls", () => commands_1.installGopls(client))); +} +async function goplsPath(goplsPath) { + if (goplsPath) { + if (!await tools_1.commandExists(goplsPath)) { + coc_nvim_1.window.showMessage(`goplsPath is configured ("${goplsPath}"), but does not exist!`, 'error'); + return null; + } + return goplsPath; + } + if (!await tools_1.installGoBin(binaries_1.GOPLS)) { + return; + } + return tools_1.goBinPath(binaries_1.GOPLS); +} +async function registerGoImpl(context) { + context.subscriptions.push(coc_nvim_1.commands.registerCommand("go.install.impl", () => commands_1.installImpl()), coc_nvim_1.commands.registerCommand("go.impl.cursor", async () => impl_1.generateImplStubs(await editor_1.activeTextDocument()))); +} +async function registerTest(context) { + context.subscriptions.push(coc_nvim_1.commands.registerCommand("go.install.gotests", () => commands_1.installGotests()), coc_nvim_1.commands.registerCommand("go.test.generate.file", async () => tests_1.generateTestsAll(await editor_1.activeTextDocument())), coc_nvim_1.commands.registerCommand("go.test.generate.exported", async () => tests_1.generateTestsExported(await editor_1.activeTextDocument())), coc_nvim_1.commands.registerCommand("go.test.generate.function", async () => tests_1.generateTestsFunction(await editor_1.activeTextDocument())), coc_nvim_1.commands.registerCommand("go.test.toggle", async () => tests_1.toogleTests(await editor_1.activeTextDocument()))); +} +async function registerTags(context) { + context.subscriptions.push(coc_nvim_1.commands.registerCommand("go.install.gomodifytags", () => commands_1.installGomodifytags()), coc_nvim_1.commands.registerCommand("go.tags.add", async (...tags) => modify_tags_1.addTags(await editor_1.activeTextDocument(), { tags })), coc_nvim_1.commands.registerCommand("go.tags.add.line", async (...tags) => modify_tags_1.addTags(await editor_1.activeTextDocument(), { tags, selection: "line" })), coc_nvim_1.commands.registerCommand("go.tags.add.prompt", async () => modify_tags_1.addTags(await editor_1.activeTextDocument(), { prompt: true })), coc_nvim_1.commands.registerCommand("go.tags.remove", async (...tags) => modify_tags_1.removeTags(await editor_1.activeTextDocument(), { tags })), coc_nvim_1.commands.registerCommand("go.tags.remove.line", async (...tags) => modify_tags_1.removeTags(await editor_1.activeTextDocument(), { tags, selection: "line" })), coc_nvim_1.commands.registerCommand("go.tags.remove.prompt", async () => modify_tags_1.removeTags(await editor_1.activeTextDocument(), { prompt: true })), coc_nvim_1.commands.registerCommand("go.tags.clear", async () => modify_tags_1.clearTags(await editor_1.activeTextDocument())), coc_nvim_1.commands.registerCommand("go.tags.clear.line", async () => modify_tags_1.clearTags(await editor_1.activeTextDocument(), { selection: "line" }))); +} +async function registerPlaygroud(context) { + context.subscriptions.push(coc_nvim_1.commands.registerCommand("go.install.goplay", () => commands_1.installGoplay()), coc_nvim_1.commands.registerCommand("go.playground", async () => playground_1.openPlayground(await editor_1.activeTextDocument()))); +} +async function registerTools(context) { + context.subscriptions.push(coc_nvim_1.commands.registerCommand("go.install.tools", () => commands_1.installTools())); +} +//# sourceMappingURL=extension.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/utils/checktag.js b/coc/extensions/node_modules/coc-go/lib/utils/checktag.js new file mode 100644 index 0000000..c68a580 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/utils/checktag.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const node_fetch_1 = tslib_1.__importDefault(require("node-fetch")); +const releaseFilter = /^v\d+\.\d+\.\d+$/; +async function checkLatestTag(repo, prefixFilter) { + const resp = await node_fetch_1.default(`https://api.github.com/repos/${repo}/tags`); + const data = await resp.json(); + let tags = data.map(t => t.name); + if (prefixFilter) { + tags = tags + .filter(t => t.match(prefixFilter)) + .map(t => t.replace(prefixFilter, '')); + } + tags = tags + .filter(t => t.match(releaseFilter)); + return tags.length > 0 + ? tags[0].replace(/^v/, '') + : ''; +} +exports.default = checkLatestTag; +//# sourceMappingURL=checktag.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/utils/config.js b/coc/extensions/node_modules/coc-go/lib/utils/config.js new file mode 100644 index 0000000..1155ca2 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/utils/config.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.configDir = exports.setStoragePath = exports.getConfig = void 0; +const tslib_1 = require("tslib"); +const path_1 = tslib_1.__importDefault(require("path")); +const os_1 = tslib_1.__importDefault(require("os")); +const coc_nvim_1 = require("coc.nvim"); +const fs_1 = require("./fs"); +const state = {}; +function getConfig() { + return coc_nvim_1.workspace.getConfiguration().get("go"); +} +exports.getConfig = getConfig; +function setStoragePath(dir) { + state.storagePath = dir; +} +exports.setStoragePath = setStoragePath; +async function configDir(...names) { + const storage = state.storagePath || path_1.default.join(os_1.default.homedir(), ".config", "coc", "go"); + const dir = path_1.default.join(storage, ...names); + return new Promise((resolve) => { + fs_1.createDir(dir); + resolve(dir); + }); +} +exports.configDir = configDir; +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/utils/fs.js b/coc/extensions/node_modules/coc-go/lib/utils/fs.js new file mode 100644 index 0000000..899b1fd --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/utils/fs.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createDir = void 0; +const tslib_1 = require("tslib"); +const fs_1 = tslib_1.__importDefault(require("fs")); +const path_1 = tslib_1.__importDefault(require("path")); +function createDir(dirPath) { + if (fs_1.default.existsSync(dirPath)) { + return; + } + createDir(path_1.default.dirname(dirPath)); + fs_1.default.mkdirSync(dirPath); +} +exports.createDir = createDir; +//# sourceMappingURL=fs.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/utils/fs.test.js b/coc/extensions/node_modules/coc-go/lib/utils/fs.test.js new file mode 100644 index 0000000..72b8a93 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/utils/fs.test.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const tmp_1 = tslib_1.__importDefault(require("tmp")); +const assert_1 = tslib_1.__importDefault(require("assert")); +const path_1 = tslib_1.__importDefault(require("path")); +const fs_1 = tslib_1.__importDefault(require("fs")); +const fs_2 = require("./fs"); +describe('createDir()', () => { + let tmpDir; + const joinPath = (...parts) => path_1.default.join(tmpDir.name, ...parts); + beforeEach(() => tmpDir = tmp_1.default.dirSync({ unsafeCleanup: true })); + afterEach(() => tmpDir.removeCallback()); + it('should create a directory', () => { + const dirPath = joinPath('test'); + fs_2.createDir(dirPath); + assert_1.default.ok(fs_1.default.existsSync(dirPath)); + }); + it('should create nested directories', () => { + const dirPath = joinPath('test', 'foo', 'bar'); + fs_2.createDir(dirPath); + assert_1.default.ok(fs_1.default.existsSync(dirPath)); + }); + it('should not fail if directory exists', () => { + fs_2.createDir(tmpDir.name); + assert_1.default.ok(fs_1.default.existsSync(tmpDir.name)); + }); +}); +//# sourceMappingURL=fs.test.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/utils/impl.js b/coc/extensions/node_modules/coc-go/lib/utils/impl.js new file mode 100644 index 0000000..e8f27af --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/utils/impl.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.generateImplStubs = void 0; +const coc_nvim_1 = require("coc.nvim"); +const binaries_1 = require("../binaries"); +const tools_1 = require("./tools"); +const interfaceRegex = /^(\w+ \*?\w+ )?([\w./-]+)$/; +async function generateImplStubs(document) { + try { + const implInput = await coc_nvim_1.window.requestInput("Enter receiver and interface [f *File io.Closer]"); + if (implInput == null) { + coc_nvim_1.window.showMessage("No input detected! Aborting.", "warning"); + return; + } + const matches = implInput.match(interfaceRegex); + if (!matches) { + throw Error(`Cannot parse input: ${implInput}`); + } + const edit = await runGoImpl(document, [matches[1], matches[2]]); + await coc_nvim_1.workspace.applyEdit({ changes: { [document.uri]: [edit] } }); + } + catch (error) { + coc_nvim_1.window.showMessage(error, "error"); + } +} +exports.generateImplStubs = generateImplStubs; +async function runGoImpl(document, args) { + const stdout = await tools_1.execTool(binaries_1.IMPL, args); + const { line } = await coc_nvim_1.window.getCursorPosition(); + const insertPos = { line: line + 1, character: 0 }; + const lineText = await coc_nvim_1.workspace.getLine(document.uri, line); + const newText = lineText.trim() === '' + ? stdout + : `\n${stdout}`; + return { + range: { + start: insertPos, + end: insertPos + }, + newText + }; +} +//# sourceMappingURL=impl.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/utils/modify-tags.js b/coc/extensions/node_modules/coc-go/lib/utils/modify-tags.js new file mode 100644 index 0000000..8dbc223 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/utils/modify-tags.js @@ -0,0 +1,113 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.clearTags = exports.removeTags = exports.addTags = void 0; +const coc_nvim_1 = require("coc.nvim"); +const vscode_uri_1 = require("vscode-uri"); +const tools_1 = require("./tools"); +const binaries_1 = require("../binaries"); +//////////////////////////////////////////////////////////////////////////////// +async function addTags(document, params = {}) { + const config = coc_nvim_1.workspace.getConfiguration().get('go.tags', {}); + let tags = (params.tags && params.tags.length > 0) + ? params.tags.join(',') + : (config.tags || 'json'); + let options = (config.options || config.options === "") + ? config.options + : 'json=omitempty'; + const transform = (config.transform || "snakecase"); + const skipUnexported = config.skipUnexported; + let cursor; + if (params.prompt) { + cursor = await coc_nvim_1.window.getCursorPosition(); + tags = await coc_nvim_1.window.requestInput('Enter comma separated tag names', tags); + if (!tags) { + return; + } + options = await coc_nvim_1.window.requestInput('Enter comma separated options', options); + } + const args = [ + '-add-tags', tags.replace(/ +/g, ''), + '-override', + '-add-options', (options || ""), + '-transform', transform, + ...(await offsetArgs(document, (params.selection || "struct"), cursor)) + ]; + if (skipUnexported) { + args.push('--skip-unexported'); + } + await runGomodifytags(document, args); +} +exports.addTags = addTags; +async function removeTags(document, params = {}) { + const config = coc_nvim_1.workspace.getConfiguration().get('go.tags', {}); + let tags = (params.tags && params.tags.length > 0) + ? params.tags.join(',') + : (config.tags || 'json'); + let cursor; + if (params.prompt) { + cursor = await coc_nvim_1.window.getCursorPosition(); + tags = await coc_nvim_1.window.requestInput('Enter comma separated tag names', tags); + if (!tags) { + return; + } + } + await runGomodifytags(document, [ + '-remove-tags', (tags || "json"), + '-clear-options', + ...(await offsetArgs(document, (params.selection || "struct"), cursor)) + ]); +} +exports.removeTags = removeTags; +async function clearTags(document, params = {}) { + await runGomodifytags(document, [ + '-clear-tags', + '-clear-options', + ...(await offsetArgs(document, (params.selection || "struct"))) + ]); +} +exports.clearTags = clearTags; +//////////////////////////////////////////////////////////////////////////////// +async function runGomodifytags(document, args) { + const fileName = vscode_uri_1.URI.parse(document.uri).fsPath; + args.push('-modified', '-file', fileName, '-format', 'json'); + const input = fileArchive(fileName, document.getText()); + const edit = await execGomodifytags(args, input); + await coc_nvim_1.workspace.applyEdit({ changes: { [document.uri]: [edit] } }); +} +async function execGomodifytags(args, input) { + try { + const stdout = await tools_1.execTool(binaries_1.GOMODIFYTAGS, args, input); + const mods = JSON.parse(stdout); + return { + range: { + start: { line: mods.start - 1, character: 0 }, + end: { line: mods.end, character: 0 } + }, + newText: mods.lines.join("\n") + "\n" + }; + } + catch (err) { + coc_nvim_1.window.showMessage(`Cannot modify tags: ${err}`, 'error'); + throw err; + } +} +function fileArchive(fileName, fileContents) { + return fileName + '\n' + Buffer.byteLength(fileContents, 'utf8') + '\n' + fileContents; +} +// https://github.com/microsoft/vscode-go/blob/master/src/util.ts#L84 +function byteOffsetAt(document, position) { + const offset = document.offsetAt(position); + const text = document.getText(); + return Buffer.byteLength(text.substr(0, offset)).toString(); +} +async function offsetArgs(document, selection, cursor = null) { + cursor = cursor || await coc_nvim_1.window.getCursorPosition(); + coc_nvim_1.window.showMessage(`selection = ${selection}`); + switch (selection) { + case "struct": + return ['-offset', byteOffsetAt(document, cursor)]; + case "line": + return ['-line', String(cursor.line + 1)]; + } +} +//# sourceMappingURL=modify-tags.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/utils/playground.js b/coc/extensions/node_modules/coc-go/lib/utils/playground.js new file mode 100644 index 0000000..e5bf135 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/utils/playground.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.openPlayground = void 0; +const coc_nvim_1 = require("coc.nvim"); +const tools_1 = require("./tools"); +const binaries_1 = require("../binaries"); +async function openPlayground(document) { + return runGoplay(document.getText()); +} +exports.openPlayground = openPlayground; +async function runGoplay(code) { + try { + const stdout = await tools_1.execTool(binaries_1.GOPLAY, ['-'], code); + coc_nvim_1.window.showMessage(stdout); + return true; + } + catch (err) { + coc_nvim_1.window.showMessage(`${err}`, "error"); + return false; + } +} +//# sourceMappingURL=playground.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/utils/tests.js b/coc/extensions/node_modules/coc-go/lib/utils/tests.js new file mode 100644 index 0000000..add1431 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/utils/tests.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extractFunctionName = exports.toogleTests = exports.generateTestsFunction = exports.generateTestsExported = exports.generateTestsAll = void 0; +const coc_nvim_1 = require("coc.nvim"); +const vscode_uri_1 = require("vscode-uri"); +const tools_1 = require("./tools"); +const binaries_1 = require("../binaries"); +//////////////////////////////////////////////////////////////////////////////// +async function generateTestsAll(document) { + if (isTest(document)) { + coc_nvim_1.window.showMessage("Document is a test file", "error"); + return; + } + await runGotests(document, ["-all"]) && await openTests(document); +} +exports.generateTestsAll = generateTestsAll; +async function generateTestsExported(document) { + if (isTest(document)) { + coc_nvim_1.window.showMessage("Document is a test file", "error"); + return; + } + await runGotests(document, ["-exported"]) && await openTests(document); +} +exports.generateTestsExported = generateTestsExported; +async function generateTestsFunction(document) { + if (isTest(document)) { + coc_nvim_1.window.showMessage("Document is a test file", "error"); + return; + } + const { line } = await coc_nvim_1.window.getCursorPosition(); + const text = await document.getText({ + start: { line, character: 0 }, + end: { line, character: Infinity }, + }); + coc_nvim_1.window.showMessage(text); + const funcName = extractFunctionName(text); + if (!funcName) { + coc_nvim_1.window.showMessage("No function found", "error"); + return; + } + await runGotests(document, ["-only", `^${funcName}$`]) && await openTests(document); +} +exports.generateTestsFunction = generateTestsFunction; +async function toogleTests(document) { + const targetURI = isTest(document) + ? sourceURI(document) + : testURI(document); + return coc_nvim_1.workspace.openResource(targetURI); +} +exports.toogleTests = toogleTests; +//////////////////////////////////////////////////////////////////////////////// +async function openTests(document) { + return coc_nvim_1.workspace.openResource(testURI(document)); +} +function isTest(document) { + return document.uri.endsWith('_test.go'); +} +function testURI(document) { + return document.uri.replace(/(_test)?\.go$/, '_test.go'); +} +function sourceURI(document) { + return document.uri.replace(/(_test)?\.go$/, '.go'); +} +async function runGotests(document, args) { + const config = coc_nvim_1.workspace.getConfiguration().get('go.tests', {}); + args.push(...(config.generateFlags || []), '-w', vscode_uri_1.URI.parse(document.uri).fsPath); + try { + const stdout = await tools_1.execTool(binaries_1.GOTESTS, args); + coc_nvim_1.window.showMessage(stdout || ""); + return true; + } + catch (err) { + coc_nvim_1.window.showMessage(`Error: ${err}`, "error"); + return false; + } +} +//////////////////////////////////////////////////////////////////////////////// +function extractFunctionName(line) { + const m = /^func +(\([^)]+\) +)?([^\s(]+)/.exec(line); + if (m) { + return m[2]; + } +} +exports.extractFunctionName = extractFunctionName; +//# sourceMappingURL=tests.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/utils/tests.test.js b/coc/extensions/node_modules/coc-go/lib/utils/tests.test.js new file mode 100644 index 0000000..4f5038b --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/utils/tests.test.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const assert_1 = tslib_1.__importDefault(require("assert")); +const tests_1 = require("./tests"); +describe('extractFunctionName()', () => { + const cases = [ + ['', null], + ['\tfuncFoo()', null], + ['func Foo() {', 'Foo'], + ['func Foo() string {', 'Foo'], + ['func Foo(str string) string {', 'Foo'], + ['func (b *Bar) Foo(str string) string {', 'Foo'], + ]; + cases.forEach(([line, name]) => { + it(`should extract ${JSON.stringify(name)} from "${line}"`, () => { + assert_1.default.equal(name, tests_1.extractFunctionName(line)); + }); + }); +}); +//# sourceMappingURL=tests.test.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/utils/tools.js b/coc/extensions/node_modules/coc-go/lib/utils/tools.js new file mode 100644 index 0000000..655d7a5 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/utils/tools.js @@ -0,0 +1,121 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.execTool = exports.commandExists = exports.runGoTool = exports.goBinPath = exports.installGoBin = void 0; +const tslib_1 = require("tslib"); +const path_1 = tslib_1.__importDefault(require("path")); +const fs_1 = tslib_1.__importDefault(require("fs")); +const util_1 = tslib_1.__importDefault(require("util")); +const child_process_1 = require("child_process"); +const coc_nvim_1 = require("coc.nvim"); +const which_1 = tslib_1.__importDefault(require("which")); +const config_1 = require("./config"); +const runExec = util_1.default.promisify(child_process_1.exec); +const isWin = process.platform === 'win32'; +async function installGoBin(source, force = false, getVersion) { + const name = goBinName(source); + if (!force && await goBinExists(name)) { + return true; + } + const statusItem = coc_nvim_1.window.createStatusBarItem(90, { progress: true }); + statusItem.text = `Installing '${name}'`; + statusItem.show(); + const success = await goRun(`get ${source}@latest`) && await goBinExists(name); + if (success) { + const vname = getVersion ? `${name}@${await getVersion()}` : name; + coc_nvim_1.window.showMessage(`Installed '${vname}'`); + } + else { + coc_nvim_1.window.showMessage(`Failed to install '${name}'`, 'error'); + } + statusItem.hide(); + return success; +} +exports.installGoBin = installGoBin; +async function goBinPath(source) { + const name = goBinName(source); + return path_1.default.join(await config_1.configDir('bin'), name + (isWin ? ".exe" : "")); +} +exports.goBinPath = goBinPath; +async function runGoTool(name, args = []) { + const bin = await goBinPath(name); + return new Promise((resolve) => { + const p = child_process_1.spawn(bin, args); + let out = ""; + p.stdout.on('data', (data) => out += data); + p.on("close", code => resolve([code, out])); + }); +} +exports.runGoTool = runGoTool; +async function commandExists(command) { + if (path_1.default.isAbsolute(command)) { + return fileExists(command); + } + return new Promise((resolve) => { which_1.default(command, (err) => resolve(err == null)); }); +} +exports.commandExists = commandExists; +//////////////////////////////////////////////////////////////////////////////// +async function goBinExists(source) { + const name = goBinName(source); + const bin = await goBinPath(name); + return fileExists(bin); +} +async function fileExists(path) { + return new Promise((resolve) => fs_1.default.open(path, 'r', (err) => resolve(err === null))); +} +async function goRun(args) { + const gopath = await config_1.configDir('tools'); + const gobin = await config_1.configDir('bin'); + const env = { + GO111MODULE: 'on', + GOBIN: gobin, + GOPATH: gopath, + GOROOT: '', + GOTOOLDIR: '', + }; + const cmd = isWin + ? `go ${args}` + : `env GOBIN=${gobin} go ${args}`; + const opts = { + env: Object.assign({}, process.env, env), + cwd: gopath, + shell: isWin ? undefined : process.env.SHELL, + windowsHide: true, + }; + try { + await runExec(cmd, opts); + } + catch (ex) { + coc_nvim_1.window.showMessage(ex, 'error'); + return false; + } + return true; +} +async function execTool(source, args, input) { + const [bin, name] = await Promise.all([ + goBinPath(source), + goBinName(source), + ]); + if (!await commandExists(bin)) { + await installGoBin(source); + } + return new Promise((resolve, reject) => { + const p = child_process_1.execFile(bin, args, { cwd: coc_nvim_1.workspace.cwd }, async (err, stdout, stderr) => { + if (err && err.code === "ENOENT") { + return reject(`Error: Command ${name} not found! Run "CocCommand go.install.${name}" to install it and try again.`); + } + if (err) { + return reject(stderr.toString()); + } + return resolve(stdout.toString()); + }); + if (p.pid) { + p.stdin.end(input); + } + }); +} +exports.execTool = execTool; +//////////////////////////////////////////////////////////////////////////////// +function goBinName(source) { + return source.replace(/\/\.\.\.$/, '').split('/').pop(); +} +//# sourceMappingURL=tools.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/utils/versions.js b/coc/extensions/node_modules/coc-go/lib/utils/versions.js new file mode 100644 index 0000000..a0313f6 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/utils/versions.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseVersion = exports.compareVersions = exports.isValidVersion = void 0; +const versionExp = /^v?(\d+)\.(\d+).(\d+)$/; +function isValidVersion(version) { + return Boolean(version.trim().match(versionExp)); +} +exports.isValidVersion = isValidVersion; +function compareVersions(version1, version2) { + const v1 = parseVersion(version1); + const v2 = parseVersion(version2); + for (let i = 0; i < 3; i++) { + if (v1[i] !== v2[i]) { + return Math.max(-1, Math.min(1, v1[i] - v2[i])); + } + } + return 0; +} +exports.compareVersions = compareVersions; +function parseVersion(v) { + let ver = [0, 0, 0]; + const match = v.trim().match(versionExp); + if (match) { + const [, major, minor, patch] = match; + ver = [parseInt(major), parseInt(minor), parseInt(patch)]; + } + if (!isValidVersion(v)) { + throw new Error(`'${v}' is not a valid version`); + } + return ver; +} +exports.parseVersion = parseVersion; +//# sourceMappingURL=versions.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/lib/utils/versions.test.js b/coc/extensions/node_modules/coc-go/lib/utils/versions.test.js new file mode 100644 index 0000000..0327dd6 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/lib/utils/versions.test.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const assert_1 = tslib_1.__importDefault(require("assert")); +const versions_1 = require("./versions"); +const v0 = [0, 0, 0]; +const v1 = [1, 0, 0]; +const v1_2 = [1, 2, 0]; +const v1_2_3 = [1, 2, 3]; +describe('isValidVersion()', () => { + it('should recognise valid versions', () => { + assert_1.default.ok(versions_1.isValidVersion('v1.0.0')); + assert_1.default.ok(versions_1.isValidVersion('1.0.0')); + assert_1.default.ok(versions_1.isValidVersion('0.1.0')); + assert_1.default.ok(versions_1.isValidVersion('0.0.1')); + assert_1.default.ok(versions_1.isValidVersion('0.0.0')); + assert_1.default.ok(versions_1.isValidVersion('v0.0.0')); + }); + it('should recognise invalid versions', () => { + assert_1.default.ok(!versions_1.isValidVersion('v 1.0.0')); + assert_1.default.ok(!versions_1.isValidVersion('1')); + assert_1.default.ok(!versions_1.isValidVersion('1.1')); + }); +}); +describe("parseVersion()", () => { + it("should parse simple versions", () => { + assert_1.default.deepStrictEqual(versions_1.parseVersion('v0.0.0'), v0); + assert_1.default.deepStrictEqual(versions_1.parseVersion('v1.0.0'), v1); + assert_1.default.deepStrictEqual(versions_1.parseVersion('v1.2.0'), v1_2); + assert_1.default.deepStrictEqual(versions_1.parseVersion('v1.2.3'), v1_2_3); + }); +}); +describe('compareVersions()', () => { + it('should compare equal version', () => { + assert_1.default.throws(() => versions_1.compareVersions('', '')); + assert_1.default.strictEqual(versions_1.compareVersions('1.0.0', '1.0.0'), 0); + assert_1.default.strictEqual(versions_1.compareVersions('1.2.0', '1.2.0'), 0); + assert_1.default.strictEqual(versions_1.compareVersions('1.2.3', '1.2.3'), 0); + assert_1.default.strictEqual(versions_1.compareVersions('v1.0.0', '1.0.0'), 0); + }); + it('should compare greater version', () => { + assert_1.default.throws(() => versions_1.compareVersions('', '')); + assert_1.default.strictEqual(versions_1.compareVersions('2.0.0', '1.0.0'), 1); + assert_1.default.strictEqual(versions_1.compareVersions('1.1.0', '1.0.0'), 1); + assert_1.default.strictEqual(versions_1.compareVersions('1.0.4', '1.0.0'), 1); + assert_1.default.strictEqual(versions_1.compareVersions('v1.1.0', '1.0.0'), 1); + assert_1.default.strictEqual(versions_1.compareVersions('1.1.0', 'v1.0.0'), 1); + }); + it('should compare smaller version', () => { + assert_1.default.throws(() => versions_1.compareVersions('', '')); + assert_1.default.strictEqual(versions_1.compareVersions('1.0.0', '2.0.0'), -1); + assert_1.default.strictEqual(versions_1.compareVersions('1.0.0', '1.1.0'), -1); + assert_1.default.strictEqual(versions_1.compareVersions('1.0.0', '1.0.4'), -1); + assert_1.default.strictEqual(versions_1.compareVersions('1.0.0', 'v1.1.0'), -1); + assert_1.default.strictEqual(versions_1.compareVersions('v1.0.0', '1.1.0'), -1); + }); +}); +//# sourceMappingURL=versions.test.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/.bin/node-which b/coc/extensions/node_modules/coc-go/node_modules/.bin/node-which new file mode 120000 index 0000000..6f8415e --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/.bin/node-which @@ -0,0 +1 @@ +../which/bin/node-which \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/.package-lock.json b/coc/extensions/node_modules/coc-go/node_modules/.package-lock.json new file mode 100644 index 0000000..880b2b3 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/.package-lock.json @@ -0,0 +1,50 @@ +{ + "name": "coc-go", + "version": "0.13.3", + "lockfileVersion": 2, + "requires": true, + "packages": { + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==" + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz", + "integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA==" + }, + "node_modules/vscode-uri": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.2.tgz", + "integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==" + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + } + } +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/isexe/.npmignore b/coc/extensions/node_modules/coc-go/node_modules/isexe/.npmignore new file mode 100644 index 0000000..c1cb757 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/isexe/.npmignore @@ -0,0 +1,2 @@ +.nyc_output/ +coverage/ diff --git a/coc/extensions/node_modules/coc-go/node_modules/isexe/LICENSE b/coc/extensions/node_modules/coc-go/node_modules/isexe/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/isexe/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/coc/extensions/node_modules/coc-go/node_modules/isexe/README.md b/coc/extensions/node_modules/coc-go/node_modules/isexe/README.md new file mode 100644 index 0000000..35769e8 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/isexe/README.md @@ -0,0 +1,51 @@ +# isexe + +Minimal module to check if a file is executable, and a normal file. + +Uses `fs.stat` and tests against the `PATHEXT` environment variable on +Windows. + +## USAGE + +```javascript +var isexe = require('isexe') +isexe('some-file-name', function (err, isExe) { + if (err) { + console.error('probably file does not exist or something', err) + } else if (isExe) { + console.error('this thing can be run') + } else { + console.error('cannot be run') + } +}) + +// same thing but synchronous, throws errors +var isExe = isexe.sync('some-file-name') + +// treat errors as just "not executable" +isexe('maybe-missing-file', { ignoreErrors: true }, callback) +var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true }) +``` + +## API + +### `isexe(path, [options], [callback])` + +Check if the path is executable. If no callback provided, and a +global `Promise` object is available, then a Promise will be returned. + +Will raise whatever errors may be raised by `fs.stat`, unless +`options.ignoreErrors` is set to true. + +### `isexe.sync(path, [options])` + +Same as `isexe` but returns the value and throws any errors raised. + +### Options + +* `ignoreErrors` Treat all errors as "no, this is not executable", but + don't raise them. +* `uid` Number to use as the user id +* `gid` Number to use as the group id +* `pathExt` List of path extensions to use instead of `PATHEXT` + environment variable on Windows. diff --git a/coc/extensions/node_modules/coc-go/node_modules/isexe/index.js b/coc/extensions/node_modules/coc-go/node_modules/isexe/index.js new file mode 100644 index 0000000..553fb32 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/isexe/index.js @@ -0,0 +1,57 @@ +var fs = require('fs') +var core +if (process.platform === 'win32' || global.TESTING_WINDOWS) { + core = require('./windows.js') +} else { + core = require('./mode.js') +} + +module.exports = isexe +isexe.sync = sync + +function isexe (path, options, cb) { + if (typeof options === 'function') { + cb = options + options = {} + } + + if (!cb) { + if (typeof Promise !== 'function') { + throw new TypeError('callback not provided') + } + + return new Promise(function (resolve, reject) { + isexe(path, options || {}, function (er, is) { + if (er) { + reject(er) + } else { + resolve(is) + } + }) + }) + } + + core(path, options || {}, function (er, is) { + // ignore EACCES because that just means we aren't allowed to run it + if (er) { + if (er.code === 'EACCES' || options && options.ignoreErrors) { + er = null + is = false + } + } + cb(er, is) + }) +} + +function sync (path, options) { + // my kingdom for a filtered catch + try { + return core.sync(path, options || {}) + } catch (er) { + if (options && options.ignoreErrors || er.code === 'EACCES') { + return false + } else { + throw er + } + } +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/isexe/mode.js b/coc/extensions/node_modules/coc-go/node_modules/isexe/mode.js new file mode 100644 index 0000000..1995ea4 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/isexe/mode.js @@ -0,0 +1,41 @@ +module.exports = isexe +isexe.sync = sync + +var fs = require('fs') + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), options) +} + +function checkStat (stat, options) { + return stat.isFile() && checkMode(stat, options) +} + +function checkMode (stat, options) { + var mod = stat.mode + var uid = stat.uid + var gid = stat.gid + + var myUid = options.uid !== undefined ? + options.uid : process.getuid && process.getuid() + var myGid = options.gid !== undefined ? + options.gid : process.getgid && process.getgid() + + var u = parseInt('100', 8) + var g = parseInt('010', 8) + var o = parseInt('001', 8) + var ug = u | g + + var ret = (mod & o) || + (mod & g) && gid === myGid || + (mod & u) && uid === myUid || + (mod & ug) && myUid === 0 + + return ret +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/isexe/package.json b/coc/extensions/node_modules/coc-go/node_modules/isexe/package.json new file mode 100644 index 0000000..e452689 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/isexe/package.json @@ -0,0 +1,31 @@ +{ + "name": "isexe", + "version": "2.0.0", + "description": "Minimal module to check if a file is executable.", + "main": "index.js", + "directories": { + "test": "test" + }, + "devDependencies": { + "mkdirp": "^0.5.1", + "rimraf": "^2.5.0", + "tap": "^10.3.0" + }, + "scripts": { + "test": "tap test/*.js --100", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/isexe.git" + }, + "keywords": [], + "bugs": { + "url": "https://github.com/isaacs/isexe/issues" + }, + "homepage": "https://github.com/isaacs/isexe#readme" +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/isexe/test/basic.js b/coc/extensions/node_modules/coc-go/node_modules/isexe/test/basic.js new file mode 100644 index 0000000..d926df6 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/isexe/test/basic.js @@ -0,0 +1,221 @@ +var t = require('tap') +var fs = require('fs') +var path = require('path') +var fixture = path.resolve(__dirname, 'fixtures') +var meow = fixture + '/meow.cat' +var mine = fixture + '/mine.cat' +var ours = fixture + '/ours.cat' +var fail = fixture + '/fail.false' +var noent = fixture + '/enoent.exe' +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') + +var isWindows = process.platform === 'win32' +var hasAccess = typeof fs.access === 'function' +var winSkip = isWindows && 'windows' +var accessSkip = !hasAccess && 'no fs.access function' +var hasPromise = typeof Promise === 'function' +var promiseSkip = !hasPromise && 'no global Promise' + +function reset () { + delete require.cache[require.resolve('../')] + return require('../') +} + +t.test('setup fixtures', function (t) { + rimraf.sync(fixture) + mkdirp.sync(fixture) + fs.writeFileSync(meow, '#!/usr/bin/env cat\nmeow\n') + fs.chmodSync(meow, parseInt('0755', 8)) + fs.writeFileSync(fail, '#!/usr/bin/env false\n') + fs.chmodSync(fail, parseInt('0644', 8)) + fs.writeFileSync(mine, '#!/usr/bin/env cat\nmine\n') + fs.chmodSync(mine, parseInt('0744', 8)) + fs.writeFileSync(ours, '#!/usr/bin/env cat\nours\n') + fs.chmodSync(ours, parseInt('0754', 8)) + t.end() +}) + +t.test('promise', { skip: promiseSkip }, function (t) { + var isexe = reset() + t.test('meow async', function (t) { + isexe(meow).then(function (is) { + t.ok(is) + t.end() + }) + }) + t.test('fail async', function (t) { + isexe(fail).then(function (is) { + t.notOk(is) + t.end() + }) + }) + t.test('noent async', function (t) { + isexe(noent).catch(function (er) { + t.ok(er) + t.end() + }) + }) + t.test('noent ignore async', function (t) { + isexe(noent, { ignoreErrors: true }).then(function (is) { + t.notOk(is) + t.end() + }) + }) + t.end() +}) + +t.test('no promise', function (t) { + global.Promise = null + var isexe = reset() + t.throws('try to meow a promise', function () { + isexe(meow) + }) + t.end() +}) + +t.test('access', { skip: accessSkip || winSkip }, function (t) { + runTest(t) +}) + +t.test('mode', { skip: winSkip }, function (t) { + delete fs.access + delete fs.accessSync + var isexe = reset() + t.ok(isexe.sync(ours, { uid: 0, gid: 0 })) + t.ok(isexe.sync(mine, { uid: 0, gid: 0 })) + runTest(t) +}) + +t.test('windows', function (t) { + global.TESTING_WINDOWS = true + var pathExt = '.EXE;.CAT;.CMD;.COM' + t.test('pathExt option', function (t) { + runTest(t, { pathExt: '.EXE;.CAT;.CMD;.COM' }) + }) + t.test('pathExt env', function (t) { + process.env.PATHEXT = pathExt + runTest(t) + }) + t.test('no pathExt', function (t) { + // with a pathExt of '', any filename is fine. + // so the "fail" one would still pass. + runTest(t, { pathExt: '', skipFail: true }) + }) + t.test('pathext with empty entry', function (t) { + // with a pathExt of '', any filename is fine. + // so the "fail" one would still pass. + runTest(t, { pathExt: ';' + pathExt, skipFail: true }) + }) + t.end() +}) + +t.test('cleanup', function (t) { + rimraf.sync(fixture) + t.end() +}) + +function runTest (t, options) { + var isexe = reset() + + var optionsIgnore = Object.create(options || {}) + optionsIgnore.ignoreErrors = true + + if (!options || !options.skipFail) { + t.notOk(isexe.sync(fail, options)) + } + t.notOk(isexe.sync(noent, optionsIgnore)) + if (!options) { + t.ok(isexe.sync(meow)) + } else { + t.ok(isexe.sync(meow, options)) + } + + t.ok(isexe.sync(mine, options)) + t.ok(isexe.sync(ours, options)) + t.throws(function () { + isexe.sync(noent, options) + }) + + t.test('meow async', function (t) { + if (!options) { + isexe(meow, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + } else { + isexe(meow, options, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + } + }) + + t.test('mine async', function (t) { + isexe(mine, options, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + }) + + t.test('ours async', function (t) { + isexe(ours, options, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + }) + + if (!options || !options.skipFail) { + t.test('fail async', function (t) { + isexe(fail, options, function (er, is) { + if (er) { + throw er + } + t.notOk(is) + t.end() + }) + }) + } + + t.test('noent async', function (t) { + isexe(noent, options, function (er, is) { + t.ok(er) + t.notOk(is) + t.end() + }) + }) + + t.test('noent ignore async', function (t) { + isexe(noent, optionsIgnore, function (er, is) { + if (er) { + throw er + } + t.notOk(is) + t.end() + }) + }) + + t.test('directory is not executable', function (t) { + isexe(__dirname, options, function (er, is) { + if (er) { + throw er + } + t.notOk(is) + t.end() + }) + }) + + t.end() +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/isexe/windows.js b/coc/extensions/node_modules/coc-go/node_modules/isexe/windows.js new file mode 100644 index 0000000..3499673 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/isexe/windows.js @@ -0,0 +1,42 @@ +module.exports = isexe +isexe.sync = sync + +var fs = require('fs') + +function checkPathExt (path, options) { + var pathext = options.pathExt !== undefined ? + options.pathExt : process.env.PATHEXT + + if (!pathext) { + return true + } + + pathext = pathext.split(';') + if (pathext.indexOf('') !== -1) { + return true + } + for (var i = 0; i < pathext.length; i++) { + var p = pathext[i].toLowerCase() + if (p && path.substr(-p.length).toLowerCase() === p) { + return true + } + } + return false +} + +function checkStat (stat, path, options) { + if (!stat.isSymbolicLink() && !stat.isFile()) { + return false + } + return checkPathExt(path, options) +} + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, path, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), path, options) +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/node-fetch/CHANGELOG.md b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/CHANGELOG.md new file mode 100644 index 0000000..543d3d9 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/CHANGELOG.md @@ -0,0 +1,272 @@ + +Changelog +========= + + +# 2.x release + +## v2.6.1 + +**This is an important security release. It is strongly recommended to update as soon as possible.** + +- Fix: honor the `size` option after following a redirect. + +## v2.6.0 + +- Enhance: `options.agent`, it now accepts a function that returns custom http(s).Agent instance based on current URL, see readme for more information. +- Fix: incorrect `Content-Length` was returned for stream body in 2.5.0 release; note that `node-fetch` doesn't calculate content length for stream body. +- Fix: `Response.url` should return empty string instead of `null` by default. + +## v2.5.0 + +- Enhance: `Response` object now includes `redirected` property. +- Enhance: `fetch()` now accepts third-party `Blob` implementation as body. +- Other: disable `package-lock.json` generation as we never commit them. +- Other: dev dependency update. +- Other: readme update. + +## v2.4.1 + +- Fix: `Blob` import rule for node < 10, as `Readable` isn't a named export. + +## v2.4.0 + +- Enhance: added `Brotli` compression support (using node's zlib). +- Enhance: updated `Blob` implementation per spec. +- Fix: set content type automatically for `URLSearchParams`. +- Fix: `Headers` now reject empty header names. +- Fix: test cases, as node 12+ no longer accepts invalid header response. + +## v2.3.0 + +- Enhance: added `AbortSignal` support, with README example. +- Enhance: handle invalid `Location` header during redirect by rejecting them explicitly with `FetchError`. +- Fix: update `browser.js` to support react-native environment, where `self` isn't available globally. + +## v2.2.1 + +- Fix: `compress` flag shouldn't overwrite existing `Accept-Encoding` header. +- Fix: multiple `import` rules, where `PassThrough` etc. doesn't have a named export when using node <10 and `--exerimental-modules` flag. +- Other: Better README. + +## v2.2.0 + +- Enhance: Support all `ArrayBuffer` view types +- Enhance: Support Web Workers +- Enhance: Support Node.js' `--experimental-modules` mode; deprecate `.es.js` file +- Fix: Add `__esModule` property to the exports object +- Other: Better example in README for writing response to a file +- Other: More tests for Agent + +## v2.1.2 + +- Fix: allow `Body` methods to work on `ArrayBuffer`-backed `Body` objects +- Fix: reject promise returned by `Body` methods when the accumulated `Buffer` exceeds the maximum size +- Fix: support custom `Host` headers with any casing +- Fix: support importing `fetch()` from TypeScript in `browser.js` +- Fix: handle the redirect response body properly + +## v2.1.1 + +Fix packaging errors in v2.1.0. + +## v2.1.0 + +- Enhance: allow using ArrayBuffer as the `body` of a `fetch()` or `Request` +- Fix: store HTTP headers of a `Headers` object internally with the given case, for compatibility with older servers that incorrectly treated header names in a case-sensitive manner +- Fix: silently ignore invalid HTTP headers +- Fix: handle HTTP redirect responses without a `Location` header just like non-redirect responses +- Fix: include bodies when following a redirection when appropriate + +## v2.0.0 + +This is a major release. Check [our upgrade guide](https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md) for an overview on some key differences between v1 and v2. + +### General changes + +- Major: Node.js 0.10.x and 0.12.x support is dropped +- Major: `require('node-fetch/lib/response')` etc. is now unsupported; use `require('node-fetch').Response` or ES6 module imports +- Enhance: start testing on Node.js v4.x, v6.x, v8.x LTS, as well as v9.x stable +- Enhance: use Rollup to produce a distributed bundle (less memory overhead and faster startup) +- Enhance: make `Object.prototype.toString()` on Headers, Requests, and Responses return correct class strings +- Other: rewrite in ES2015 using Babel +- Other: use Codecov for code coverage tracking +- Other: update package.json script for npm 5 +- Other: `encoding` module is now optional (alpha.7) +- Other: expose browser.js through package.json, avoid bundling mishaps (alpha.9) +- Other: allow TypeScript to `import` node-fetch by exposing default (alpha.9) + +### HTTP requests + +- Major: overwrite user's `Content-Length` if we can be sure our information is correct (per spec) +- Fix: errors in a response are caught before the body is accessed +- Fix: support WHATWG URL objects, created by `whatwg-url` package or `require('url').URL` in Node.js 7+ + +### Response and Request classes + +- Major: `response.text()` no longer attempts to detect encoding, instead always opting for UTF-8 (per spec); use `response.textConverted()` for the v1 behavior +- Major: make `response.json()` throw error instead of returning an empty object on 204 no-content respose (per spec; reverts behavior changed in v1.6.2) +- Major: internal methods are no longer exposed +- Major: throw error when a `GET` or `HEAD` Request is constructed with a non-null body (per spec) +- Enhance: add `response.arrayBuffer()` (also applies to Requests) +- Enhance: add experimental `response.blob()` (also applies to Requests) +- Enhance: `URLSearchParams` is now accepted as a body +- Enhance: wrap `response.json()` json parsing error as `FetchError` +- Fix: fix Request and Response with `null` body + +### Headers class + +- Major: remove `headers.getAll()`; make `get()` return all headers delimited by commas (per spec) +- Enhance: make Headers iterable +- Enhance: make Headers constructor accept an array of tuples +- Enhance: make sure header names and values are valid in HTTP +- Fix: coerce Headers prototype function parameters to strings, where applicable + +### Documentation + +- Enhance: more comprehensive API docs +- Enhance: add a list of default headers in README + + +# 1.x release + +## backport releases (v1.7.0 and beyond) + +See [changelog on 1.x branch](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) for details. + +## v1.6.3 + +- Enhance: error handling document to explain `FetchError` design +- Fix: support `form-data` 2.x releases (requires `form-data` >= 2.1.0) + +## v1.6.2 + +- Enhance: minor document update +- Fix: response.json() returns empty object on 204 no-content response instead of throwing a syntax error + +## v1.6.1 + +- Fix: if `res.body` is a non-stream non-formdata object, we will call `body.toString` and send it as a string +- Fix: `counter` value is incorrectly set to `follow` value when wrapping Request instance +- Fix: documentation update + +## v1.6.0 + +- Enhance: added `res.buffer()` api for convenience, it returns body as a Node.js buffer +- Enhance: better old server support by handling raw deflate response +- Enhance: skip encoding detection for non-HTML/XML response +- Enhance: minor document update +- Fix: HEAD request doesn't need decompression, as body is empty +- Fix: `req.body` now accepts a Node.js buffer + +## v1.5.3 + +- Fix: handle 204 and 304 responses when body is empty but content-encoding is gzip/deflate +- Fix: allow resolving response and cloned response in any order +- Fix: avoid setting `content-length` when `form-data` body use streams +- Fix: send DELETE request with content-length when body is present +- Fix: allow any url when calling new Request, but still reject non-http(s) url in fetch + +## v1.5.2 + +- Fix: allow node.js core to handle keep-alive connection pool when passing a custom agent + +## v1.5.1 + +- Fix: redirect mode `manual` should work even when there is no redirection or broken redirection + +## v1.5.0 + +- Enhance: rejected promise now use custom `Error` (thx to @pekeler) +- Enhance: `FetchError` contains `err.type` and `err.code`, allows for better error handling (thx to @pekeler) +- Enhance: basic support for redirect mode `manual` and `error`, allows for location header extraction (thx to @jimmywarting for the initial PR) + +## v1.4.1 + +- Fix: wrapping Request instance with FormData body again should preserve the body as-is + +## v1.4.0 + +- Enhance: Request and Response now have `clone` method (thx to @kirill-konshin for the initial PR) +- Enhance: Request and Response now have proper string and buffer body support (thx to @kirill-konshin) +- Enhance: Body constructor has been refactored out (thx to @kirill-konshin) +- Enhance: Headers now has `forEach` method (thx to @tricoder42) +- Enhance: back to 100% code coverage +- Fix: better form-data support (thx to @item4) +- Fix: better character encoding detection under chunked encoding (thx to @dsuket for the initial PR) + +## v1.3.3 + +- Fix: make sure `Content-Length` header is set when body is string for POST/PUT/PATCH requests +- Fix: handle body stream error, for cases such as incorrect `Content-Encoding` header +- Fix: when following certain redirects, use `GET` on subsequent request per Fetch Spec +- Fix: `Request` and `Response` constructors now parse headers input using `Headers` + +## v1.3.2 + +- Enhance: allow auto detect of form-data input (no `FormData` spec on node.js, this is form-data specific feature) + +## v1.3.1 + +- Enhance: allow custom host header to be set (server-side only feature, as it's a forbidden header on client-side) + +## v1.3.0 + +- Enhance: now `fetch.Request` is exposed as well + +## v1.2.1 + +- Enhance: `Headers` now normalized `Number` value to `String`, prevent common mistakes + +## v1.2.0 + +- Enhance: now fetch.Headers and fetch.Response are exposed, making testing easier + +## v1.1.2 + +- Fix: `Headers` should only support `String` and `Array` properties, and ignore others + +## v1.1.1 + +- Enhance: now req.headers accept both plain object and `Headers` instance + +## v1.1.0 + +- Enhance: timeout now also applies to response body (in case of slow response) +- Fix: timeout is now cleared properly when fetch is done/has failed + +## v1.0.6 + +- Fix: less greedy content-type charset matching + +## v1.0.5 + +- Fix: when `follow = 0`, fetch should not follow redirect +- Enhance: update tests for better coverage +- Enhance: code formatting +- Enhance: clean up doc + +## v1.0.4 + +- Enhance: test iojs support +- Enhance: timeout attached to socket event only fire once per redirect + +## v1.0.3 + +- Fix: response size limit should reject large chunk +- Enhance: added character encoding detection for xml, such as rss/atom feed (encoding in DTD) + +## v1.0.2 + +- Fix: added res.ok per spec change + +## v1.0.0 + +- Enhance: better test coverage and doc + + +# 0.x release + +## v0.1 + +- Major: initial public release diff --git a/coc/extensions/node_modules/coc-go/node_modules/node-fetch/LICENSE.md b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/LICENSE.md new file mode 100644 index 0000000..660ffec --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/LICENSE.md @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2016 David Frank + +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/coc/extensions/node_modules/coc-go/node_modules/node-fetch/README.md b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/README.md new file mode 100644 index 0000000..2dde742 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/README.md @@ -0,0 +1,590 @@ +node-fetch +========== + +[![npm version][npm-image]][npm-url] +[![build status][travis-image]][travis-url] +[![coverage status][codecov-image]][codecov-url] +[![install size][install-size-image]][install-size-url] +[![Discord][discord-image]][discord-url] + +A light-weight module that brings `window.fetch` to Node.js + +(We are looking for [v2 maintainers and collaborators](https://github.com/bitinn/node-fetch/issues/567)) + +[![Backers][opencollective-image]][opencollective-url] + + + +- [Motivation](#motivation) +- [Features](#features) +- [Difference from client-side fetch](#difference-from-client-side-fetch) +- [Installation](#installation) +- [Loading and configuring the module](#loading-and-configuring-the-module) +- [Common Usage](#common-usage) + - [Plain text or HTML](#plain-text-or-html) + - [JSON](#json) + - [Simple Post](#simple-post) + - [Post with JSON](#post-with-json) + - [Post with form parameters](#post-with-form-parameters) + - [Handling exceptions](#handling-exceptions) + - [Handling client and server errors](#handling-client-and-server-errors) +- [Advanced Usage](#advanced-usage) + - [Streams](#streams) + - [Buffer](#buffer) + - [Accessing Headers and other Meta data](#accessing-headers-and-other-meta-data) + - [Extract Set-Cookie Header](#extract-set-cookie-header) + - [Post data using a file stream](#post-data-using-a-file-stream) + - [Post with form-data (detect multipart)](#post-with-form-data-detect-multipart) + - [Request cancellation with AbortSignal](#request-cancellation-with-abortsignal) +- [API](#api) + - [fetch(url[, options])](#fetchurl-options) + - [Options](#options) + - [Class: Request](#class-request) + - [Class: Response](#class-response) + - [Class: Headers](#class-headers) + - [Interface: Body](#interface-body) + - [Class: FetchError](#class-fetcherror) +- [License](#license) +- [Acknowledgement](#acknowledgement) + + + +## Motivation + +Instead of implementing `XMLHttpRequest` in Node.js to run browser-specific [Fetch polyfill](https://github.com/github/fetch), why not go from native `http` to `fetch` API directly? Hence, `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime. + +See Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) or Leonardo Quixada's [cross-fetch](https://github.com/lquixada/cross-fetch) for isomorphic usage (exports `node-fetch` for server-side, `whatwg-fetch` for client-side). + +## Features + +- Stay consistent with `window.fetch` API. +- Make conscious trade-off when following [WHATWG fetch spec][whatwg-fetch] and [stream spec](https://streams.spec.whatwg.org/) implementation details, document known differences. +- Use native promise but allow substituting it with [insert your favorite promise library]. +- Use native Node streams for body on both request and response. +- Decode content encoding (gzip/deflate) properly and convert string output (such as `res.text()` and `res.json()`) to UTF-8 automatically. +- Useful extensions such as timeout, redirect limit, response size limit, [explicit errors](ERROR-HANDLING.md) for troubleshooting. + +## Difference from client-side fetch + +- See [Known Differences](LIMITS.md) for details. +- If you happen to use a missing feature that `window.fetch` offers, feel free to open an issue. +- Pull requests are welcomed too! + +## Installation + +Current stable release (`2.x`) + +```sh +$ npm install node-fetch +``` + +## Loading and configuring the module +We suggest you load the module via `require` until the stabilization of ES modules in node: +```js +const fetch = require('node-fetch'); +``` + +If you are using a Promise library other than native, set it through `fetch.Promise`: +```js +const Bluebird = require('bluebird'); + +fetch.Promise = Bluebird; +``` + +## Common Usage + +NOTE: The documentation below is up-to-date with `2.x` releases; see the [`1.x` readme](https://github.com/bitinn/node-fetch/blob/1.x/README.md), [changelog](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) and [2.x upgrade guide](UPGRADE-GUIDE.md) for the differences. + +#### Plain text or HTML +```js +fetch('https://github.com/') + .then(res => res.text()) + .then(body => console.log(body)); +``` + +#### JSON + +```js + +fetch('https://api.github.com/users/github') + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Simple Post +```js +fetch('https://httpbin.org/post', { method: 'POST', body: 'a=1' }) + .then(res => res.json()) // expecting a json response + .then(json => console.log(json)); +``` + +#### Post with JSON + +```js +const body = { a: 1 }; + +fetch('https://httpbin.org/post', { + method: 'post', + body: JSON.stringify(body), + headers: { 'Content-Type': 'application/json' }, + }) + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Post with form parameters +`URLSearchParams` is available in Node.js as of v7.5.0. See [official documentation](https://nodejs.org/api/url.html#url_class_urlsearchparams) for more usage methods. + +NOTE: The `Content-Type` header is only set automatically to `x-www-form-urlencoded` when an instance of `URLSearchParams` is given as such: + +```js +const { URLSearchParams } = require('url'); + +const params = new URLSearchParams(); +params.append('a', 1); + +fetch('https://httpbin.org/post', { method: 'POST', body: params }) + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Handling exceptions +NOTE: 3xx-5xx responses are *NOT* exceptions and should be handled in `then()`; see the next section for more information. + +Adding a catch to the fetch promise chain will catch *all* exceptions, such as errors originating from node core libraries, network errors and operational errors, which are instances of FetchError. See the [error handling document](ERROR-HANDLING.md) for more details. + +```js +fetch('https://domain.invalid/') + .catch(err => console.error(err)); +``` + +#### Handling client and server errors +It is common to create a helper function to check that the response contains no client (4xx) or server (5xx) error responses: + +```js +function checkStatus(res) { + if (res.ok) { // res.status >= 200 && res.status < 300 + return res; + } else { + throw MyCustomError(res.statusText); + } +} + +fetch('https://httpbin.org/status/400') + .then(checkStatus) + .then(res => console.log('will not get here...')) +``` + +## Advanced Usage + +#### Streams +The "Node.js way" is to use streams when possible: + +```js +fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') + .then(res => { + const dest = fs.createWriteStream('./octocat.png'); + res.body.pipe(dest); + }); +``` + +#### Buffer +If you prefer to cache binary data in full, use buffer(). (NOTE: `buffer()` is a `node-fetch`-only API) + +```js +const fileType = require('file-type'); + +fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') + .then(res => res.buffer()) + .then(buffer => fileType(buffer)) + .then(type => { /* ... */ }); +``` + +#### Accessing Headers and other Meta data +```js +fetch('https://github.com/') + .then(res => { + console.log(res.ok); + console.log(res.status); + console.log(res.statusText); + console.log(res.headers.raw()); + console.log(res.headers.get('content-type')); + }); +``` + +#### Extract Set-Cookie Header + +Unlike browsers, you can access raw `Set-Cookie` headers manually using `Headers.raw()`. This is a `node-fetch` only API. + +```js +fetch(url).then(res => { + // returns an array of values, instead of a string of comma-separated values + console.log(res.headers.raw()['set-cookie']); +}); +``` + +#### Post data using a file stream + +```js +const { createReadStream } = require('fs'); + +const stream = createReadStream('input.txt'); + +fetch('https://httpbin.org/post', { method: 'POST', body: stream }) + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Post with form-data (detect multipart) + +```js +const FormData = require('form-data'); + +const form = new FormData(); +form.append('a', 1); + +fetch('https://httpbin.org/post', { method: 'POST', body: form }) + .then(res => res.json()) + .then(json => console.log(json)); + +// OR, using custom headers +// NOTE: getHeaders() is non-standard API + +const form = new FormData(); +form.append('a', 1); + +const options = { + method: 'POST', + body: form, + headers: form.getHeaders() +} + +fetch('https://httpbin.org/post', options) + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Request cancellation with AbortSignal + +> NOTE: You may cancel streamed requests only on Node >= v8.0.0 + +You may cancel requests with `AbortController`. A suggested implementation is [`abort-controller`](https://www.npmjs.com/package/abort-controller). + +An example of timing out a request after 150ms could be achieved as the following: + +```js +import AbortController from 'abort-controller'; + +const controller = new AbortController(); +const timeout = setTimeout( + () => { controller.abort(); }, + 150, +); + +fetch(url, { signal: controller.signal }) + .then(res => res.json()) + .then( + data => { + useData(data) + }, + err => { + if (err.name === 'AbortError') { + // request was aborted + } + }, + ) + .finally(() => { + clearTimeout(timeout); + }); +``` + +See [test cases](https://github.com/bitinn/node-fetch/blob/master/test/test.js) for more examples. + + +## API + +### fetch(url[, options]) + +- `url` A string representing the URL for fetching +- `options` [Options](#fetch-options) for the HTTP(S) request +- Returns: Promise<[Response](#class-response)> + +Perform an HTTP(S) fetch. + +`url` should be an absolute url, such as `https://example.com/`. A path-relative URL (`/file/under/root`) or protocol-relative URL (`//can-be-http-or-https.com/`) will result in a rejected `Promise`. + + +### Options + +The default values are shown after each option key. + +```js +{ + // These properties are part of the Fetch Standard + method: 'GET', + headers: {}, // request headers. format is the identical to that accepted by the Headers constructor (see below) + body: null, // request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable stream + redirect: 'follow', // set to `manual` to extract redirect headers, `error` to reject redirect + signal: null, // pass an instance of AbortSignal to optionally abort requests + + // The following properties are node-fetch extensions + follow: 20, // maximum redirect count. 0 to not follow redirect + timeout: 0, // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies). Signal is recommended instead. + compress: true, // support gzip/deflate content encoding. false to disable + size: 0, // maximum response body size in bytes. 0 to disable + agent: null // http(s).Agent instance or function that returns an instance (see below) +} +``` + +##### Default Headers + +If no values are set, the following request headers will be sent automatically: + +Header | Value +------------------- | -------------------------------------------------------- +`Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_ +`Accept` | `*/*` +`Connection` | `close` _(when no `options.agent` is present)_ +`Content-Length` | _(automatically calculated, if possible)_ +`Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_ +`User-Agent` | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)` + +Note: when `body` is a `Stream`, `Content-Length` is not set automatically. + +##### Custom Agent + +The `agent` option allows you to specify networking related options which are out of the scope of Fetch, including and not limited to the following: + +- Support self-signed certificate +- Use only IPv4 or IPv6 +- Custom DNS Lookup + +See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information. + +In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol. + +```js +const httpAgent = new http.Agent({ + keepAlive: true +}); +const httpsAgent = new https.Agent({ + keepAlive: true +}); + +const options = { + agent: function (_parsedURL) { + if (_parsedURL.protocol == 'http:') { + return httpAgent; + } else { + return httpsAgent; + } + } +} +``` + + +### Class: Request + +An HTTP(S) request containing information about URL, method, headers, and the body. This class implements the [Body](#iface-body) interface. + +Due to the nature of Node.js, the following properties are not implemented at this moment: + +- `type` +- `destination` +- `referrer` +- `referrerPolicy` +- `mode` +- `credentials` +- `cache` +- `integrity` +- `keepalive` + +The following node-fetch extension properties are provided: + +- `follow` +- `compress` +- `counter` +- `agent` + +See [options](#fetch-options) for exact meaning of these extensions. + +#### new Request(input[, options]) + +*(spec-compliant)* + +- `input` A string representing a URL, or another `Request` (which will be cloned) +- `options` [Options][#fetch-options] for the HTTP(S) request + +Constructs a new `Request` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). + +In most cases, directly `fetch(url, options)` is simpler than creating a `Request` object. + + +### Class: Response + +An HTTP(S) response. This class implements the [Body](#iface-body) interface. + +The following properties are not implemented in node-fetch at this moment: + +- `Response.error()` +- `Response.redirect()` +- `type` +- `trailer` + +#### new Response([body[, options]]) + +*(spec-compliant)* + +- `body` A `String` or [`Readable` stream][node-readable] +- `options` A [`ResponseInit`][response-init] options dictionary + +Constructs a new `Response` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response). + +Because Node.js does not implement service workers (for which this class was designed), one rarely has to construct a `Response` directly. + +#### response.ok + +*(spec-compliant)* + +Convenience property representing if the request ended normally. Will evaluate to true if the response status was greater than or equal to 200 but smaller than 300. + +#### response.redirected + +*(spec-compliant)* + +Convenience property representing if the request has been redirected at least once. Will evaluate to true if the internal redirect counter is greater than 0. + + +### Class: Headers + +This class allows manipulating and iterating over a set of HTTP headers. All methods specified in the [Fetch Standard][whatwg-fetch] are implemented. + +#### new Headers([init]) + +*(spec-compliant)* + +- `init` Optional argument to pre-fill the `Headers` object + +Construct a new `Headers` object. `init` can be either `null`, a `Headers` object, an key-value map object or any iterable object. + +```js +// Example adapted from https://fetch.spec.whatwg.org/#example-headers-class + +const meta = { + 'Content-Type': 'text/xml', + 'Breaking-Bad': '<3' +}; +const headers = new Headers(meta); + +// The above is equivalent to +const meta = [ + [ 'Content-Type', 'text/xml' ], + [ 'Breaking-Bad', '<3' ] +]; +const headers = new Headers(meta); + +// You can in fact use any iterable objects, like a Map or even another Headers +const meta = new Map(); +meta.set('Content-Type', 'text/xml'); +meta.set('Breaking-Bad', '<3'); +const headers = new Headers(meta); +const copyOfHeaders = new Headers(headers); +``` + + +### Interface: Body + +`Body` is an abstract interface with methods that are applicable to both `Request` and `Response` classes. + +The following methods are not yet implemented in node-fetch at this moment: + +- `formData()` + +#### body.body + +*(deviation from spec)* + +* Node.js [`Readable` stream][node-readable] + +Data are encapsulated in the `Body` object. Note that while the [Fetch Standard][whatwg-fetch] requires the property to always be a WHATWG `ReadableStream`, in node-fetch it is a Node.js [`Readable` stream][node-readable]. + +#### body.bodyUsed + +*(spec-compliant)* + +* `Boolean` + +A boolean property for if this body has been consumed. Per the specs, a consumed body cannot be used again. + +#### body.arrayBuffer() +#### body.blob() +#### body.json() +#### body.text() + +*(spec-compliant)* + +* Returns: Promise + +Consume the body and return a promise that will resolve to one of these formats. + +#### body.buffer() + +*(node-fetch extension)* + +* Returns: Promise<Buffer> + +Consume the body and return a promise that will resolve to a Buffer. + +#### body.textConverted() + +*(node-fetch extension)* + +* Returns: Promise<String> + +Identical to `body.text()`, except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8 if possible. + +(This API requires an optional dependency of the npm package [encoding](https://www.npmjs.com/package/encoding), which you need to install manually. `webpack` users may see [a warning message](https://github.com/bitinn/node-fetch/issues/412#issuecomment-379007792) due to this optional dependency.) + + +### Class: FetchError + +*(node-fetch extension)* + +An operational error in the fetching process. See [ERROR-HANDLING.md][] for more info. + + +### Class: AbortError + +*(node-fetch extension)* + +An Error thrown when the request is aborted in response to an `AbortSignal`'s `abort` event. It has a `name` property of `AbortError`. See [ERROR-HANDLING.MD][] for more info. + +## Acknowledgement + +Thanks to [github/fetch](https://github.com/github/fetch) for providing a solid implementation reference. + +`node-fetch` v1 was maintained by [@bitinn](https://github.com/bitinn); v2 was maintained by [@TimothyGu](https://github.com/timothygu), [@bitinn](https://github.com/bitinn) and [@jimmywarting](https://github.com/jimmywarting); v2 readme is written by [@jkantr](https://github.com/jkantr). + +## License + +MIT + +[npm-image]: https://flat.badgen.net/npm/v/node-fetch +[npm-url]: https://www.npmjs.com/package/node-fetch +[travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch +[travis-url]: https://travis-ci.org/bitinn/node-fetch +[codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master +[codecov-url]: https://codecov.io/gh/bitinn/node-fetch +[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch +[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch +[discord-image]: https://img.shields.io/discord/619915844268326952?color=%237289DA&label=Discord&style=flat-square +[discord-url]: https://discord.gg/Zxbndcm +[opencollective-image]: https://opencollective.com/node-fetch/backers.svg +[opencollective-url]: https://opencollective.com/node-fetch +[whatwg-fetch]: https://fetch.spec.whatwg.org/ +[response-init]: https://fetch.spec.whatwg.org/#responseinit +[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams +[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers +[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md +[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md +[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md diff --git a/coc/extensions/node_modules/coc-go/node_modules/node-fetch/browser.js b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/browser.js new file mode 100644 index 0000000..83c54c5 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/browser.js @@ -0,0 +1,25 @@ +"use strict"; + +// ref: https://github.com/tc39/proposal-global +var getGlobal = function () { + // the only reliable means to get the global object is + // `Function('return this')()` + // However, this causes CSP violations in Chrome apps. + if (typeof self !== 'undefined') { return self; } + if (typeof window !== 'undefined') { return window; } + if (typeof global !== 'undefined') { return global; } + throw new Error('unable to locate global object'); +} + +var global = getGlobal(); + +module.exports = exports = global.fetch; + +// Needed for TypeScript and Webpack. +if (global.fetch) { + exports.default = global.fetch.bind(global); +} + +exports.Headers = global.Headers; +exports.Request = global.Request; +exports.Response = global.Response; \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/node-fetch/lib/index.es.js b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/lib/index.es.js new file mode 100644 index 0000000..61906c9 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/lib/index.es.js @@ -0,0 +1,1640 @@ +process.emitWarning("The .es.js file is deprecated. Use .mjs instead."); + +import Stream from 'stream'; +import http from 'http'; +import Url from 'url'; +import https from 'https'; +import zlib from 'zlib'; + +// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js + +// fix for "Readable" isn't a named export issue +const Readable = Stream.Readable; + +const BUFFER = Symbol('buffer'); +const TYPE = Symbol('type'); + +class Blob { + constructor() { + this[TYPE] = ''; + + const blobParts = arguments[0]; + const options = arguments[1]; + + const buffers = []; + let size = 0; + + if (blobParts) { + const a = blobParts; + const length = Number(a.length); + for (let i = 0; i < length; i++) { + const element = a[i]; + let buffer; + if (element instanceof Buffer) { + buffer = element; + } else if (ArrayBuffer.isView(element)) { + buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); + } else if (element instanceof ArrayBuffer) { + buffer = Buffer.from(element); + } else if (element instanceof Blob) { + buffer = element[BUFFER]; + } else { + buffer = Buffer.from(typeof element === 'string' ? element : String(element)); + } + size += buffer.length; + buffers.push(buffer); + } + } + + this[BUFFER] = Buffer.concat(buffers); + + let type = options && options.type !== undefined && String(options.type).toLowerCase(); + if (type && !/[^\u0020-\u007E]/.test(type)) { + this[TYPE] = type; + } + } + get size() { + return this[BUFFER].length; + } + get type() { + return this[TYPE]; + } + text() { + return Promise.resolve(this[BUFFER].toString()); + } + arrayBuffer() { + const buf = this[BUFFER]; + const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + return Promise.resolve(ab); + } + stream() { + const readable = new Readable(); + readable._read = function () {}; + readable.push(this[BUFFER]); + readable.push(null); + return readable; + } + toString() { + return '[object Blob]'; + } + slice() { + const size = this.size; + + const start = arguments[0]; + const end = arguments[1]; + let relativeStart, relativeEnd; + if (start === undefined) { + relativeStart = 0; + } else if (start < 0) { + relativeStart = Math.max(size + start, 0); + } else { + relativeStart = Math.min(start, size); + } + if (end === undefined) { + relativeEnd = size; + } else if (end < 0) { + relativeEnd = Math.max(size + end, 0); + } else { + relativeEnd = Math.min(end, size); + } + const span = Math.max(relativeEnd - relativeStart, 0); + + const buffer = this[BUFFER]; + const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); + const blob = new Blob([], { type: arguments[2] }); + blob[BUFFER] = slicedBuffer; + return blob; + } +} + +Object.defineProperties(Blob.prototype, { + size: { enumerable: true }, + type: { enumerable: true }, + slice: { enumerable: true } +}); + +Object.defineProperty(Blob.prototype, Symbol.toStringTag, { + value: 'Blob', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * fetch-error.js + * + * FetchError interface for operational errors + */ + +/** + * Create FetchError instance + * + * @param String message Error message for human + * @param String type Error type for machine + * @param String systemError For Node.js system error + * @return FetchError + */ +function FetchError(message, type, systemError) { + Error.call(this, message); + + this.message = message; + this.type = type; + + // when err.type is `system`, err.code contains system error code + if (systemError) { + this.code = this.errno = systemError.code; + } + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +FetchError.prototype = Object.create(Error.prototype); +FetchError.prototype.constructor = FetchError; +FetchError.prototype.name = 'FetchError'; + +let convert; +try { + convert = require('encoding').convert; +} catch (e) {} + +const INTERNALS = Symbol('Body internals'); + +// fix an issue where "PassThrough" isn't a named export for node <10 +const PassThrough = Stream.PassThrough; + +/** + * Body mixin + * + * Ref: https://fetch.spec.whatwg.org/#body + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +function Body(body) { + var _this = this; + + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$size = _ref.size; + + let size = _ref$size === undefined ? 0 : _ref$size; + var _ref$timeout = _ref.timeout; + let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; + + if (body == null) { + // body is undefined or null + body = null; + } else if (isURLSearchParams(body)) { + // body is a URLSearchParams + body = Buffer.from(body.toString()); + } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { + // body is ArrayBuffer + body = Buffer.from(body); + } else if (ArrayBuffer.isView(body)) { + // body is ArrayBufferView + body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); + } else if (body instanceof Stream) ; else { + // none of the above + // coerce to string then buffer + body = Buffer.from(String(body)); + } + this[INTERNALS] = { + body, + disturbed: false, + error: null + }; + this.size = size; + this.timeout = timeout; + + if (body instanceof Stream) { + body.on('error', function (err) { + const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); + _this[INTERNALS].error = error; + }); + } +} + +Body.prototype = { + get body() { + return this[INTERNALS].body; + }, + + get bodyUsed() { + return this[INTERNALS].disturbed; + }, + + /** + * Decode response as ArrayBuffer + * + * @return Promise + */ + arrayBuffer() { + return consumeBody.call(this).then(function (buf) { + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + }); + }, + + /** + * Return raw response as Blob + * + * @return Promise + */ + blob() { + let ct = this.headers && this.headers.get('content-type') || ''; + return consumeBody.call(this).then(function (buf) { + return Object.assign( + // Prevent copying + new Blob([], { + type: ct.toLowerCase() + }), { + [BUFFER]: buf + }); + }); + }, + + /** + * Decode response as json + * + * @return Promise + */ + json() { + var _this2 = this; + + return consumeBody.call(this).then(function (buffer) { + try { + return JSON.parse(buffer.toString()); + } catch (err) { + return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); + } + }); + }, + + /** + * Decode response as text + * + * @return Promise + */ + text() { + return consumeBody.call(this).then(function (buffer) { + return buffer.toString(); + }); + }, + + /** + * Decode response as buffer (non-spec api) + * + * @return Promise + */ + buffer() { + return consumeBody.call(this); + }, + + /** + * Decode response as text, while automatically detecting the encoding and + * trying to decode to UTF-8 (non-spec api) + * + * @return Promise + */ + textConverted() { + var _this3 = this; + + return consumeBody.call(this).then(function (buffer) { + return convertBody(buffer, _this3.headers); + }); + } +}; + +// In browsers, all properties are enumerable. +Object.defineProperties(Body.prototype, { + body: { enumerable: true }, + bodyUsed: { enumerable: true }, + arrayBuffer: { enumerable: true }, + blob: { enumerable: true }, + json: { enumerable: true }, + text: { enumerable: true } +}); + +Body.mixIn = function (proto) { + for (const name of Object.getOwnPropertyNames(Body.prototype)) { + // istanbul ignore else: future proof + if (!(name in proto)) { + const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); + Object.defineProperty(proto, name, desc); + } + } +}; + +/** + * Consume and convert an entire Body to a Buffer. + * + * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body + * + * @return Promise + */ +function consumeBody() { + var _this4 = this; + + if (this[INTERNALS].disturbed) { + return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); + } + + this[INTERNALS].disturbed = true; + + if (this[INTERNALS].error) { + return Body.Promise.reject(this[INTERNALS].error); + } + + let body = this.body; + + // body is null + if (body === null) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is blob + if (isBlob(body)) { + body = body.stream(); + } + + // body is buffer + if (Buffer.isBuffer(body)) { + return Body.Promise.resolve(body); + } + + // istanbul ignore if: should never happen + if (!(body instanceof Stream)) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is stream + // get ready to actually consume the body + let accum = []; + let accumBytes = 0; + let abort = false; + + return new Body.Promise(function (resolve, reject) { + let resTimeout; + + // allow timeout on slow response body + if (_this4.timeout) { + resTimeout = setTimeout(function () { + abort = true; + reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); + }, _this4.timeout); + } + + // handle stream errors + body.on('error', function (err) { + if (err.name === 'AbortError') { + // if the request was aborted, reject with this Error + abort = true; + reject(err); + } else { + // other errors, such as incorrect content-encoding + reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + + body.on('data', function (chunk) { + if (abort || chunk === null) { + return; + } + + if (_this4.size && accumBytes + chunk.length > _this4.size) { + abort = true; + reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); + return; + } + + accumBytes += chunk.length; + accum.push(chunk); + }); + + body.on('end', function () { + if (abort) { + return; + } + + clearTimeout(resTimeout); + + try { + resolve(Buffer.concat(accum, accumBytes)); + } catch (err) { + // handle streams that have accumulated too much data (issue #414) + reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + }); +} + +/** + * Detect buffer encoding and convert to target encoding + * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding + * + * @param Buffer buffer Incoming buffer + * @param String encoding Target encoding + * @return String + */ +function convertBody(buffer, headers) { + if (typeof convert !== 'function') { + throw new Error('The package `encoding` must be installed to use the textConverted() function'); + } + + const ct = headers.get('content-type'); + let charset = 'utf-8'; + let res, str; + + // header + if (ct) { + res = /charset=([^;]*)/i.exec(ct); + } + + // no charset in content type, peek at response body for at most 1024 bytes + str = buffer.slice(0, 1024).toString(); + + // html5 + if (!res && str) { + res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; + + this[MAP] = Object.create(null); + + if (init instanceof Headers) { + const rawHeaders = init.raw(); + const headerNames = Object.keys(rawHeaders); + + for (const headerName of headerNames) { + for (const value of rawHeaders[headerName]) { + this.append(headerName, value); + } + } + + return; + } + + // We don't worry about converting prop to ByteString here as append() + // will handle it. + if (init == null) ; else if (typeof init === 'object') { + const method = init[Symbol.iterator]; + if (method != null) { + if (typeof method !== 'function') { + throw new TypeError('Header pairs must be iterable'); + } + + // sequence> + // Note: per spec we have to first exhaust the lists then process them + const pairs = []; + for (const pair of init) { + if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { + throw new TypeError('Each header pair must be iterable'); + } + pairs.push(Array.from(pair)); + } + + for (const pair of pairs) { + if (pair.length !== 2) { + throw new TypeError('Each header pair must be a name/value tuple'); + } + this.append(pair[0], pair[1]); + } + } else { + // record + for (const key of Object.keys(init)) { + const value = init[key]; + this.append(key, value); + } + } + } else { + throw new TypeError('Provided initializer must be an object'); + } + } + + /** + * Return combined header value given name + * + * @param String name Header name + * @return Mixed + */ + get(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key === undefined) { + return null; + } + + return this[MAP][key].join(', '); + } + + /** + * Iterate over all headers + * + * @param Function callback Executed for each item with parameters (value, name, thisArg) + * @param Boolean thisArg `this` context for callback function + * @return Void + */ + forEach(callback) { + let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; + + let pairs = getHeaders(this); + let i = 0; + while (i < pairs.length) { + var _pairs$i = pairs[i]; + const name = _pairs$i[0], + value = _pairs$i[1]; + + callback.call(thisArg, value, name, this); + pairs = getHeaders(this); + i++; + } + } + + /** + * Overwrite header values given name + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + set(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + this[MAP][key !== undefined ? key : name] = [value]; + } + + /** + * Append a value onto existing header + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + append(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + if (key !== undefined) { + this[MAP][key].push(value); + } else { + this[MAP][name] = [value]; + } + } + + /** + * Check for header name existence + * + * @param String name Header name + * @return Boolean + */ + has(name) { + name = `${name}`; + validateName(name); + return find(this[MAP], name) !== undefined; + } + + /** + * Delete all header values given name + * + * @param String name Header name + * @return Void + */ + delete(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key !== undefined) { + delete this[MAP][key]; + } + } + + /** + * Return raw headers (non-spec api) + * + * @return Object + */ + raw() { + return this[MAP]; + } + + /** + * Get an iterator on keys. + * + * @return Iterator + */ + keys() { + return createHeadersIterator(this, 'key'); + } + + /** + * Get an iterator on values. + * + * @return Iterator + */ + values() { + return createHeadersIterator(this, 'value'); + } + + /** + * Get an iterator on entries. + * + * This is the default iterator of the Headers object. + * + * @return Iterator + */ + [Symbol.iterator]() { + return createHeadersIterator(this, 'key+value'); + } +} +Headers.prototype.entries = Headers.prototype[Symbol.iterator]; + +Object.defineProperty(Headers.prototype, Symbol.toStringTag, { + value: 'Headers', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Headers.prototype, { + get: { enumerable: true }, + forEach: { enumerable: true }, + set: { enumerable: true }, + append: { enumerable: true }, + has: { enumerable: true }, + delete: { enumerable: true }, + keys: { enumerable: true }, + values: { enumerable: true }, + entries: { enumerable: true } +}); + +function getHeaders(headers) { + let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; + + const keys = Object.keys(headers[MAP]).sort(); + return keys.map(kind === 'key' ? function (k) { + return k.toLowerCase(); + } : kind === 'value' ? function (k) { + return headers[MAP][k].join(', '); + } : function (k) { + return [k.toLowerCase(), headers[MAP][k].join(', ')]; + }); +} + +const INTERNAL = Symbol('internal'); + +function createHeadersIterator(target, kind) { + const iterator = Object.create(HeadersIteratorPrototype); + iterator[INTERNAL] = { + target, + kind, + index: 0 + }; + return iterator; +} + +const HeadersIteratorPrototype = Object.setPrototypeOf({ + next() { + // istanbul ignore if + if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { + throw new TypeError('Value of `this` is not a HeadersIterator'); + } + + var _INTERNAL = this[INTERNAL]; + const target = _INTERNAL.target, + kind = _INTERNAL.kind, + index = _INTERNAL.index; + + const values = getHeaders(target, kind); + const len = values.length; + if (index >= len) { + return { + value: undefined, + done: true + }; + } + + this[INTERNAL].index = index + 1; + + return { + value: values[index], + done: false + }; + } +}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); + +Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { + value: 'HeadersIterator', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * Export the Headers object in a form that Node.js can consume. + * + * @param Headers headers + * @return Object + */ +function exportNodeCompatibleHeaders(headers) { + const obj = Object.assign({ __proto__: null }, headers[MAP]); + + // http.request() only supports string as Host header. This hack makes + // specifying custom Host header possible. + const hostHeaderKey = find(headers[MAP], 'Host'); + if (hostHeaderKey !== undefined) { + obj[hostHeaderKey] = obj[hostHeaderKey][0]; + } + + return obj; +} + +/** + * Create a Headers object from an object of headers, ignoring those that do + * not conform to HTTP grammar productions. + * + * @param Object obj Object of headers + * @return Headers + */ +function createHeadersLenient(obj) { + const headers = new Headers(); + for (const name of Object.keys(obj)) { + if (invalidTokenRegex.test(name)) { + continue; + } + if (Array.isArray(obj[name])) { + for (const val of obj[name]) { + if (invalidHeaderCharRegex.test(val)) { + continue; + } + if (headers[MAP][name] === undefined) { + headers[MAP][name] = [val]; + } else { + headers[MAP][name].push(val); + } + } + } else if (!invalidHeaderCharRegex.test(obj[name])) { + headers[MAP][name] = [obj[name]]; + } + } + return headers; +} + +const INTERNALS$1 = Symbol('Response internals'); + +// fix an issue where "STATUS_CODES" aren't a named export for node <10 +const STATUS_CODES = http.STATUS_CODES; + +/** + * Response class + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +class Response { + constructor() { + let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + Body.call(this, body, opts); + + const status = opts.status || 200; + const headers = new Headers(opts.headers); + + if (body != null && !headers.has('Content-Type')) { + const contentType = extractContentType(body); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + this[INTERNALS$1] = { + url: opts.url, + status, + statusText: opts.statusText || STATUS_CODES[status], + headers, + counter: opts.counter + }; + } + + get url() { + return this[INTERNALS$1].url || ''; + } + + get status() { + return this[INTERNALS$1].status; + } + + /** + * Convenience property representing if the request ended normally + */ + get ok() { + return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; + } + + get redirected() { + return this[INTERNALS$1].counter > 0; + } + + get statusText() { + return this[INTERNALS$1].statusText; + } + + get headers() { + return this[INTERNALS$1].headers; + } + + /** + * Clone this response + * + * @return Response + */ + clone() { + return new Response(clone(this), { + url: this.url, + status: this.status, + statusText: this.statusText, + headers: this.headers, + ok: this.ok, + redirected: this.redirected + }); + } +} + +Body.mixIn(Response.prototype); + +Object.defineProperties(Response.prototype, { + url: { enumerable: true }, + status: { enumerable: true }, + ok: { enumerable: true }, + redirected: { enumerable: true }, + statusText: { enumerable: true }, + headers: { enumerable: true }, + clone: { enumerable: true } +}); + +Object.defineProperty(Response.prototype, Symbol.toStringTag, { + value: 'Response', + writable: false, + enumerable: false, + configurable: true +}); + +const INTERNALS$2 = Symbol('Request internals'); + +// fix an issue where "format", "parse" aren't a named export for node <10 +const parse_url = Url.parse; +const format_url = Url.format; + +const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; + +/** + * Check if a value is an instance of Request. + * + * @param Mixed input + * @return Boolean + */ +function isRequest(input) { + return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; +} + +function isAbortSignal(signal) { + const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); + return !!(proto && proto.constructor.name === 'AbortSignal'); +} + +/** + * Request class + * + * @param Mixed input Url or Request instance + * @param Object init Custom options + * @return Void + */ +class Request { + constructor(input) { + let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + let parsedURL; + + // normalize input + if (!isRequest(input)) { + if (input && input.href) { + // in order to support Node.js' Url objects; though WHATWG's URL objects + // will fall into this branch also (since their `toString()` will return + // `href` property anyway) + parsedURL = parse_url(input.href); + } else { + // coerce input to a string before attempting to parse + parsedURL = parse_url(`${input}`); + } + input = {}; + } else { + parsedURL = parse_url(input.url); + } + + let method = init.method || input.method || 'GET'; + method = method.toUpperCase(); + + if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { + throw new TypeError('Request with GET/HEAD method cannot have body'); + } + + let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; + + Body.call(this, inputBody, { + timeout: init.timeout || input.timeout || 0, + size: init.size || input.size || 0 + }); + + const headers = new Headers(init.headers || input.headers || {}); + + if (inputBody != null && !headers.has('Content-Type')) { + const contentType = extractContentType(inputBody); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + let signal = isRequest(input) ? input.signal : null; + if ('signal' in init) signal = init.signal; + + if (signal != null && !isAbortSignal(signal)) { + throw new TypeError('Expected signal to be an instanceof AbortSignal'); + } + + this[INTERNALS$2] = { + method, + redirect: init.redirect || input.redirect || 'follow', + headers, + parsedURL, + signal + }; + + // node-fetch-only options + this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; + this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; + this.counter = init.counter || input.counter || 0; + this.agent = init.agent || input.agent; + } + + get method() { + return this[INTERNALS$2].method; + } + + get url() { + return format_url(this[INTERNALS$2].parsedURL); + } + + get headers() { + return this[INTERNALS$2].headers; + } + + get redirect() { + return this[INTERNALS$2].redirect; + } + + get signal() { + return this[INTERNALS$2].signal; + } + + /** + * Clone this request + * + * @return Request + */ + clone() { + return new Request(this); + } +} + +Body.mixIn(Request.prototype); + +Object.defineProperty(Request.prototype, Symbol.toStringTag, { + value: 'Request', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Request.prototype, { + method: { enumerable: true }, + url: { enumerable: true }, + headers: { enumerable: true }, + redirect: { enumerable: true }, + clone: { enumerable: true }, + signal: { enumerable: true } +}); + +/** + * Convert a Request to Node.js http request options. + * + * @param Request A Request instance + * @return Object The options object to be passed to http.request + */ +function getNodeRequestOptions(request) { + const parsedURL = request[INTERNALS$2].parsedURL; + const headers = new Headers(request[INTERNALS$2].headers); + + // fetch step 1.3 + if (!headers.has('Accept')) { + headers.set('Accept', '*/*'); + } + + // Basic fetch + if (!parsedURL.protocol || !parsedURL.hostname) { + throw new TypeError('Only absolute URLs are supported'); + } + + if (!/^https?:$/.test(parsedURL.protocol)) { + throw new TypeError('Only HTTP(S) protocols are supported'); + } + + if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { + throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); + } + + // HTTP-network-or-cache fetch steps 2.4-2.7 + let contentLengthValue = null; + if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { + contentLengthValue = '0'; + } + if (request.body != null) { + const totalBytes = getTotalBytes(request); + if (typeof totalBytes === 'number') { + contentLengthValue = String(totalBytes); + } + } + if (contentLengthValue) { + headers.set('Content-Length', contentLengthValue); + } + + // HTTP-network-or-cache fetch step 2.11 + if (!headers.has('User-Agent')) { + headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); + } + + // HTTP-network-or-cache fetch step 2.15 + if (request.compress && !headers.has('Accept-Encoding')) { + headers.set('Accept-Encoding', 'gzip,deflate'); + } + + let agent = request.agent; + if (typeof agent === 'function') { + agent = agent(parsedURL); + } + + if (!headers.has('Connection') && !agent) { + headers.set('Connection', 'close'); + } + + // HTTP-network fetch step 4.2 + // chunked encoding is handled by Node.js + + return Object.assign({}, parsedURL, { + method: request.method, + headers: exportNodeCompatibleHeaders(headers), + agent + }); +} + +/** + * abort-error.js + * + * AbortError interface for cancelled requests + */ + +/** + * Create AbortError instance + * + * @param String message Error message for human + * @return AbortError + */ +function AbortError(message) { + Error.call(this, message); + + this.type = 'aborted'; + this.message = message; + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +AbortError.prototype = Object.create(Error.prototype); +AbortError.prototype.constructor = AbortError; +AbortError.prototype.name = 'AbortError'; + +// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 +const PassThrough$1 = Stream.PassThrough; +const resolve_url = Url.resolve; + +/** + * Fetch function + * + * @param Mixed url Absolute url or Request instance + * @param Object opts Fetch options + * @return Promise + */ +function fetch(url, opts) { + + // allow custom promise + if (!fetch.Promise) { + throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); + } + + Body.Promise = fetch.Promise; + + // wrap http.request into fetch + return new fetch.Promise(function (resolve, reject) { + // build request object + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); + + const send = (options.protocol === 'https:' ? https : http).request; + const signal = request.signal; + + let response = null; + + const abort = function abort() { + let error = new AbortError('The user aborted a request.'); + reject(error); + if (request.body && request.body instanceof Stream.Readable) { + request.body.destroy(error); + } + if (!response || !response.body) return; + response.body.emit('error', error); + }; + + if (signal && signal.aborted) { + abort(); + return; + } + + const abortAndFinalize = function abortAndFinalize() { + abort(); + finalize(); + }; + + // send request + const req = send(options); + let reqTimeout; + + if (signal) { + signal.addEventListener('abort', abortAndFinalize); + } + + function finalize() { + req.abort(); + if (signal) signal.removeEventListener('abort', abortAndFinalize); + clearTimeout(reqTimeout); + } + + if (request.timeout) { + req.once('socket', function (socket) { + reqTimeout = setTimeout(function () { + reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); + finalize(); + }, request.timeout); + }); + } + + req.on('error', function (err) { + reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); + finalize(); + }); + + req.on('response', function (res) { + clearTimeout(reqTimeout); + + const headers = createHeadersLenient(res.headers); + + // HTTP fetch step 5 + if (fetch.isRedirect(res.statusCode)) { + // HTTP fetch step 5.2 + const location = headers.get('Location'); + + // HTTP fetch step 5.3 + const locationURL = location === null ? null : resolve_url(request.url, location); + + // HTTP fetch step 5.5 + switch (request.redirect) { + case 'error': + reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); + finalize(); + return; + case 'manual': + // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. + if (locationURL !== null) { + // handle corrupted header + try { + headers.set('Location', locationURL); + } catch (err) { + // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request + reject(err); + } + } + break; + case 'follow': + // HTTP-redirect fetch step 2 + if (locationURL === null) { + break; + } + + // HTTP-redirect fetch step 5 + if (request.counter >= request.follow) { + reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 6 (counter increment) + // Create a new Request object. + const requestOpts = { + headers: new Headers(request.headers), + follow: request.follow, + counter: request.counter + 1, + agent: request.agent, + compress: request.compress, + method: request.method, + body: request.body, + signal: request.signal, + timeout: request.timeout, + size: request.size + }; + + // HTTP-redirect fetch step 9 + if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { + reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 11 + if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { + requestOpts.method = 'GET'; + requestOpts.body = undefined; + requestOpts.headers.delete('content-length'); + } + + // HTTP-redirect fetch step 15 + resolve(fetch(new Request(locationURL, requestOpts))); + finalize(); + return; + } + } + + // prepare response + res.once('end', function () { + if (signal) signal.removeEventListener('abort', abortAndFinalize); + }); + let body = res.pipe(new PassThrough$1()); + + const response_options = { + url: request.url, + status: res.statusCode, + statusText: res.statusMessage, + headers: headers, + size: request.size, + timeout: request.timeout, + counter: request.counter + }; + + // HTTP-network fetch step 12.1.1.3 + const codings = headers.get('Content-Encoding'); + + // HTTP-network fetch step 12.1.1.4: handle content codings + + // in following scenarios we ignore compression support + // 1. compression support is disabled + // 2. HEAD request + // 3. no Content-Encoding header + // 4. no content response (204) + // 5. content not modified response (304) + if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { + response = new Response(body, response_options); + resolve(response); + return; + } + + // For Node v6+ + // Be less strict when decoding compressed responses, since sometimes + // servers send slightly invalid responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + const zlibOptions = { + flush: zlib.Z_SYNC_FLUSH, + finishFlush: zlib.Z_SYNC_FLUSH + }; + + // for gzip + if (codings == 'gzip' || codings == 'x-gzip') { + body = body.pipe(zlib.createGunzip(zlibOptions)); + response = new Response(body, response_options); + resolve(response); + return; + } + + // for deflate + if (codings == 'deflate' || codings == 'x-deflate') { + // handle the infamous raw deflate response from old servers + // a hack for old IIS and Apache servers + const raw = res.pipe(new PassThrough$1()); + raw.once('data', function (chunk) { + // see http://stackoverflow.com/questions/37519828 + if ((chunk[0] & 0x0F) === 0x08) { + body = body.pipe(zlib.createInflate()); + } else { + body = body.pipe(zlib.createInflateRaw()); + } + response = new Response(body, response_options); + resolve(response); + }); + return; + } + + // for br + if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { + body = body.pipe(zlib.createBrotliDecompress()); + response = new Response(body, response_options); + resolve(response); + return; + } + + // otherwise, use response as-is + response = new Response(body, response_options); + resolve(response); + }); + + writeToStream(req, request); + }); +} +/** + * Redirect code matching + * + * @param Number code Status code + * @return Boolean + */ +fetch.isRedirect = function (code) { + return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; +}; + +// expose Promise +fetch.Promise = global.Promise; + +export default fetch; +export { Headers, Request, Response, FetchError }; diff --git a/coc/extensions/node_modules/coc-go/node_modules/node-fetch/lib/index.js b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/lib/index.js new file mode 100644 index 0000000..4b241bf --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/lib/index.js @@ -0,0 +1,1649 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var Stream = _interopDefault(require('stream')); +var http = _interopDefault(require('http')); +var Url = _interopDefault(require('url')); +var https = _interopDefault(require('https')); +var zlib = _interopDefault(require('zlib')); + +// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js + +// fix for "Readable" isn't a named export issue +const Readable = Stream.Readable; + +const BUFFER = Symbol('buffer'); +const TYPE = Symbol('type'); + +class Blob { + constructor() { + this[TYPE] = ''; + + const blobParts = arguments[0]; + const options = arguments[1]; + + const buffers = []; + let size = 0; + + if (blobParts) { + const a = blobParts; + const length = Number(a.length); + for (let i = 0; i < length; i++) { + const element = a[i]; + let buffer; + if (element instanceof Buffer) { + buffer = element; + } else if (ArrayBuffer.isView(element)) { + buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); + } else if (element instanceof ArrayBuffer) { + buffer = Buffer.from(element); + } else if (element instanceof Blob) { + buffer = element[BUFFER]; + } else { + buffer = Buffer.from(typeof element === 'string' ? element : String(element)); + } + size += buffer.length; + buffers.push(buffer); + } + } + + this[BUFFER] = Buffer.concat(buffers); + + let type = options && options.type !== undefined && String(options.type).toLowerCase(); + if (type && !/[^\u0020-\u007E]/.test(type)) { + this[TYPE] = type; + } + } + get size() { + return this[BUFFER].length; + } + get type() { + return this[TYPE]; + } + text() { + return Promise.resolve(this[BUFFER].toString()); + } + arrayBuffer() { + const buf = this[BUFFER]; + const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + return Promise.resolve(ab); + } + stream() { + const readable = new Readable(); + readable._read = function () {}; + readable.push(this[BUFFER]); + readable.push(null); + return readable; + } + toString() { + return '[object Blob]'; + } + slice() { + const size = this.size; + + const start = arguments[0]; + const end = arguments[1]; + let relativeStart, relativeEnd; + if (start === undefined) { + relativeStart = 0; + } else if (start < 0) { + relativeStart = Math.max(size + start, 0); + } else { + relativeStart = Math.min(start, size); + } + if (end === undefined) { + relativeEnd = size; + } else if (end < 0) { + relativeEnd = Math.max(size + end, 0); + } else { + relativeEnd = Math.min(end, size); + } + const span = Math.max(relativeEnd - relativeStart, 0); + + const buffer = this[BUFFER]; + const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); + const blob = new Blob([], { type: arguments[2] }); + blob[BUFFER] = slicedBuffer; + return blob; + } +} + +Object.defineProperties(Blob.prototype, { + size: { enumerable: true }, + type: { enumerable: true }, + slice: { enumerable: true } +}); + +Object.defineProperty(Blob.prototype, Symbol.toStringTag, { + value: 'Blob', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * fetch-error.js + * + * FetchError interface for operational errors + */ + +/** + * Create FetchError instance + * + * @param String message Error message for human + * @param String type Error type for machine + * @param String systemError For Node.js system error + * @return FetchError + */ +function FetchError(message, type, systemError) { + Error.call(this, message); + + this.message = message; + this.type = type; + + // when err.type is `system`, err.code contains system error code + if (systemError) { + this.code = this.errno = systemError.code; + } + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +FetchError.prototype = Object.create(Error.prototype); +FetchError.prototype.constructor = FetchError; +FetchError.prototype.name = 'FetchError'; + +let convert; +try { + convert = require('encoding').convert; +} catch (e) {} + +const INTERNALS = Symbol('Body internals'); + +// fix an issue where "PassThrough" isn't a named export for node <10 +const PassThrough = Stream.PassThrough; + +/** + * Body mixin + * + * Ref: https://fetch.spec.whatwg.org/#body + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +function Body(body) { + var _this = this; + + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$size = _ref.size; + + let size = _ref$size === undefined ? 0 : _ref$size; + var _ref$timeout = _ref.timeout; + let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; + + if (body == null) { + // body is undefined or null + body = null; + } else if (isURLSearchParams(body)) { + // body is a URLSearchParams + body = Buffer.from(body.toString()); + } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { + // body is ArrayBuffer + body = Buffer.from(body); + } else if (ArrayBuffer.isView(body)) { + // body is ArrayBufferView + body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); + } else if (body instanceof Stream) ; else { + // none of the above + // coerce to string then buffer + body = Buffer.from(String(body)); + } + this[INTERNALS] = { + body, + disturbed: false, + error: null + }; + this.size = size; + this.timeout = timeout; + + if (body instanceof Stream) { + body.on('error', function (err) { + const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); + _this[INTERNALS].error = error; + }); + } +} + +Body.prototype = { + get body() { + return this[INTERNALS].body; + }, + + get bodyUsed() { + return this[INTERNALS].disturbed; + }, + + /** + * Decode response as ArrayBuffer + * + * @return Promise + */ + arrayBuffer() { + return consumeBody.call(this).then(function (buf) { + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + }); + }, + + /** + * Return raw response as Blob + * + * @return Promise + */ + blob() { + let ct = this.headers && this.headers.get('content-type') || ''; + return consumeBody.call(this).then(function (buf) { + return Object.assign( + // Prevent copying + new Blob([], { + type: ct.toLowerCase() + }), { + [BUFFER]: buf + }); + }); + }, + + /** + * Decode response as json + * + * @return Promise + */ + json() { + var _this2 = this; + + return consumeBody.call(this).then(function (buffer) { + try { + return JSON.parse(buffer.toString()); + } catch (err) { + return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); + } + }); + }, + + /** + * Decode response as text + * + * @return Promise + */ + text() { + return consumeBody.call(this).then(function (buffer) { + return buffer.toString(); + }); + }, + + /** + * Decode response as buffer (non-spec api) + * + * @return Promise + */ + buffer() { + return consumeBody.call(this); + }, + + /** + * Decode response as text, while automatically detecting the encoding and + * trying to decode to UTF-8 (non-spec api) + * + * @return Promise + */ + textConverted() { + var _this3 = this; + + return consumeBody.call(this).then(function (buffer) { + return convertBody(buffer, _this3.headers); + }); + } +}; + +// In browsers, all properties are enumerable. +Object.defineProperties(Body.prototype, { + body: { enumerable: true }, + bodyUsed: { enumerable: true }, + arrayBuffer: { enumerable: true }, + blob: { enumerable: true }, + json: { enumerable: true }, + text: { enumerable: true } +}); + +Body.mixIn = function (proto) { + for (const name of Object.getOwnPropertyNames(Body.prototype)) { + // istanbul ignore else: future proof + if (!(name in proto)) { + const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); + Object.defineProperty(proto, name, desc); + } + } +}; + +/** + * Consume and convert an entire Body to a Buffer. + * + * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body + * + * @return Promise + */ +function consumeBody() { + var _this4 = this; + + if (this[INTERNALS].disturbed) { + return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); + } + + this[INTERNALS].disturbed = true; + + if (this[INTERNALS].error) { + return Body.Promise.reject(this[INTERNALS].error); + } + + let body = this.body; + + // body is null + if (body === null) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is blob + if (isBlob(body)) { + body = body.stream(); + } + + // body is buffer + if (Buffer.isBuffer(body)) { + return Body.Promise.resolve(body); + } + + // istanbul ignore if: should never happen + if (!(body instanceof Stream)) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is stream + // get ready to actually consume the body + let accum = []; + let accumBytes = 0; + let abort = false; + + return new Body.Promise(function (resolve, reject) { + let resTimeout; + + // allow timeout on slow response body + if (_this4.timeout) { + resTimeout = setTimeout(function () { + abort = true; + reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); + }, _this4.timeout); + } + + // handle stream errors + body.on('error', function (err) { + if (err.name === 'AbortError') { + // if the request was aborted, reject with this Error + abort = true; + reject(err); + } else { + // other errors, such as incorrect content-encoding + reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + + body.on('data', function (chunk) { + if (abort || chunk === null) { + return; + } + + if (_this4.size && accumBytes + chunk.length > _this4.size) { + abort = true; + reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); + return; + } + + accumBytes += chunk.length; + accum.push(chunk); + }); + + body.on('end', function () { + if (abort) { + return; + } + + clearTimeout(resTimeout); + + try { + resolve(Buffer.concat(accum, accumBytes)); + } catch (err) { + // handle streams that have accumulated too much data (issue #414) + reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + }); +} + +/** + * Detect buffer encoding and convert to target encoding + * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding + * + * @param Buffer buffer Incoming buffer + * @param String encoding Target encoding + * @return String + */ +function convertBody(buffer, headers) { + if (typeof convert !== 'function') { + throw new Error('The package `encoding` must be installed to use the textConverted() function'); + } + + const ct = headers.get('content-type'); + let charset = 'utf-8'; + let res, str; + + // header + if (ct) { + res = /charset=([^;]*)/i.exec(ct); + } + + // no charset in content type, peek at response body for at most 1024 bytes + str = buffer.slice(0, 1024).toString(); + + // html5 + if (!res && str) { + res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; + + this[MAP] = Object.create(null); + + if (init instanceof Headers) { + const rawHeaders = init.raw(); + const headerNames = Object.keys(rawHeaders); + + for (const headerName of headerNames) { + for (const value of rawHeaders[headerName]) { + this.append(headerName, value); + } + } + + return; + } + + // We don't worry about converting prop to ByteString here as append() + // will handle it. + if (init == null) ; else if (typeof init === 'object') { + const method = init[Symbol.iterator]; + if (method != null) { + if (typeof method !== 'function') { + throw new TypeError('Header pairs must be iterable'); + } + + // sequence> + // Note: per spec we have to first exhaust the lists then process them + const pairs = []; + for (const pair of init) { + if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { + throw new TypeError('Each header pair must be iterable'); + } + pairs.push(Array.from(pair)); + } + + for (const pair of pairs) { + if (pair.length !== 2) { + throw new TypeError('Each header pair must be a name/value tuple'); + } + this.append(pair[0], pair[1]); + } + } else { + // record + for (const key of Object.keys(init)) { + const value = init[key]; + this.append(key, value); + } + } + } else { + throw new TypeError('Provided initializer must be an object'); + } + } + + /** + * Return combined header value given name + * + * @param String name Header name + * @return Mixed + */ + get(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key === undefined) { + return null; + } + + return this[MAP][key].join(', '); + } + + /** + * Iterate over all headers + * + * @param Function callback Executed for each item with parameters (value, name, thisArg) + * @param Boolean thisArg `this` context for callback function + * @return Void + */ + forEach(callback) { + let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; + + let pairs = getHeaders(this); + let i = 0; + while (i < pairs.length) { + var _pairs$i = pairs[i]; + const name = _pairs$i[0], + value = _pairs$i[1]; + + callback.call(thisArg, value, name, this); + pairs = getHeaders(this); + i++; + } + } + + /** + * Overwrite header values given name + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + set(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + this[MAP][key !== undefined ? key : name] = [value]; + } + + /** + * Append a value onto existing header + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + append(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + if (key !== undefined) { + this[MAP][key].push(value); + } else { + this[MAP][name] = [value]; + } + } + + /** + * Check for header name existence + * + * @param String name Header name + * @return Boolean + */ + has(name) { + name = `${name}`; + validateName(name); + return find(this[MAP], name) !== undefined; + } + + /** + * Delete all header values given name + * + * @param String name Header name + * @return Void + */ + delete(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key !== undefined) { + delete this[MAP][key]; + } + } + + /** + * Return raw headers (non-spec api) + * + * @return Object + */ + raw() { + return this[MAP]; + } + + /** + * Get an iterator on keys. + * + * @return Iterator + */ + keys() { + return createHeadersIterator(this, 'key'); + } + + /** + * Get an iterator on values. + * + * @return Iterator + */ + values() { + return createHeadersIterator(this, 'value'); + } + + /** + * Get an iterator on entries. + * + * This is the default iterator of the Headers object. + * + * @return Iterator + */ + [Symbol.iterator]() { + return createHeadersIterator(this, 'key+value'); + } +} +Headers.prototype.entries = Headers.prototype[Symbol.iterator]; + +Object.defineProperty(Headers.prototype, Symbol.toStringTag, { + value: 'Headers', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Headers.prototype, { + get: { enumerable: true }, + forEach: { enumerable: true }, + set: { enumerable: true }, + append: { enumerable: true }, + has: { enumerable: true }, + delete: { enumerable: true }, + keys: { enumerable: true }, + values: { enumerable: true }, + entries: { enumerable: true } +}); + +function getHeaders(headers) { + let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; + + const keys = Object.keys(headers[MAP]).sort(); + return keys.map(kind === 'key' ? function (k) { + return k.toLowerCase(); + } : kind === 'value' ? function (k) { + return headers[MAP][k].join(', '); + } : function (k) { + return [k.toLowerCase(), headers[MAP][k].join(', ')]; + }); +} + +const INTERNAL = Symbol('internal'); + +function createHeadersIterator(target, kind) { + const iterator = Object.create(HeadersIteratorPrototype); + iterator[INTERNAL] = { + target, + kind, + index: 0 + }; + return iterator; +} + +const HeadersIteratorPrototype = Object.setPrototypeOf({ + next() { + // istanbul ignore if + if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { + throw new TypeError('Value of `this` is not a HeadersIterator'); + } + + var _INTERNAL = this[INTERNAL]; + const target = _INTERNAL.target, + kind = _INTERNAL.kind, + index = _INTERNAL.index; + + const values = getHeaders(target, kind); + const len = values.length; + if (index >= len) { + return { + value: undefined, + done: true + }; + } + + this[INTERNAL].index = index + 1; + + return { + value: values[index], + done: false + }; + } +}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); + +Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { + value: 'HeadersIterator', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * Export the Headers object in a form that Node.js can consume. + * + * @param Headers headers + * @return Object + */ +function exportNodeCompatibleHeaders(headers) { + const obj = Object.assign({ __proto__: null }, headers[MAP]); + + // http.request() only supports string as Host header. This hack makes + // specifying custom Host header possible. + const hostHeaderKey = find(headers[MAP], 'Host'); + if (hostHeaderKey !== undefined) { + obj[hostHeaderKey] = obj[hostHeaderKey][0]; + } + + return obj; +} + +/** + * Create a Headers object from an object of headers, ignoring those that do + * not conform to HTTP grammar productions. + * + * @param Object obj Object of headers + * @return Headers + */ +function createHeadersLenient(obj) { + const headers = new Headers(); + for (const name of Object.keys(obj)) { + if (invalidTokenRegex.test(name)) { + continue; + } + if (Array.isArray(obj[name])) { + for (const val of obj[name]) { + if (invalidHeaderCharRegex.test(val)) { + continue; + } + if (headers[MAP][name] === undefined) { + headers[MAP][name] = [val]; + } else { + headers[MAP][name].push(val); + } + } + } else if (!invalidHeaderCharRegex.test(obj[name])) { + headers[MAP][name] = [obj[name]]; + } + } + return headers; +} + +const INTERNALS$1 = Symbol('Response internals'); + +// fix an issue where "STATUS_CODES" aren't a named export for node <10 +const STATUS_CODES = http.STATUS_CODES; + +/** + * Response class + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +class Response { + constructor() { + let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + Body.call(this, body, opts); + + const status = opts.status || 200; + const headers = new Headers(opts.headers); + + if (body != null && !headers.has('Content-Type')) { + const contentType = extractContentType(body); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + this[INTERNALS$1] = { + url: opts.url, + status, + statusText: opts.statusText || STATUS_CODES[status], + headers, + counter: opts.counter + }; + } + + get url() { + return this[INTERNALS$1].url || ''; + } + + get status() { + return this[INTERNALS$1].status; + } + + /** + * Convenience property representing if the request ended normally + */ + get ok() { + return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; + } + + get redirected() { + return this[INTERNALS$1].counter > 0; + } + + get statusText() { + return this[INTERNALS$1].statusText; + } + + get headers() { + return this[INTERNALS$1].headers; + } + + /** + * Clone this response + * + * @return Response + */ + clone() { + return new Response(clone(this), { + url: this.url, + status: this.status, + statusText: this.statusText, + headers: this.headers, + ok: this.ok, + redirected: this.redirected + }); + } +} + +Body.mixIn(Response.prototype); + +Object.defineProperties(Response.prototype, { + url: { enumerable: true }, + status: { enumerable: true }, + ok: { enumerable: true }, + redirected: { enumerable: true }, + statusText: { enumerable: true }, + headers: { enumerable: true }, + clone: { enumerable: true } +}); + +Object.defineProperty(Response.prototype, Symbol.toStringTag, { + value: 'Response', + writable: false, + enumerable: false, + configurable: true +}); + +const INTERNALS$2 = Symbol('Request internals'); + +// fix an issue where "format", "parse" aren't a named export for node <10 +const parse_url = Url.parse; +const format_url = Url.format; + +const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; + +/** + * Check if a value is an instance of Request. + * + * @param Mixed input + * @return Boolean + */ +function isRequest(input) { + return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; +} + +function isAbortSignal(signal) { + const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); + return !!(proto && proto.constructor.name === 'AbortSignal'); +} + +/** + * Request class + * + * @param Mixed input Url or Request instance + * @param Object init Custom options + * @return Void + */ +class Request { + constructor(input) { + let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + let parsedURL; + + // normalize input + if (!isRequest(input)) { + if (input && input.href) { + // in order to support Node.js' Url objects; though WHATWG's URL objects + // will fall into this branch also (since their `toString()` will return + // `href` property anyway) + parsedURL = parse_url(input.href); + } else { + // coerce input to a string before attempting to parse + parsedURL = parse_url(`${input}`); + } + input = {}; + } else { + parsedURL = parse_url(input.url); + } + + let method = init.method || input.method || 'GET'; + method = method.toUpperCase(); + + if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { + throw new TypeError('Request with GET/HEAD method cannot have body'); + } + + let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; + + Body.call(this, inputBody, { + timeout: init.timeout || input.timeout || 0, + size: init.size || input.size || 0 + }); + + const headers = new Headers(init.headers || input.headers || {}); + + if (inputBody != null && !headers.has('Content-Type')) { + const contentType = extractContentType(inputBody); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + let signal = isRequest(input) ? input.signal : null; + if ('signal' in init) signal = init.signal; + + if (signal != null && !isAbortSignal(signal)) { + throw new TypeError('Expected signal to be an instanceof AbortSignal'); + } + + this[INTERNALS$2] = { + method, + redirect: init.redirect || input.redirect || 'follow', + headers, + parsedURL, + signal + }; + + // node-fetch-only options + this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; + this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; + this.counter = init.counter || input.counter || 0; + this.agent = init.agent || input.agent; + } + + get method() { + return this[INTERNALS$2].method; + } + + get url() { + return format_url(this[INTERNALS$2].parsedURL); + } + + get headers() { + return this[INTERNALS$2].headers; + } + + get redirect() { + return this[INTERNALS$2].redirect; + } + + get signal() { + return this[INTERNALS$2].signal; + } + + /** + * Clone this request + * + * @return Request + */ + clone() { + return new Request(this); + } +} + +Body.mixIn(Request.prototype); + +Object.defineProperty(Request.prototype, Symbol.toStringTag, { + value: 'Request', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Request.prototype, { + method: { enumerable: true }, + url: { enumerable: true }, + headers: { enumerable: true }, + redirect: { enumerable: true }, + clone: { enumerable: true }, + signal: { enumerable: true } +}); + +/** + * Convert a Request to Node.js http request options. + * + * @param Request A Request instance + * @return Object The options object to be passed to http.request + */ +function getNodeRequestOptions(request) { + const parsedURL = request[INTERNALS$2].parsedURL; + const headers = new Headers(request[INTERNALS$2].headers); + + // fetch step 1.3 + if (!headers.has('Accept')) { + headers.set('Accept', '*/*'); + } + + // Basic fetch + if (!parsedURL.protocol || !parsedURL.hostname) { + throw new TypeError('Only absolute URLs are supported'); + } + + if (!/^https?:$/.test(parsedURL.protocol)) { + throw new TypeError('Only HTTP(S) protocols are supported'); + } + + if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { + throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); + } + + // HTTP-network-or-cache fetch steps 2.4-2.7 + let contentLengthValue = null; + if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { + contentLengthValue = '0'; + } + if (request.body != null) { + const totalBytes = getTotalBytes(request); + if (typeof totalBytes === 'number') { + contentLengthValue = String(totalBytes); + } + } + if (contentLengthValue) { + headers.set('Content-Length', contentLengthValue); + } + + // HTTP-network-or-cache fetch step 2.11 + if (!headers.has('User-Agent')) { + headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); + } + + // HTTP-network-or-cache fetch step 2.15 + if (request.compress && !headers.has('Accept-Encoding')) { + headers.set('Accept-Encoding', 'gzip,deflate'); + } + + let agent = request.agent; + if (typeof agent === 'function') { + agent = agent(parsedURL); + } + + if (!headers.has('Connection') && !agent) { + headers.set('Connection', 'close'); + } + + // HTTP-network fetch step 4.2 + // chunked encoding is handled by Node.js + + return Object.assign({}, parsedURL, { + method: request.method, + headers: exportNodeCompatibleHeaders(headers), + agent + }); +} + +/** + * abort-error.js + * + * AbortError interface for cancelled requests + */ + +/** + * Create AbortError instance + * + * @param String message Error message for human + * @return AbortError + */ +function AbortError(message) { + Error.call(this, message); + + this.type = 'aborted'; + this.message = message; + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +AbortError.prototype = Object.create(Error.prototype); +AbortError.prototype.constructor = AbortError; +AbortError.prototype.name = 'AbortError'; + +// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 +const PassThrough$1 = Stream.PassThrough; +const resolve_url = Url.resolve; + +/** + * Fetch function + * + * @param Mixed url Absolute url or Request instance + * @param Object opts Fetch options + * @return Promise + */ +function fetch(url, opts) { + + // allow custom promise + if (!fetch.Promise) { + throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); + } + + Body.Promise = fetch.Promise; + + // wrap http.request into fetch + return new fetch.Promise(function (resolve, reject) { + // build request object + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); + + const send = (options.protocol === 'https:' ? https : http).request; + const signal = request.signal; + + let response = null; + + const abort = function abort() { + let error = new AbortError('The user aborted a request.'); + reject(error); + if (request.body && request.body instanceof Stream.Readable) { + request.body.destroy(error); + } + if (!response || !response.body) return; + response.body.emit('error', error); + }; + + if (signal && signal.aborted) { + abort(); + return; + } + + const abortAndFinalize = function abortAndFinalize() { + abort(); + finalize(); + }; + + // send request + const req = send(options); + let reqTimeout; + + if (signal) { + signal.addEventListener('abort', abortAndFinalize); + } + + function finalize() { + req.abort(); + if (signal) signal.removeEventListener('abort', abortAndFinalize); + clearTimeout(reqTimeout); + } + + if (request.timeout) { + req.once('socket', function (socket) { + reqTimeout = setTimeout(function () { + reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); + finalize(); + }, request.timeout); + }); + } + + req.on('error', function (err) { + reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); + finalize(); + }); + + req.on('response', function (res) { + clearTimeout(reqTimeout); + + const headers = createHeadersLenient(res.headers); + + // HTTP fetch step 5 + if (fetch.isRedirect(res.statusCode)) { + // HTTP fetch step 5.2 + const location = headers.get('Location'); + + // HTTP fetch step 5.3 + const locationURL = location === null ? null : resolve_url(request.url, location); + + // HTTP fetch step 5.5 + switch (request.redirect) { + case 'error': + reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); + finalize(); + return; + case 'manual': + // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. + if (locationURL !== null) { + // handle corrupted header + try { + headers.set('Location', locationURL); + } catch (err) { + // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request + reject(err); + } + } + break; + case 'follow': + // HTTP-redirect fetch step 2 + if (locationURL === null) { + break; + } + + // HTTP-redirect fetch step 5 + if (request.counter >= request.follow) { + reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 6 (counter increment) + // Create a new Request object. + const requestOpts = { + headers: new Headers(request.headers), + follow: request.follow, + counter: request.counter + 1, + agent: request.agent, + compress: request.compress, + method: request.method, + body: request.body, + signal: request.signal, + timeout: request.timeout, + size: request.size + }; + + // HTTP-redirect fetch step 9 + if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { + reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 11 + if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { + requestOpts.method = 'GET'; + requestOpts.body = undefined; + requestOpts.headers.delete('content-length'); + } + + // HTTP-redirect fetch step 15 + resolve(fetch(new Request(locationURL, requestOpts))); + finalize(); + return; + } + } + + // prepare response + res.once('end', function () { + if (signal) signal.removeEventListener('abort', abortAndFinalize); + }); + let body = res.pipe(new PassThrough$1()); + + const response_options = { + url: request.url, + status: res.statusCode, + statusText: res.statusMessage, + headers: headers, + size: request.size, + timeout: request.timeout, + counter: request.counter + }; + + // HTTP-network fetch step 12.1.1.3 + const codings = headers.get('Content-Encoding'); + + // HTTP-network fetch step 12.1.1.4: handle content codings + + // in following scenarios we ignore compression support + // 1. compression support is disabled + // 2. HEAD request + // 3. no Content-Encoding header + // 4. no content response (204) + // 5. content not modified response (304) + if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { + response = new Response(body, response_options); + resolve(response); + return; + } + + // For Node v6+ + // Be less strict when decoding compressed responses, since sometimes + // servers send slightly invalid responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + const zlibOptions = { + flush: zlib.Z_SYNC_FLUSH, + finishFlush: zlib.Z_SYNC_FLUSH + }; + + // for gzip + if (codings == 'gzip' || codings == 'x-gzip') { + body = body.pipe(zlib.createGunzip(zlibOptions)); + response = new Response(body, response_options); + resolve(response); + return; + } + + // for deflate + if (codings == 'deflate' || codings == 'x-deflate') { + // handle the infamous raw deflate response from old servers + // a hack for old IIS and Apache servers + const raw = res.pipe(new PassThrough$1()); + raw.once('data', function (chunk) { + // see http://stackoverflow.com/questions/37519828 + if ((chunk[0] & 0x0F) === 0x08) { + body = body.pipe(zlib.createInflate()); + } else { + body = body.pipe(zlib.createInflateRaw()); + } + response = new Response(body, response_options); + resolve(response); + }); + return; + } + + // for br + if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { + body = body.pipe(zlib.createBrotliDecompress()); + response = new Response(body, response_options); + resolve(response); + return; + } + + // otherwise, use response as-is + response = new Response(body, response_options); + resolve(response); + }); + + writeToStream(req, request); + }); +} +/** + * Redirect code matching + * + * @param Number code Status code + * @return Boolean + */ +fetch.isRedirect = function (code) { + return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; +}; + +// expose Promise +fetch.Promise = global.Promise; + +module.exports = exports = fetch; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = exports; +exports.Headers = Headers; +exports.Request = Request; +exports.Response = Response; +exports.FetchError = FetchError; diff --git a/coc/extensions/node_modules/coc-go/node_modules/node-fetch/lib/index.mjs b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/lib/index.mjs new file mode 100644 index 0000000..ecf59af --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/lib/index.mjs @@ -0,0 +1,1638 @@ +import Stream from 'stream'; +import http from 'http'; +import Url from 'url'; +import https from 'https'; +import zlib from 'zlib'; + +// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js + +// fix for "Readable" isn't a named export issue +const Readable = Stream.Readable; + +const BUFFER = Symbol('buffer'); +const TYPE = Symbol('type'); + +class Blob { + constructor() { + this[TYPE] = ''; + + const blobParts = arguments[0]; + const options = arguments[1]; + + const buffers = []; + let size = 0; + + if (blobParts) { + const a = blobParts; + const length = Number(a.length); + for (let i = 0; i < length; i++) { + const element = a[i]; + let buffer; + if (element instanceof Buffer) { + buffer = element; + } else if (ArrayBuffer.isView(element)) { + buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); + } else if (element instanceof ArrayBuffer) { + buffer = Buffer.from(element); + } else if (element instanceof Blob) { + buffer = element[BUFFER]; + } else { + buffer = Buffer.from(typeof element === 'string' ? element : String(element)); + } + size += buffer.length; + buffers.push(buffer); + } + } + + this[BUFFER] = Buffer.concat(buffers); + + let type = options && options.type !== undefined && String(options.type).toLowerCase(); + if (type && !/[^\u0020-\u007E]/.test(type)) { + this[TYPE] = type; + } + } + get size() { + return this[BUFFER].length; + } + get type() { + return this[TYPE]; + } + text() { + return Promise.resolve(this[BUFFER].toString()); + } + arrayBuffer() { + const buf = this[BUFFER]; + const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + return Promise.resolve(ab); + } + stream() { + const readable = new Readable(); + readable._read = function () {}; + readable.push(this[BUFFER]); + readable.push(null); + return readable; + } + toString() { + return '[object Blob]'; + } + slice() { + const size = this.size; + + const start = arguments[0]; + const end = arguments[1]; + let relativeStart, relativeEnd; + if (start === undefined) { + relativeStart = 0; + } else if (start < 0) { + relativeStart = Math.max(size + start, 0); + } else { + relativeStart = Math.min(start, size); + } + if (end === undefined) { + relativeEnd = size; + } else if (end < 0) { + relativeEnd = Math.max(size + end, 0); + } else { + relativeEnd = Math.min(end, size); + } + const span = Math.max(relativeEnd - relativeStart, 0); + + const buffer = this[BUFFER]; + const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); + const blob = new Blob([], { type: arguments[2] }); + blob[BUFFER] = slicedBuffer; + return blob; + } +} + +Object.defineProperties(Blob.prototype, { + size: { enumerable: true }, + type: { enumerable: true }, + slice: { enumerable: true } +}); + +Object.defineProperty(Blob.prototype, Symbol.toStringTag, { + value: 'Blob', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * fetch-error.js + * + * FetchError interface for operational errors + */ + +/** + * Create FetchError instance + * + * @param String message Error message for human + * @param String type Error type for machine + * @param String systemError For Node.js system error + * @return FetchError + */ +function FetchError(message, type, systemError) { + Error.call(this, message); + + this.message = message; + this.type = type; + + // when err.type is `system`, err.code contains system error code + if (systemError) { + this.code = this.errno = systemError.code; + } + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +FetchError.prototype = Object.create(Error.prototype); +FetchError.prototype.constructor = FetchError; +FetchError.prototype.name = 'FetchError'; + +let convert; +try { + convert = require('encoding').convert; +} catch (e) {} + +const INTERNALS = Symbol('Body internals'); + +// fix an issue where "PassThrough" isn't a named export for node <10 +const PassThrough = Stream.PassThrough; + +/** + * Body mixin + * + * Ref: https://fetch.spec.whatwg.org/#body + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +function Body(body) { + var _this = this; + + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$size = _ref.size; + + let size = _ref$size === undefined ? 0 : _ref$size; + var _ref$timeout = _ref.timeout; + let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; + + if (body == null) { + // body is undefined or null + body = null; + } else if (isURLSearchParams(body)) { + // body is a URLSearchParams + body = Buffer.from(body.toString()); + } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { + // body is ArrayBuffer + body = Buffer.from(body); + } else if (ArrayBuffer.isView(body)) { + // body is ArrayBufferView + body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); + } else if (body instanceof Stream) ; else { + // none of the above + // coerce to string then buffer + body = Buffer.from(String(body)); + } + this[INTERNALS] = { + body, + disturbed: false, + error: null + }; + this.size = size; + this.timeout = timeout; + + if (body instanceof Stream) { + body.on('error', function (err) { + const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); + _this[INTERNALS].error = error; + }); + } +} + +Body.prototype = { + get body() { + return this[INTERNALS].body; + }, + + get bodyUsed() { + return this[INTERNALS].disturbed; + }, + + /** + * Decode response as ArrayBuffer + * + * @return Promise + */ + arrayBuffer() { + return consumeBody.call(this).then(function (buf) { + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + }); + }, + + /** + * Return raw response as Blob + * + * @return Promise + */ + blob() { + let ct = this.headers && this.headers.get('content-type') || ''; + return consumeBody.call(this).then(function (buf) { + return Object.assign( + // Prevent copying + new Blob([], { + type: ct.toLowerCase() + }), { + [BUFFER]: buf + }); + }); + }, + + /** + * Decode response as json + * + * @return Promise + */ + json() { + var _this2 = this; + + return consumeBody.call(this).then(function (buffer) { + try { + return JSON.parse(buffer.toString()); + } catch (err) { + return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); + } + }); + }, + + /** + * Decode response as text + * + * @return Promise + */ + text() { + return consumeBody.call(this).then(function (buffer) { + return buffer.toString(); + }); + }, + + /** + * Decode response as buffer (non-spec api) + * + * @return Promise + */ + buffer() { + return consumeBody.call(this); + }, + + /** + * Decode response as text, while automatically detecting the encoding and + * trying to decode to UTF-8 (non-spec api) + * + * @return Promise + */ + textConverted() { + var _this3 = this; + + return consumeBody.call(this).then(function (buffer) { + return convertBody(buffer, _this3.headers); + }); + } +}; + +// In browsers, all properties are enumerable. +Object.defineProperties(Body.prototype, { + body: { enumerable: true }, + bodyUsed: { enumerable: true }, + arrayBuffer: { enumerable: true }, + blob: { enumerable: true }, + json: { enumerable: true }, + text: { enumerable: true } +}); + +Body.mixIn = function (proto) { + for (const name of Object.getOwnPropertyNames(Body.prototype)) { + // istanbul ignore else: future proof + if (!(name in proto)) { + const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); + Object.defineProperty(proto, name, desc); + } + } +}; + +/** + * Consume and convert an entire Body to a Buffer. + * + * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body + * + * @return Promise + */ +function consumeBody() { + var _this4 = this; + + if (this[INTERNALS].disturbed) { + return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); + } + + this[INTERNALS].disturbed = true; + + if (this[INTERNALS].error) { + return Body.Promise.reject(this[INTERNALS].error); + } + + let body = this.body; + + // body is null + if (body === null) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is blob + if (isBlob(body)) { + body = body.stream(); + } + + // body is buffer + if (Buffer.isBuffer(body)) { + return Body.Promise.resolve(body); + } + + // istanbul ignore if: should never happen + if (!(body instanceof Stream)) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is stream + // get ready to actually consume the body + let accum = []; + let accumBytes = 0; + let abort = false; + + return new Body.Promise(function (resolve, reject) { + let resTimeout; + + // allow timeout on slow response body + if (_this4.timeout) { + resTimeout = setTimeout(function () { + abort = true; + reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); + }, _this4.timeout); + } + + // handle stream errors + body.on('error', function (err) { + if (err.name === 'AbortError') { + // if the request was aborted, reject with this Error + abort = true; + reject(err); + } else { + // other errors, such as incorrect content-encoding + reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + + body.on('data', function (chunk) { + if (abort || chunk === null) { + return; + } + + if (_this4.size && accumBytes + chunk.length > _this4.size) { + abort = true; + reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); + return; + } + + accumBytes += chunk.length; + accum.push(chunk); + }); + + body.on('end', function () { + if (abort) { + return; + } + + clearTimeout(resTimeout); + + try { + resolve(Buffer.concat(accum, accumBytes)); + } catch (err) { + // handle streams that have accumulated too much data (issue #414) + reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + }); +} + +/** + * Detect buffer encoding and convert to target encoding + * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding + * + * @param Buffer buffer Incoming buffer + * @param String encoding Target encoding + * @return String + */ +function convertBody(buffer, headers) { + if (typeof convert !== 'function') { + throw new Error('The package `encoding` must be installed to use the textConverted() function'); + } + + const ct = headers.get('content-type'); + let charset = 'utf-8'; + let res, str; + + // header + if (ct) { + res = /charset=([^;]*)/i.exec(ct); + } + + // no charset in content type, peek at response body for at most 1024 bytes + str = buffer.slice(0, 1024).toString(); + + // html5 + if (!res && str) { + res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; + + this[MAP] = Object.create(null); + + if (init instanceof Headers) { + const rawHeaders = init.raw(); + const headerNames = Object.keys(rawHeaders); + + for (const headerName of headerNames) { + for (const value of rawHeaders[headerName]) { + this.append(headerName, value); + } + } + + return; + } + + // We don't worry about converting prop to ByteString here as append() + // will handle it. + if (init == null) ; else if (typeof init === 'object') { + const method = init[Symbol.iterator]; + if (method != null) { + if (typeof method !== 'function') { + throw new TypeError('Header pairs must be iterable'); + } + + // sequence> + // Note: per spec we have to first exhaust the lists then process them + const pairs = []; + for (const pair of init) { + if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { + throw new TypeError('Each header pair must be iterable'); + } + pairs.push(Array.from(pair)); + } + + for (const pair of pairs) { + if (pair.length !== 2) { + throw new TypeError('Each header pair must be a name/value tuple'); + } + this.append(pair[0], pair[1]); + } + } else { + // record + for (const key of Object.keys(init)) { + const value = init[key]; + this.append(key, value); + } + } + } else { + throw new TypeError('Provided initializer must be an object'); + } + } + + /** + * Return combined header value given name + * + * @param String name Header name + * @return Mixed + */ + get(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key === undefined) { + return null; + } + + return this[MAP][key].join(', '); + } + + /** + * Iterate over all headers + * + * @param Function callback Executed for each item with parameters (value, name, thisArg) + * @param Boolean thisArg `this` context for callback function + * @return Void + */ + forEach(callback) { + let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; + + let pairs = getHeaders(this); + let i = 0; + while (i < pairs.length) { + var _pairs$i = pairs[i]; + const name = _pairs$i[0], + value = _pairs$i[1]; + + callback.call(thisArg, value, name, this); + pairs = getHeaders(this); + i++; + } + } + + /** + * Overwrite header values given name + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + set(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + this[MAP][key !== undefined ? key : name] = [value]; + } + + /** + * Append a value onto existing header + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + append(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + if (key !== undefined) { + this[MAP][key].push(value); + } else { + this[MAP][name] = [value]; + } + } + + /** + * Check for header name existence + * + * @param String name Header name + * @return Boolean + */ + has(name) { + name = `${name}`; + validateName(name); + return find(this[MAP], name) !== undefined; + } + + /** + * Delete all header values given name + * + * @param String name Header name + * @return Void + */ + delete(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key !== undefined) { + delete this[MAP][key]; + } + } + + /** + * Return raw headers (non-spec api) + * + * @return Object + */ + raw() { + return this[MAP]; + } + + /** + * Get an iterator on keys. + * + * @return Iterator + */ + keys() { + return createHeadersIterator(this, 'key'); + } + + /** + * Get an iterator on values. + * + * @return Iterator + */ + values() { + return createHeadersIterator(this, 'value'); + } + + /** + * Get an iterator on entries. + * + * This is the default iterator of the Headers object. + * + * @return Iterator + */ + [Symbol.iterator]() { + return createHeadersIterator(this, 'key+value'); + } +} +Headers.prototype.entries = Headers.prototype[Symbol.iterator]; + +Object.defineProperty(Headers.prototype, Symbol.toStringTag, { + value: 'Headers', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Headers.prototype, { + get: { enumerable: true }, + forEach: { enumerable: true }, + set: { enumerable: true }, + append: { enumerable: true }, + has: { enumerable: true }, + delete: { enumerable: true }, + keys: { enumerable: true }, + values: { enumerable: true }, + entries: { enumerable: true } +}); + +function getHeaders(headers) { + let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; + + const keys = Object.keys(headers[MAP]).sort(); + return keys.map(kind === 'key' ? function (k) { + return k.toLowerCase(); + } : kind === 'value' ? function (k) { + return headers[MAP][k].join(', '); + } : function (k) { + return [k.toLowerCase(), headers[MAP][k].join(', ')]; + }); +} + +const INTERNAL = Symbol('internal'); + +function createHeadersIterator(target, kind) { + const iterator = Object.create(HeadersIteratorPrototype); + iterator[INTERNAL] = { + target, + kind, + index: 0 + }; + return iterator; +} + +const HeadersIteratorPrototype = Object.setPrototypeOf({ + next() { + // istanbul ignore if + if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { + throw new TypeError('Value of `this` is not a HeadersIterator'); + } + + var _INTERNAL = this[INTERNAL]; + const target = _INTERNAL.target, + kind = _INTERNAL.kind, + index = _INTERNAL.index; + + const values = getHeaders(target, kind); + const len = values.length; + if (index >= len) { + return { + value: undefined, + done: true + }; + } + + this[INTERNAL].index = index + 1; + + return { + value: values[index], + done: false + }; + } +}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); + +Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { + value: 'HeadersIterator', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * Export the Headers object in a form that Node.js can consume. + * + * @param Headers headers + * @return Object + */ +function exportNodeCompatibleHeaders(headers) { + const obj = Object.assign({ __proto__: null }, headers[MAP]); + + // http.request() only supports string as Host header. This hack makes + // specifying custom Host header possible. + const hostHeaderKey = find(headers[MAP], 'Host'); + if (hostHeaderKey !== undefined) { + obj[hostHeaderKey] = obj[hostHeaderKey][0]; + } + + return obj; +} + +/** + * Create a Headers object from an object of headers, ignoring those that do + * not conform to HTTP grammar productions. + * + * @param Object obj Object of headers + * @return Headers + */ +function createHeadersLenient(obj) { + const headers = new Headers(); + for (const name of Object.keys(obj)) { + if (invalidTokenRegex.test(name)) { + continue; + } + if (Array.isArray(obj[name])) { + for (const val of obj[name]) { + if (invalidHeaderCharRegex.test(val)) { + continue; + } + if (headers[MAP][name] === undefined) { + headers[MAP][name] = [val]; + } else { + headers[MAP][name].push(val); + } + } + } else if (!invalidHeaderCharRegex.test(obj[name])) { + headers[MAP][name] = [obj[name]]; + } + } + return headers; +} + +const INTERNALS$1 = Symbol('Response internals'); + +// fix an issue where "STATUS_CODES" aren't a named export for node <10 +const STATUS_CODES = http.STATUS_CODES; + +/** + * Response class + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +class Response { + constructor() { + let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + Body.call(this, body, opts); + + const status = opts.status || 200; + const headers = new Headers(opts.headers); + + if (body != null && !headers.has('Content-Type')) { + const contentType = extractContentType(body); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + this[INTERNALS$1] = { + url: opts.url, + status, + statusText: opts.statusText || STATUS_CODES[status], + headers, + counter: opts.counter + }; + } + + get url() { + return this[INTERNALS$1].url || ''; + } + + get status() { + return this[INTERNALS$1].status; + } + + /** + * Convenience property representing if the request ended normally + */ + get ok() { + return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; + } + + get redirected() { + return this[INTERNALS$1].counter > 0; + } + + get statusText() { + return this[INTERNALS$1].statusText; + } + + get headers() { + return this[INTERNALS$1].headers; + } + + /** + * Clone this response + * + * @return Response + */ + clone() { + return new Response(clone(this), { + url: this.url, + status: this.status, + statusText: this.statusText, + headers: this.headers, + ok: this.ok, + redirected: this.redirected + }); + } +} + +Body.mixIn(Response.prototype); + +Object.defineProperties(Response.prototype, { + url: { enumerable: true }, + status: { enumerable: true }, + ok: { enumerable: true }, + redirected: { enumerable: true }, + statusText: { enumerable: true }, + headers: { enumerable: true }, + clone: { enumerable: true } +}); + +Object.defineProperty(Response.prototype, Symbol.toStringTag, { + value: 'Response', + writable: false, + enumerable: false, + configurable: true +}); + +const INTERNALS$2 = Symbol('Request internals'); + +// fix an issue where "format", "parse" aren't a named export for node <10 +const parse_url = Url.parse; +const format_url = Url.format; + +const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; + +/** + * Check if a value is an instance of Request. + * + * @param Mixed input + * @return Boolean + */ +function isRequest(input) { + return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; +} + +function isAbortSignal(signal) { + const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); + return !!(proto && proto.constructor.name === 'AbortSignal'); +} + +/** + * Request class + * + * @param Mixed input Url or Request instance + * @param Object init Custom options + * @return Void + */ +class Request { + constructor(input) { + let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + let parsedURL; + + // normalize input + if (!isRequest(input)) { + if (input && input.href) { + // in order to support Node.js' Url objects; though WHATWG's URL objects + // will fall into this branch also (since their `toString()` will return + // `href` property anyway) + parsedURL = parse_url(input.href); + } else { + // coerce input to a string before attempting to parse + parsedURL = parse_url(`${input}`); + } + input = {}; + } else { + parsedURL = parse_url(input.url); + } + + let method = init.method || input.method || 'GET'; + method = method.toUpperCase(); + + if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { + throw new TypeError('Request with GET/HEAD method cannot have body'); + } + + let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; + + Body.call(this, inputBody, { + timeout: init.timeout || input.timeout || 0, + size: init.size || input.size || 0 + }); + + const headers = new Headers(init.headers || input.headers || {}); + + if (inputBody != null && !headers.has('Content-Type')) { + const contentType = extractContentType(inputBody); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + let signal = isRequest(input) ? input.signal : null; + if ('signal' in init) signal = init.signal; + + if (signal != null && !isAbortSignal(signal)) { + throw new TypeError('Expected signal to be an instanceof AbortSignal'); + } + + this[INTERNALS$2] = { + method, + redirect: init.redirect || input.redirect || 'follow', + headers, + parsedURL, + signal + }; + + // node-fetch-only options + this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; + this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; + this.counter = init.counter || input.counter || 0; + this.agent = init.agent || input.agent; + } + + get method() { + return this[INTERNALS$2].method; + } + + get url() { + return format_url(this[INTERNALS$2].parsedURL); + } + + get headers() { + return this[INTERNALS$2].headers; + } + + get redirect() { + return this[INTERNALS$2].redirect; + } + + get signal() { + return this[INTERNALS$2].signal; + } + + /** + * Clone this request + * + * @return Request + */ + clone() { + return new Request(this); + } +} + +Body.mixIn(Request.prototype); + +Object.defineProperty(Request.prototype, Symbol.toStringTag, { + value: 'Request', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Request.prototype, { + method: { enumerable: true }, + url: { enumerable: true }, + headers: { enumerable: true }, + redirect: { enumerable: true }, + clone: { enumerable: true }, + signal: { enumerable: true } +}); + +/** + * Convert a Request to Node.js http request options. + * + * @param Request A Request instance + * @return Object The options object to be passed to http.request + */ +function getNodeRequestOptions(request) { + const parsedURL = request[INTERNALS$2].parsedURL; + const headers = new Headers(request[INTERNALS$2].headers); + + // fetch step 1.3 + if (!headers.has('Accept')) { + headers.set('Accept', '*/*'); + } + + // Basic fetch + if (!parsedURL.protocol || !parsedURL.hostname) { + throw new TypeError('Only absolute URLs are supported'); + } + + if (!/^https?:$/.test(parsedURL.protocol)) { + throw new TypeError('Only HTTP(S) protocols are supported'); + } + + if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { + throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); + } + + // HTTP-network-or-cache fetch steps 2.4-2.7 + let contentLengthValue = null; + if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { + contentLengthValue = '0'; + } + if (request.body != null) { + const totalBytes = getTotalBytes(request); + if (typeof totalBytes === 'number') { + contentLengthValue = String(totalBytes); + } + } + if (contentLengthValue) { + headers.set('Content-Length', contentLengthValue); + } + + // HTTP-network-or-cache fetch step 2.11 + if (!headers.has('User-Agent')) { + headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); + } + + // HTTP-network-or-cache fetch step 2.15 + if (request.compress && !headers.has('Accept-Encoding')) { + headers.set('Accept-Encoding', 'gzip,deflate'); + } + + let agent = request.agent; + if (typeof agent === 'function') { + agent = agent(parsedURL); + } + + if (!headers.has('Connection') && !agent) { + headers.set('Connection', 'close'); + } + + // HTTP-network fetch step 4.2 + // chunked encoding is handled by Node.js + + return Object.assign({}, parsedURL, { + method: request.method, + headers: exportNodeCompatibleHeaders(headers), + agent + }); +} + +/** + * abort-error.js + * + * AbortError interface for cancelled requests + */ + +/** + * Create AbortError instance + * + * @param String message Error message for human + * @return AbortError + */ +function AbortError(message) { + Error.call(this, message); + + this.type = 'aborted'; + this.message = message; + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +AbortError.prototype = Object.create(Error.prototype); +AbortError.prototype.constructor = AbortError; +AbortError.prototype.name = 'AbortError'; + +// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 +const PassThrough$1 = Stream.PassThrough; +const resolve_url = Url.resolve; + +/** + * Fetch function + * + * @param Mixed url Absolute url or Request instance + * @param Object opts Fetch options + * @return Promise + */ +function fetch(url, opts) { + + // allow custom promise + if (!fetch.Promise) { + throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); + } + + Body.Promise = fetch.Promise; + + // wrap http.request into fetch + return new fetch.Promise(function (resolve, reject) { + // build request object + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); + + const send = (options.protocol === 'https:' ? https : http).request; + const signal = request.signal; + + let response = null; + + const abort = function abort() { + let error = new AbortError('The user aborted a request.'); + reject(error); + if (request.body && request.body instanceof Stream.Readable) { + request.body.destroy(error); + } + if (!response || !response.body) return; + response.body.emit('error', error); + }; + + if (signal && signal.aborted) { + abort(); + return; + } + + const abortAndFinalize = function abortAndFinalize() { + abort(); + finalize(); + }; + + // send request + const req = send(options); + let reqTimeout; + + if (signal) { + signal.addEventListener('abort', abortAndFinalize); + } + + function finalize() { + req.abort(); + if (signal) signal.removeEventListener('abort', abortAndFinalize); + clearTimeout(reqTimeout); + } + + if (request.timeout) { + req.once('socket', function (socket) { + reqTimeout = setTimeout(function () { + reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); + finalize(); + }, request.timeout); + }); + } + + req.on('error', function (err) { + reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); + finalize(); + }); + + req.on('response', function (res) { + clearTimeout(reqTimeout); + + const headers = createHeadersLenient(res.headers); + + // HTTP fetch step 5 + if (fetch.isRedirect(res.statusCode)) { + // HTTP fetch step 5.2 + const location = headers.get('Location'); + + // HTTP fetch step 5.3 + const locationURL = location === null ? null : resolve_url(request.url, location); + + // HTTP fetch step 5.5 + switch (request.redirect) { + case 'error': + reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); + finalize(); + return; + case 'manual': + // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. + if (locationURL !== null) { + // handle corrupted header + try { + headers.set('Location', locationURL); + } catch (err) { + // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request + reject(err); + } + } + break; + case 'follow': + // HTTP-redirect fetch step 2 + if (locationURL === null) { + break; + } + + // HTTP-redirect fetch step 5 + if (request.counter >= request.follow) { + reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 6 (counter increment) + // Create a new Request object. + const requestOpts = { + headers: new Headers(request.headers), + follow: request.follow, + counter: request.counter + 1, + agent: request.agent, + compress: request.compress, + method: request.method, + body: request.body, + signal: request.signal, + timeout: request.timeout, + size: request.size + }; + + // HTTP-redirect fetch step 9 + if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { + reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 11 + if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { + requestOpts.method = 'GET'; + requestOpts.body = undefined; + requestOpts.headers.delete('content-length'); + } + + // HTTP-redirect fetch step 15 + resolve(fetch(new Request(locationURL, requestOpts))); + finalize(); + return; + } + } + + // prepare response + res.once('end', function () { + if (signal) signal.removeEventListener('abort', abortAndFinalize); + }); + let body = res.pipe(new PassThrough$1()); + + const response_options = { + url: request.url, + status: res.statusCode, + statusText: res.statusMessage, + headers: headers, + size: request.size, + timeout: request.timeout, + counter: request.counter + }; + + // HTTP-network fetch step 12.1.1.3 + const codings = headers.get('Content-Encoding'); + + // HTTP-network fetch step 12.1.1.4: handle content codings + + // in following scenarios we ignore compression support + // 1. compression support is disabled + // 2. HEAD request + // 3. no Content-Encoding header + // 4. no content response (204) + // 5. content not modified response (304) + if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { + response = new Response(body, response_options); + resolve(response); + return; + } + + // For Node v6+ + // Be less strict when decoding compressed responses, since sometimes + // servers send slightly invalid responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + const zlibOptions = { + flush: zlib.Z_SYNC_FLUSH, + finishFlush: zlib.Z_SYNC_FLUSH + }; + + // for gzip + if (codings == 'gzip' || codings == 'x-gzip') { + body = body.pipe(zlib.createGunzip(zlibOptions)); + response = new Response(body, response_options); + resolve(response); + return; + } + + // for deflate + if (codings == 'deflate' || codings == 'x-deflate') { + // handle the infamous raw deflate response from old servers + // a hack for old IIS and Apache servers + const raw = res.pipe(new PassThrough$1()); + raw.once('data', function (chunk) { + // see http://stackoverflow.com/questions/37519828 + if ((chunk[0] & 0x0F) === 0x08) { + body = body.pipe(zlib.createInflate()); + } else { + body = body.pipe(zlib.createInflateRaw()); + } + response = new Response(body, response_options); + resolve(response); + }); + return; + } + + // for br + if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { + body = body.pipe(zlib.createBrotliDecompress()); + response = new Response(body, response_options); + resolve(response); + return; + } + + // otherwise, use response as-is + response = new Response(body, response_options); + resolve(response); + }); + + writeToStream(req, request); + }); +} +/** + * Redirect code matching + * + * @param Number code Status code + * @return Boolean + */ +fetch.isRedirect = function (code) { + return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; +}; + +// expose Promise +fetch.Promise = global.Promise; + +export default fetch; +export { Headers, Request, Response, FetchError }; diff --git a/coc/extensions/node_modules/coc-go/node_modules/node-fetch/package.json b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/package.json new file mode 100644 index 0000000..2160469 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/node-fetch/package.json @@ -0,0 +1,66 @@ +{ + "name": "node-fetch", + "version": "2.6.1", + "description": "A light-weight module that brings window.fetch to node.js", + "main": "lib/index", + "browser": "./browser.js", + "module": "lib/index.mjs", + "files": [ + "lib/index.js", + "lib/index.mjs", + "lib/index.es.js", + "browser.js" + ], + "engines": { + "node": "4.x || >=6.0.0" + }, + "scripts": { + "build": "cross-env BABEL_ENV=rollup rollup -c", + "prepare": "npm run build", + "test": "cross-env BABEL_ENV=test mocha --require babel-register --throw-deprecation test/test.js", + "report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js", + "coverage": "cross-env BABEL_ENV=coverage nyc --reporter json --reporter text mocha -R spec test/test.js && codecov -f coverage/coverage-final.json" + }, + "repository": { + "type": "git", + "url": "https://github.com/bitinn/node-fetch.git" + }, + "keywords": [ + "fetch", + "http", + "promise" + ], + "author": "David Frank", + "license": "MIT", + "bugs": { + "url": "https://github.com/bitinn/node-fetch/issues" + }, + "homepage": "https://github.com/bitinn/node-fetch", + "devDependencies": { + "@ungap/url-search-params": "^0.1.2", + "abort-controller": "^1.1.0", + "abortcontroller-polyfill": "^1.3.0", + "babel-core": "^6.26.3", + "babel-plugin-istanbul": "^4.1.6", + "babel-preset-env": "^1.6.1", + "babel-register": "^6.16.3", + "chai": "^3.5.0", + "chai-as-promised": "^7.1.1", + "chai-iterator": "^1.1.1", + "chai-string": "~1.3.0", + "codecov": "^3.3.0", + "cross-env": "^5.2.0", + "form-data": "^2.3.3", + "is-builtin-module": "^1.0.0", + "mocha": "^5.0.0", + "nyc": "11.9.0", + "parted": "^0.1.1", + "promise": "^8.0.3", + "resumer": "0.0.0", + "rollup": "^0.63.4", + "rollup-plugin-babel": "^3.0.7", + "string-to-arraybuffer": "^1.0.2", + "whatwg-url": "^5.0.0" + }, + "dependencies": {} +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/tslib/CopyrightNotice.txt b/coc/extensions/node_modules/coc-go/node_modules/tslib/CopyrightNotice.txt new file mode 100644 index 0000000..3d4c823 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/tslib/CopyrightNotice.txt @@ -0,0 +1,15 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + diff --git a/coc/extensions/node_modules/coc-go/node_modules/tslib/LICENSE.txt b/coc/extensions/node_modules/coc-go/node_modules/tslib/LICENSE.txt new file mode 100644 index 0000000..bfe6430 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/tslib/LICENSE.txt @@ -0,0 +1,12 @@ +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/tslib/README.md b/coc/extensions/node_modules/coc-go/node_modules/tslib/README.md new file mode 100644 index 0000000..49c0014 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/tslib/README.md @@ -0,0 +1,154 @@ +# tslib + +This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions. + +This library is primarily used by the `--importHelpers` flag in TypeScript. +When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file: + +```ts +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +exports.x = {}; +exports.y = __assign({}, exports.x); + +``` + +will instead be emitted as something like the following: + +```ts +var tslib_1 = require("tslib"); +exports.x = {}; +exports.y = tslib_1.__assign({}, exports.x); +``` + +Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead. +For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`. + +# Installing + +For the latest stable version, run: + +## npm + +```sh +# TypeScript 3.9.2 or later +npm install tslib + +# TypeScript 3.8.4 or earlier +npm install tslib@^1 + +# TypeScript 2.3.2 or earlier +npm install tslib@1.6.1 +``` + +## yarn + +```sh +# TypeScript 3.9.2 or later +yarn add tslib + +# TypeScript 3.8.4 or earlier +yarn add tslib@^1 + +# TypeScript 2.3.2 or earlier +yarn add tslib@1.6.1 +``` + +## bower + +```sh +# TypeScript 3.9.2 or later +bower install tslib + +# TypeScript 3.8.4 or earlier +bower install tslib@^1 + +# TypeScript 2.3.2 or earlier +bower install tslib@1.6.1 +``` + +## JSPM + +```sh +# TypeScript 3.9.2 or later +jspm install tslib + +# TypeScript 3.8.4 or earlier +jspm install tslib@^1 + +# TypeScript 2.3.2 or earlier +jspm install tslib@1.6.1 +``` + +# Usage + +Set the `importHelpers` compiler option on the command line: + +``` +tsc --importHelpers file.ts +``` + +or in your tsconfig.json: + +```json +{ + "compilerOptions": { + "importHelpers": true + } +} +``` + +#### For bower and JSPM users + +You will need to add a `paths` mapping for `tslib`, e.g. For Bower users: + +```json +{ + "compilerOptions": { + "module": "amd", + "importHelpers": true, + "baseUrl": "./", + "paths": { + "tslib" : ["bower_components/tslib/tslib.d.ts"] + } + } +} +``` + +For JSPM users: + +```json +{ + "compilerOptions": { + "module": "system", + "importHelpers": true, + "baseUrl": "./", + "paths": { + "tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"] + } + } +} +``` + + +# Contribute + +There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript. + +* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. +* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). +* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). +* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. +* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). + +# Documentation + +* [Quick tutorial](http://www.typescriptlang.org/Tutorial) +* [Programming handbook](http://www.typescriptlang.org/Handbook) +* [Homepage](http://www.typescriptlang.org/) diff --git a/coc/extensions/node_modules/coc-go/node_modules/tslib/modules/index.js b/coc/extensions/node_modules/coc-go/node_modules/tslib/modules/index.js new file mode 100644 index 0000000..c5afe4f --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/tslib/modules/index.js @@ -0,0 +1,53 @@ +import tslib from '../tslib.js'; +const { + __extends, + __assign, + __rest, + __decorate, + __param, + __metadata, + __awaiter, + __generator, + __exportStar, + __createBinding, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, +} = tslib; +export { + __extends, + __assign, + __rest, + __decorate, + __param, + __metadata, + __awaiter, + __generator, + __exportStar, + __createBinding, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, +}; diff --git a/coc/extensions/node_modules/coc-go/node_modules/tslib/modules/package.json b/coc/extensions/node_modules/coc-go/node_modules/tslib/modules/package.json new file mode 100644 index 0000000..aafa0e4 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/tslib/modules/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/tslib/package.json b/coc/extensions/node_modules/coc-go/node_modules/tslib/package.json new file mode 100644 index 0000000..9259a85 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/tslib/package.json @@ -0,0 +1,37 @@ +{ + "name": "tslib", + "author": "Microsoft Corp.", + "homepage": "https://www.typescriptlang.org/", + "version": "2.1.0", + "license": "0BSD", + "description": "Runtime library for TypeScript helper functions", + "keywords": [ + "TypeScript", + "Microsoft", + "compiler", + "language", + "javascript", + "tslib", + "runtime" + ], + "bugs": { + "url": "https://github.com/Microsoft/TypeScript/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/tslib.git" + }, + "main": "tslib.js", + "module": "tslib.es6.js", + "jsnext:main": "tslib.es6.js", + "typings": "tslib.d.ts", + "sideEffects": false, + "exports": { + ".": { + "module": "./tslib.es6.js", + "import": "./modules/index.js", + "default": "./tslib.js" + }, + "./": "./" + } +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.d.ts b/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.d.ts new file mode 100644 index 0000000..3ad370a --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.d.ts @@ -0,0 +1,40 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +export declare function __extends(d: Function, b: Function): void; +export declare function __assign(t: any, ...sources: any[]): any; +export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; +export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; +export declare function __param(paramIndex: number, decorator: Function): Function; +export declare function __metadata(metadataKey: any, metadataValue: any): Function; +export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; +export declare function __generator(thisArg: any, body: Function): any; +export declare function __exportStar(m: any, o: any): void; +export declare function __values(o: any): any; +export declare function __read(o: any, n?: number): any[]; +/** @deprecated since TypeScript 4.2 */ +export declare function __spread(...args: any[][]): any[]; +/** @deprecated since TypeScript 4.2 */ +export declare function __spreadArrays(...args: any[][]): any[]; +export declare function __spreadArray(to: any[], from: any[]): any[]; +export declare function __await(v: any): any; +export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; +export declare function __asyncDelegator(o: any): any; +export declare function __asyncValues(o: any): any; +export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; +export declare function __importStar(mod: T): T; +export declare function __importDefault(mod: T): T | { default: T }; +export declare function __classPrivateFieldGet(receiver: T, privateMap: { has(o: T): boolean, get(o: T): V | undefined }): V; +export declare function __classPrivateFieldSet(receiver: T, privateMap: { has(o: T): boolean, set(o: T, value: V): any }, value: V): V; +export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void; diff --git a/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.es6.html b/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.es6.html new file mode 100644 index 0000000..b122e41 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.es6.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.es6.js b/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.es6.js new file mode 100644 index 0000000..bd73dce --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.es6.js @@ -0,0 +1,237 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +export function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +export var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +export function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} + +export function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +export function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +export function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +export function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +export function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +export var __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +export function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +export function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +export function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +/** @deprecated */ +export function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +/** @deprecated */ +export function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} + +export function __spreadArray(to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; +} + +export function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +export function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +export function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } +} + +export function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +export function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +export function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +} + +export function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +export function __classPrivateFieldGet(receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); +} + +export function __classPrivateFieldSet(receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.html b/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.html new file mode 100644 index 0000000..44c9ba5 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.js b/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.js new file mode 100644 index 0000000..4e2462e --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/tslib/tslib.js @@ -0,0 +1,304 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if (typeof module === "object" && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); +}); diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/.eslintignore b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/.eslintignore new file mode 100644 index 0000000..7951405 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/.eslintignore @@ -0,0 +1 @@ +lib \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/License.txt b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/License.txt new file mode 100644 index 0000000..a07e3ae --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/License.txt @@ -0,0 +1,11 @@ +Copyright (c) Microsoft Corporation + +All rights reserved. + +MIT License + +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/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/README.md b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/README.md new file mode 100644 index 0000000..3f51ee9 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/README.md @@ -0,0 +1,18 @@ +# Text Document implementation for a LSP Node server + +[![NPM Version](https://img.shields.io/npm/v/vscode-languageserver-textDocument.svg)](https://npmjs.org/package/vscode-languageserver-textDocument) +[![NPM Downloads](https://img.shields.io/npm/dm/vscode-languageserver-textDocument.svg)](https://npmjs.org/package/vscode-languageserver-textDocument) + +Npm module containing a simple text document implementation for [Node.js](https://nodejs.org/) language server + +Click [here](https://code.visualstudio.com/docs/extensions/example-language-server) for a detailed document on how +to implement language servers for [VSCode](https://code.visualstudio.com/). + +## History + +### 1.0.0 + +Initial version. + +## License +[MIT](https://github.com/Microsoft/vscode-languageserver-node/blob/master/License.txt) \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/esm/main.d.ts b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/esm/main.d.ts new file mode 100644 index 0000000..94b8c3c --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/esm/main.d.ts @@ -0,0 +1,180 @@ +/** + * A tagging type for string properties that are actually URIs. + */ +export declare type DocumentUri = string; +/** + * Position in a text document expressed as zero-based line and character offset. + * The offsets are based on a UTF-16 string representation. So a string of the form + * `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀` + * is 1 and the character offset of b is 3 since `𐐀` is represented using two code + * units in UTF-16. + * + * Positions are line end character agnostic. So you can not specify a position that + * denotes `\r|\n` or `\n|` where `|` represents the character offset. + */ +export interface Position { + /** + * Line position in a document (zero-based). + * If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. + * If a line number is negative, it defaults to 0. + */ + line: number; + /** + * Character offset on a line in a document (zero-based). Assuming that the line is + * represented as a string, the `character` value represents the gap between the + * `character` and `character + 1`. + * + * If the character value is greater than the line length it defaults back to the + * line length. + * If a line number is negative, it defaults to 0. + */ + character: number; +} +/** + * A range in a text document expressed as (zero-based) start and end positions. + * + * If you want to specify a range that contains a line including the line ending + * character(s) then use an end position denoting the start of the next line. + * For example: + * ```ts + * { + * start: { line: 5, character: 23 } + * end : { line 6, character : 0 } + * } + * ``` + */ +export interface Range { + /** + * The range's start position + */ + start: Position; + /** + * The range's end position. + */ + end: Position; +} +/** + * A text edit applicable to a text document. + */ +export interface TextEdit { + /** + * The range of the text document to be manipulated. To insert + * text into a document create a range where start === end. + */ + range: Range; + /** + * The string to be inserted. For delete operations use an + * empty string. + */ + newText: string; +} +/** + * An event describing a change to a text document. If range and rangeLength are omitted + * the new text is considered to be the full content of the document. + */ +export declare type TextDocumentContentChangeEvent = { + /** + * The range of the document that changed. + */ + range: Range; + /** + * The optional length of the range that got replaced. + * + * @deprecated use range instead. + */ + rangeLength?: number; + /** + * The new text for the provided range. + */ + text: string; +} | { + /** + * The new text of the whole document. + */ + text: string; +}; +/** + * A simple text document. Not to be implemented. The document keeps the content + * as string. + */ +export interface TextDocument { + /** + * The associated URI for this document. Most documents have the __file__-scheme, indicating that they + * represent files on disk. However, some documents may have other schemes indicating that they are not + * available on disk. + * + * @readonly + */ + readonly uri: DocumentUri; + /** + * The identifier of the language associated with this document. + * + * @readonly + */ + readonly languageId: string; + /** + * The version number of this document (it will increase after each + * change, including undo/redo). + * + * @readonly + */ + readonly version: number; + /** + * Get the text of this document. A substring can be retrieved by + * providing a range. + * + * @param range (optional) An range within the document to return. + * If no range is passed, the full content is returned. + * Invalid range positions are adjusted as described in [Position.line](#Position.line) + * and [Position.character](#Position.character). + * If the start range position is greater than the end range position, + * then the effect of getText is as if the two positions were swapped. + + * @return The text of this document or a substring of the text if a + * range is provided. + */ + getText(range?: Range): string; + /** + * Converts a zero-based offset to a position. + * + * @param offset A zero-based offset. + * @return A valid [position](#Position). + */ + positionAt(offset: number): Position; + /** + * Converts the position to a zero-based offset. + * Invalid positions are adjusted as described in [Position.line](#Position.line) + * and [Position.character](#Position.character). + * + * @param position A position. + * @return A valid zero-based offset. + */ + offsetAt(position: Position): number; + /** + * The number of lines in this document. + * + * @readonly + */ + readonly lineCount: number; +} +export declare namespace TextDocument { + /** + * Creates a new text document. + * + * @param uri The document's uri. + * @param languageId The document's language Id. + * @param version The document's initial version number. + * @param content The document's content. + */ + function create(uri: DocumentUri, languageId: string, version: number, content: string): TextDocument; + /** + * Updates a TextDocument by modifing its content. + * + * @param document the document to update. Only documents created by TextDocument.create are valid inputs. + * @param changes the changes to apply to the document. + * @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter. + * + */ + function update(document: TextDocument, changes: TextDocumentContentChangeEvent[], version: number): TextDocument; + function applyEdits(document: TextDocument, edits: TextEdit[]): string; +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/esm/main.js b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/esm/main.js new file mode 100644 index 0000000..38157f7 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/esm/main.js @@ -0,0 +1,269 @@ +/* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ +'use strict'; +var FullTextDocument = /** @class */ (function () { + function FullTextDocument(uri, languageId, version, content) { + this._uri = uri; + this._languageId = languageId; + this._version = version; + this._content = content; + this._lineOffsets = undefined; + } + Object.defineProperty(FullTextDocument.prototype, "uri", { + get: function () { + return this._uri; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(FullTextDocument.prototype, "languageId", { + get: function () { + return this._languageId; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(FullTextDocument.prototype, "version", { + get: function () { + return this._version; + }, + enumerable: true, + configurable: true + }); + FullTextDocument.prototype.getText = function (range) { + if (range) { + var start = this.offsetAt(range.start); + var end = this.offsetAt(range.end); + return this._content.substring(start, end); + } + return this._content; + }; + FullTextDocument.prototype.update = function (changes, version) { + for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) { + var change = changes_1[_i]; + if (FullTextDocument.isIncremental(change)) { + // makes sure start is before end + var range = getWellformedRange(change.range); + // update content + var startOffset = this.offsetAt(range.start); + var endOffset = this.offsetAt(range.end); + this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length); + // update the offsets + var startLine = Math.max(range.start.line, 0); + var endLine = Math.max(range.end.line, 0); + var lineOffsets = this._lineOffsets; + var addedLineOffsets = computeLineOffsets(change.text, false, startOffset); + if (endLine - startLine === addedLineOffsets.length) { + for (var i = 0, len = addedLineOffsets.length; i < len; i++) { + lineOffsets[i + startLine + 1] = addedLineOffsets[i]; + } + } + else { + if (addedLineOffsets.length < 10000) { + lineOffsets.splice.apply(lineOffsets, [startLine + 1, endLine - startLine].concat(addedLineOffsets)); + } + else { // avoid too many arguments for splice + this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1)); + } + } + var diff = change.text.length - (endOffset - startOffset); + if (diff !== 0) { + for (var i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) { + lineOffsets[i] = lineOffsets[i] + diff; + } + } + } + else if (FullTextDocument.isFull(change)) { + this._content = change.text; + this._lineOffsets = undefined; + } + else { + throw new Error('Unknown change event received'); + } + } + this._version = version; + }; + FullTextDocument.prototype.getLineOffsets = function () { + if (this._lineOffsets === undefined) { + this._lineOffsets = computeLineOffsets(this._content, true); + } + return this._lineOffsets; + }; + FullTextDocument.prototype.positionAt = function (offset) { + offset = Math.max(Math.min(offset, this._content.length), 0); + var lineOffsets = this.getLineOffsets(); + var low = 0, high = lineOffsets.length; + if (high === 0) { + return { line: 0, character: offset }; + } + while (low < high) { + var mid = Math.floor((low + high) / 2); + if (lineOffsets[mid] > offset) { + high = mid; + } + else { + low = mid + 1; + } + } + // low is the least x for which the line offset is larger than the current offset + // or array.length if no line offset is larger than the current offset + var line = low - 1; + return { line: line, character: offset - lineOffsets[line] }; + }; + FullTextDocument.prototype.offsetAt = function (position) { + var lineOffsets = this.getLineOffsets(); + if (position.line >= lineOffsets.length) { + return this._content.length; + } + else if (position.line < 0) { + return 0; + } + var lineOffset = lineOffsets[position.line]; + var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length; + return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); + }; + Object.defineProperty(FullTextDocument.prototype, "lineCount", { + get: function () { + return this.getLineOffsets().length; + }, + enumerable: true, + configurable: true + }); + FullTextDocument.isIncremental = function (event) { + var candidate = event; + return candidate !== undefined && candidate !== null && + typeof candidate.text === 'string' && candidate.range !== undefined && + (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number'); + }; + FullTextDocument.isFull = function (event) { + var candidate = event; + return candidate !== undefined && candidate !== null && + typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined; + }; + return FullTextDocument; +}()); +export var TextDocument; +(function (TextDocument) { + /** + * Creates a new text document. + * + * @param uri The document's uri. + * @param languageId The document's language Id. + * @param version The document's initial version number. + * @param content The document's content. + */ + function create(uri, languageId, version, content) { + return new FullTextDocument(uri, languageId, version, content); + } + TextDocument.create = create; + /** + * Updates a TextDocument by modifing its content. + * + * @param document the document to update. Only documents created by TextDocument.create are valid inputs. + * @param changes the changes to apply to the document. + * @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter. + * + */ + function update(document, changes, version) { + if (document instanceof FullTextDocument) { + document.update(changes, version); + return document; + } + else { + throw new Error('TextDocument.update: document must be created by TextDocument.create'); + } + } + TextDocument.update = update; + function applyEdits(document, edits) { + var text = document.getText(); + var sortedEdits = mergeSort(edits.map(getWellformedEdit), function (a, b) { + var diff = a.range.start.line - b.range.start.line; + if (diff === 0) { + return a.range.start.character - b.range.start.character; + } + return diff; + }); + var lastModifiedOffset = 0; + var spans = []; + for (var _i = 0, sortedEdits_1 = sortedEdits; _i < sortedEdits_1.length; _i++) { + var e = sortedEdits_1[_i]; + var startOffset = document.offsetAt(e.range.start); + if (startOffset < lastModifiedOffset) { + throw new Error('Overlapping edit'); + } + else if (startOffset > lastModifiedOffset) { + spans.push(text.substring(lastModifiedOffset, startOffset)); + } + if (e.newText.length) { + spans.push(e.newText); + } + lastModifiedOffset = document.offsetAt(e.range.end); + } + spans.push(text.substr(lastModifiedOffset)); + return spans.join(''); + } + TextDocument.applyEdits = applyEdits; +})(TextDocument || (TextDocument = {})); +function mergeSort(data, compare) { + if (data.length <= 1) { + // sorted + return data; + } + var p = (data.length / 2) | 0; + var left = data.slice(0, p); + var right = data.slice(p); + mergeSort(left, compare); + mergeSort(right, compare); + var leftIdx = 0; + var rightIdx = 0; + var i = 0; + while (leftIdx < left.length && rightIdx < right.length) { + var ret = compare(left[leftIdx], right[rightIdx]); + if (ret <= 0) { + // smaller_equal -> take left to preserve order + data[i++] = left[leftIdx++]; + } + else { + // greater -> take right + data[i++] = right[rightIdx++]; + } + } + while (leftIdx < left.length) { + data[i++] = left[leftIdx++]; + } + while (rightIdx < right.length) { + data[i++] = right[rightIdx++]; + } + return data; +} +function computeLineOffsets(text, isAtLineStart, textOffset) { + if (textOffset === void 0) { textOffset = 0; } + var result = isAtLineStart ? [textOffset] : []; + for (var i = 0; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (ch === 13 /* CarriageReturn */ || ch === 10 /* LineFeed */) { + if (ch === 13 /* CarriageReturn */ && i + 1 < text.length && text.charCodeAt(i + 1) === 10 /* LineFeed */) { + i++; + } + result.push(textOffset + i + 1); + } + } + return result; +} +function getWellformedRange(range) { + var start = range.start; + var end = range.end; + if (start.line > end.line || (start.line === end.line && start.character > end.character)) { + return { start: end, end: start }; + } + return range; +} +function getWellformedEdit(textEdit) { + var range = getWellformedRange(textEdit.range); + if (range !== textEdit.range) { + return { newText: textEdit.newText, range: range }; + } + return textEdit; +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/tsconfig.esm.tsbuildInfo b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/tsconfig.esm.tsbuildInfo new file mode 100644 index 0000000..6aed0ac --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/tsconfig.esm.tsbuildInfo @@ -0,0 +1,403 @@ +{ + "program": { + "fileInfos": { + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es5.d.ts": { + "version": "1f753cee573dea40df8a9dc873fef5566957b19ad513874f6643d8dfb14842d0", + "signature": "1f753cee573dea40df8a9dc873fef5566957b19ad513874f6643d8dfb14842d0" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.d.ts": { + "version": "7994d44005046d1413ea31d046577cdda33b8b2470f30281fd9c8b3c99fe2d96", + "signature": "7994d44005046d1413ea31d046577cdda33b8b2470f30281fd9c8b3c99fe2d96" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.d.ts": { + "version": "5f217838d25704474d9ef93774f04164889169ca31475fe423a9de6758f058d1", + "signature": "5f217838d25704474d9ef93774f04164889169ca31475fe423a9de6758f058d1" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.d.ts": { + "version": "459097c7bdd88fc5731367e56591e4f465f2c9de81a35427a7bd473165c34743", + "signature": "459097c7bdd88fc5731367e56591e4f465f2c9de81a35427a7bd473165c34743" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.core.d.ts": { + "version": "2a0390a665763bcc90f0670e43c587928d8fefe2a94a11209c1e22cba7b09f52", + "signature": "2a0390a665763bcc90f0670e43c587928d8fefe2a94a11209c1e22cba7b09f52" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.collection.d.ts": { + "version": "dd94d8ef48c562389eb58af8df3a3a34d11367f7c818192aa5f16470d469e3f0", + "signature": "dd94d8ef48c562389eb58af8df3a3a34d11367f7c818192aa5f16470d469e3f0" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.generator.d.ts": { + "version": "828413486bdcaa342558e8e4570b1b287b776cb61b4b70b0214bd10c5d9a94c3", + "signature": "828413486bdcaa342558e8e4570b1b287b776cb61b4b70b0214bd10c5d9a94c3" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.iterable.d.ts": { + "version": "6c9f73334f8bf47aea685ca5b46a8f7e992a223e96fbceb030f26a4d2324ba21", + "signature": "6c9f73334f8bf47aea685ca5b46a8f7e992a223e96fbceb030f26a4d2324ba21" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.promise.d.ts": { + "version": "e6b8ff2798f8ebd7a1c7afd8671f2cb67ee1901c422f5964d74b0b34c6574ea2", + "signature": "e6b8ff2798f8ebd7a1c7afd8671f2cb67ee1901c422f5964d74b0b34c6574ea2" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.proxy.d.ts": { + "version": "5e72f949a89717db444e3bd9433468890068bb21a5638d8ab15a1359e05e54fe", + "signature": "5e72f949a89717db444e3bd9433468890068bb21a5638d8ab15a1359e05e54fe" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.reflect.d.ts": { + "version": "f5b242136ae9bfb1cc99a5971cccc44e99947ae6b5ef6fd8aa54b5ade553b976", + "signature": "f5b242136ae9bfb1cc99a5971cccc44e99947ae6b5ef6fd8aa54b5ade553b976" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.d.ts": { + "version": "9ae2860252d6b5f16e2026d8a2c2069db7b2a3295e98b6031d01337b96437230", + "signature": "9ae2860252d6b5f16e2026d8a2c2069db7b2a3295e98b6031d01337b96437230" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts": { + "version": "3e0a459888f32b42138d5a39f706ff2d55d500ab1031e0988b5568b0f67c2303", + "signature": "3e0a459888f32b42138d5a39f706ff2d55d500ab1031e0988b5568b0f67c2303" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.array.include.d.ts": { + "version": "3f96f1e570aedbd97bf818c246727151e873125d0512e4ae904330286c721bc0", + "signature": "3f96f1e570aedbd97bf818c246727151e873125d0512e4ae904330286c721bc0" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.object.d.ts": { + "version": "ff8ad203e83338289b0f5defc1a5b5c253fb7d251b464db497383f915a0df3f4", + "signature": "ff8ad203e83338289b0f5defc1a5b5c253fb7d251b464db497383f915a0df3f4" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts": { + "version": "b8667586a618c5cf64523d4e500ae39e781428abfb28f3de441fc66b56144b6f", + "signature": "b8667586a618c5cf64523d4e500ae39e781428abfb28f3de441fc66b56144b6f" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.string.d.ts": { + "version": "21df2e0059f14dcb4c3a0e125859f6b6ff01332ee24b0065a741d121250bc71c", + "signature": "21df2e0059f14dcb4c3a0e125859f6b6ff01332ee24b0065a741d121250bc71c" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.intl.d.ts": { + "version": "c1759cb171c7619af0d2234f2f8fb2a871ee88e956e2ed91bb61778e41f272c6", + "signature": "c1759cb171c7619af0d2234f2f8fb2a871ee88e956e2ed91bb61778e41f272c6" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts": { + "version": "28569d59e07d4378cb3d54979c4c60f9f06305c9bb6999ffe6cab758957adc46", + "signature": "28569d59e07d4378cb3d54979c4c60f9f06305c9bb6999ffe6cab758957adc46" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts": { + "version": "bf170fa7aee80f09f393a5350184a5bb6e2addb0410f6c9e023280d18c7472aa", + "signature": "21f9731fc2e8e009fdaef137a04546c27877314c748c6702fe9329518fb16538" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/helper.ts": { + "version": "9fecfa38d5d803f40f5e43b6d251678305cae462985305cbc2f2707ab32e7dfa", + "signature": "7514b3fa0996de70bba147262edffd3136aea07e654b60d50defbde16e4fca56" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/edits.test.ts": { + "version": "51ba23f23c0999b2ab2cdcc688e8e5c02a991ea73040e843412b3b2148fc8535", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/textdocument.test.ts": { + "version": "6340b7c97c8d92c59eeececad5d086ad893eda125d2445ba6637bfaea6d9f05c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/eslint-visitor-keys/index.d.ts": { + "version": "725d9be2fd48440256f4deb00649adffdbc5ecd282b09e89d4e200663792c34c", + "signature": "725d9be2fd48440256f4deb00649adffdbc5ecd282b09e89d4e200663792c34c" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/json-schema/index.d.ts": { + "version": "751b8d5b85eee82bd38964a6ff43e89e61a586c64f653e3d1eb8fa7eb372ed30", + "signature": "751b8d5b85eee82bd38964a6ff43e89e61a586c64f653e3d1eb8fa7eb372ed30" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/mocha/index.d.ts": { + "version": "d93bdd7313bdc64d926cd1429bdb9a979037240e89995fddbc6817075bbfe502", + "signature": "d93bdd7313bdc64d926cd1429bdb9a979037240e89995fddbc6817075bbfe502" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/inspector.d.ts": { + "version": "7e49dbf1543b3ee54853ade4c5e9fa460b6a4eca967efe6bf943e0c505d087ed", + "signature": "7e49dbf1543b3ee54853ade4c5e9fa460b6a4eca967efe6bf943e0c505d087ed" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts": { + "version": "f377ba987daec87eee5f3dcf798bca328f3c24a7da1ad5120382b3cbe222a501", + "signature": "f377ba987daec87eee5f3dcf798bca328f3c24a7da1ad5120382b3cbe222a501" + }, + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts": { + "version": "1de0ff6200b92798a5aef43f57029c79dbf69932037dee1c007fdd2c562db258", + "signature": "1de0ff6200b92798a5aef43f57029c79dbf69932037dee1c007fdd2c562db258" + } + }, + "options": { + "strictNullChecks": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "target": 1, + "module": 5, + "sourceMap": false, + "declaration": true, + "stripInternal": true, + "lib": [ + "lib.es2015.d.ts" + ], + "outDir": "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/lib/esm", + "incremental": true, + "tsBuildInfoFile": "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/lib/tsconfig.esm.tsbuildInfo", + "rootDir": "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src", + "configFilePath": "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/tsconfig.esm.json" + }, + "referencedMap": { + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es5.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.core.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.collection.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.generator.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.iterable.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.promise.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.proxy.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.reflect.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.array.include.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.object.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.string.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.intl.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/helper.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/edits.test.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/helper.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/textdocument.test.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/helper.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/eslint-visitor-keys/index.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/json-schema/index.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/mocha/index.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/inspector.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/inspector.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts" + ] + }, + "exportedModulesMap": { + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es5.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.core.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.collection.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.generator.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.iterable.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.promise.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.proxy.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.reflect.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.array.include.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.object.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.string.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.intl.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/helper.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/eslint-visitor-keys/index.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/json-schema/index.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/mocha/index.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/inspector.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/inspector.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ], + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es5.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.core.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.collection.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.generator.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.iterable.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.promise.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.proxy.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.reflect.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.array.include.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.object.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.string.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.intl.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/helper.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/edits.test.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/textdocument.test.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/eslint-visitor-keys/index.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/json-schema/index.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/mocha/index.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/inspector.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts", + "/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts" + ] + }, + "version": "3.5.3" +} \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/umd/main.d.ts b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/umd/main.d.ts new file mode 100644 index 0000000..94b8c3c --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/umd/main.d.ts @@ -0,0 +1,180 @@ +/** + * A tagging type for string properties that are actually URIs. + */ +export declare type DocumentUri = string; +/** + * Position in a text document expressed as zero-based line and character offset. + * The offsets are based on a UTF-16 string representation. So a string of the form + * `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀` + * is 1 and the character offset of b is 3 since `𐐀` is represented using two code + * units in UTF-16. + * + * Positions are line end character agnostic. So you can not specify a position that + * denotes `\r|\n` or `\n|` where `|` represents the character offset. + */ +export interface Position { + /** + * Line position in a document (zero-based). + * If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. + * If a line number is negative, it defaults to 0. + */ + line: number; + /** + * Character offset on a line in a document (zero-based). Assuming that the line is + * represented as a string, the `character` value represents the gap between the + * `character` and `character + 1`. + * + * If the character value is greater than the line length it defaults back to the + * line length. + * If a line number is negative, it defaults to 0. + */ + character: number; +} +/** + * A range in a text document expressed as (zero-based) start and end positions. + * + * If you want to specify a range that contains a line including the line ending + * character(s) then use an end position denoting the start of the next line. + * For example: + * ```ts + * { + * start: { line: 5, character: 23 } + * end : { line 6, character : 0 } + * } + * ``` + */ +export interface Range { + /** + * The range's start position + */ + start: Position; + /** + * The range's end position. + */ + end: Position; +} +/** + * A text edit applicable to a text document. + */ +export interface TextEdit { + /** + * The range of the text document to be manipulated. To insert + * text into a document create a range where start === end. + */ + range: Range; + /** + * The string to be inserted. For delete operations use an + * empty string. + */ + newText: string; +} +/** + * An event describing a change to a text document. If range and rangeLength are omitted + * the new text is considered to be the full content of the document. + */ +export declare type TextDocumentContentChangeEvent = { + /** + * The range of the document that changed. + */ + range: Range; + /** + * The optional length of the range that got replaced. + * + * @deprecated use range instead. + */ + rangeLength?: number; + /** + * The new text for the provided range. + */ + text: string; +} | { + /** + * The new text of the whole document. + */ + text: string; +}; +/** + * A simple text document. Not to be implemented. The document keeps the content + * as string. + */ +export interface TextDocument { + /** + * The associated URI for this document. Most documents have the __file__-scheme, indicating that they + * represent files on disk. However, some documents may have other schemes indicating that they are not + * available on disk. + * + * @readonly + */ + readonly uri: DocumentUri; + /** + * The identifier of the language associated with this document. + * + * @readonly + */ + readonly languageId: string; + /** + * The version number of this document (it will increase after each + * change, including undo/redo). + * + * @readonly + */ + readonly version: number; + /** + * Get the text of this document. A substring can be retrieved by + * providing a range. + * + * @param range (optional) An range within the document to return. + * If no range is passed, the full content is returned. + * Invalid range positions are adjusted as described in [Position.line](#Position.line) + * and [Position.character](#Position.character). + * If the start range position is greater than the end range position, + * then the effect of getText is as if the two positions were swapped. + + * @return The text of this document or a substring of the text if a + * range is provided. + */ + getText(range?: Range): string; + /** + * Converts a zero-based offset to a position. + * + * @param offset A zero-based offset. + * @return A valid [position](#Position). + */ + positionAt(offset: number): Position; + /** + * Converts the position to a zero-based offset. + * Invalid positions are adjusted as described in [Position.line](#Position.line) + * and [Position.character](#Position.character). + * + * @param position A position. + * @return A valid zero-based offset. + */ + offsetAt(position: Position): number; + /** + * The number of lines in this document. + * + * @readonly + */ + readonly lineCount: number; +} +export declare namespace TextDocument { + /** + * Creates a new text document. + * + * @param uri The document's uri. + * @param languageId The document's language Id. + * @param version The document's initial version number. + * @param content The document's content. + */ + function create(uri: DocumentUri, languageId: string, version: number, content: string): TextDocument; + /** + * Updates a TextDocument by modifing its content. + * + * @param document the document to update. Only documents created by TextDocument.create are valid inputs. + * @param changes the changes to apply to the document. + * @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter. + * + */ + function update(document: TextDocument, changes: TextDocumentContentChangeEvent[], version: number): TextDocument; + function applyEdits(document: TextDocument, edits: TextEdit[]): string; +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/umd/main.js b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/umd/main.js new file mode 100644 index 0000000..315dedd --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/lib/umd/main.js @@ -0,0 +1,280 @@ +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; + } + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); + } +})(function (require, exports) { + /* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ + 'use strict'; + Object.defineProperty(exports, "__esModule", { value: true }); + var FullTextDocument = /** @class */ (function () { + function FullTextDocument(uri, languageId, version, content) { + this._uri = uri; + this._languageId = languageId; + this._version = version; + this._content = content; + this._lineOffsets = undefined; + } + Object.defineProperty(FullTextDocument.prototype, "uri", { + get: function () { + return this._uri; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(FullTextDocument.prototype, "languageId", { + get: function () { + return this._languageId; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(FullTextDocument.prototype, "version", { + get: function () { + return this._version; + }, + enumerable: true, + configurable: true + }); + FullTextDocument.prototype.getText = function (range) { + if (range) { + var start = this.offsetAt(range.start); + var end = this.offsetAt(range.end); + return this._content.substring(start, end); + } + return this._content; + }; + FullTextDocument.prototype.update = function (changes, version) { + for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) { + var change = changes_1[_i]; + if (FullTextDocument.isIncremental(change)) { + // makes sure start is before end + var range = getWellformedRange(change.range); + // update content + var startOffset = this.offsetAt(range.start); + var endOffset = this.offsetAt(range.end); + this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length); + // update the offsets + var startLine = Math.max(range.start.line, 0); + var endLine = Math.max(range.end.line, 0); + var lineOffsets = this._lineOffsets; + var addedLineOffsets = computeLineOffsets(change.text, false, startOffset); + if (endLine - startLine === addedLineOffsets.length) { + for (var i = 0, len = addedLineOffsets.length; i < len; i++) { + lineOffsets[i + startLine + 1] = addedLineOffsets[i]; + } + } + else { + if (addedLineOffsets.length < 10000) { + lineOffsets.splice.apply(lineOffsets, [startLine + 1, endLine - startLine].concat(addedLineOffsets)); + } + else { // avoid too many arguments for splice + this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1)); + } + } + var diff = change.text.length - (endOffset - startOffset); + if (diff !== 0) { + for (var i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) { + lineOffsets[i] = lineOffsets[i] + diff; + } + } + } + else if (FullTextDocument.isFull(change)) { + this._content = change.text; + this._lineOffsets = undefined; + } + else { + throw new Error('Unknown change event received'); + } + } + this._version = version; + }; + FullTextDocument.prototype.getLineOffsets = function () { + if (this._lineOffsets === undefined) { + this._lineOffsets = computeLineOffsets(this._content, true); + } + return this._lineOffsets; + }; + FullTextDocument.prototype.positionAt = function (offset) { + offset = Math.max(Math.min(offset, this._content.length), 0); + var lineOffsets = this.getLineOffsets(); + var low = 0, high = lineOffsets.length; + if (high === 0) { + return { line: 0, character: offset }; + } + while (low < high) { + var mid = Math.floor((low + high) / 2); + if (lineOffsets[mid] > offset) { + high = mid; + } + else { + low = mid + 1; + } + } + // low is the least x for which the line offset is larger than the current offset + // or array.length if no line offset is larger than the current offset + var line = low - 1; + return { line: line, character: offset - lineOffsets[line] }; + }; + FullTextDocument.prototype.offsetAt = function (position) { + var lineOffsets = this.getLineOffsets(); + if (position.line >= lineOffsets.length) { + return this._content.length; + } + else if (position.line < 0) { + return 0; + } + var lineOffset = lineOffsets[position.line]; + var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length; + return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); + }; + Object.defineProperty(FullTextDocument.prototype, "lineCount", { + get: function () { + return this.getLineOffsets().length; + }, + enumerable: true, + configurable: true + }); + FullTextDocument.isIncremental = function (event) { + var candidate = event; + return candidate !== undefined && candidate !== null && + typeof candidate.text === 'string' && candidate.range !== undefined && + (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number'); + }; + FullTextDocument.isFull = function (event) { + var candidate = event; + return candidate !== undefined && candidate !== null && + typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined; + }; + return FullTextDocument; + }()); + var TextDocument; + (function (TextDocument) { + /** + * Creates a new text document. + * + * @param uri The document's uri. + * @param languageId The document's language Id. + * @param version The document's initial version number. + * @param content The document's content. + */ + function create(uri, languageId, version, content) { + return new FullTextDocument(uri, languageId, version, content); + } + TextDocument.create = create; + /** + * Updates a TextDocument by modifing its content. + * + * @param document the document to update. Only documents created by TextDocument.create are valid inputs. + * @param changes the changes to apply to the document. + * @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter. + * + */ + function update(document, changes, version) { + if (document instanceof FullTextDocument) { + document.update(changes, version); + return document; + } + else { + throw new Error('TextDocument.update: document must be created by TextDocument.create'); + } + } + TextDocument.update = update; + function applyEdits(document, edits) { + var text = document.getText(); + var sortedEdits = mergeSort(edits.map(getWellformedEdit), function (a, b) { + var diff = a.range.start.line - b.range.start.line; + if (diff === 0) { + return a.range.start.character - b.range.start.character; + } + return diff; + }); + var lastModifiedOffset = 0; + var spans = []; + for (var _i = 0, sortedEdits_1 = sortedEdits; _i < sortedEdits_1.length; _i++) { + var e = sortedEdits_1[_i]; + var startOffset = document.offsetAt(e.range.start); + if (startOffset < lastModifiedOffset) { + throw new Error('Overlapping edit'); + } + else if (startOffset > lastModifiedOffset) { + spans.push(text.substring(lastModifiedOffset, startOffset)); + } + if (e.newText.length) { + spans.push(e.newText); + } + lastModifiedOffset = document.offsetAt(e.range.end); + } + spans.push(text.substr(lastModifiedOffset)); + return spans.join(''); + } + TextDocument.applyEdits = applyEdits; + })(TextDocument = exports.TextDocument || (exports.TextDocument = {})); + function mergeSort(data, compare) { + if (data.length <= 1) { + // sorted + return data; + } + var p = (data.length / 2) | 0; + var left = data.slice(0, p); + var right = data.slice(p); + mergeSort(left, compare); + mergeSort(right, compare); + var leftIdx = 0; + var rightIdx = 0; + var i = 0; + while (leftIdx < left.length && rightIdx < right.length) { + var ret = compare(left[leftIdx], right[rightIdx]); + if (ret <= 0) { + // smaller_equal -> take left to preserve order + data[i++] = left[leftIdx++]; + } + else { + // greater -> take right + data[i++] = right[rightIdx++]; + } + } + while (leftIdx < left.length) { + data[i++] = left[leftIdx++]; + } + while (rightIdx < right.length) { + data[i++] = right[rightIdx++]; + } + return data; + } + function computeLineOffsets(text, isAtLineStart, textOffset) { + if (textOffset === void 0) { textOffset = 0; } + var result = isAtLineStart ? [textOffset] : []; + for (var i = 0; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (ch === 13 /* CarriageReturn */ || ch === 10 /* LineFeed */) { + if (ch === 13 /* CarriageReturn */ && i + 1 < text.length && text.charCodeAt(i + 1) === 10 /* LineFeed */) { + i++; + } + result.push(textOffset + i + 1); + } + } + return result; + } + function getWellformedRange(range) { + var start = range.start; + var end = range.end; + if (start.line > end.line || (start.line === end.line && start.character > end.character)) { + return { start: end, end: start }; + } + return range; + } + function getWellformedEdit(textEdit) { + var range = getWellformedRange(textEdit.range); + if (range !== textEdit.range) { + return { newText: textEdit.newText, range: range }; + } + return textEdit; + } +}); diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/package.json b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/package.json new file mode 100644 index 0000000..aab9c28 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/package.json @@ -0,0 +1,28 @@ +{ + "name": "vscode-languageserver-textdocument", + "description": "A simple text document implementation for Node LSP servers", + "version": "1.0.1", + "author": "Microsoft Corporation", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/vscode-languageserver-node.git", + "directory": "textDocument" + }, + "bugs": { + "url": "https://github.com/Microsoft/vscode-languageserver-node/issues" + }, + "main": "./lib/umd/main.js", + "typings": "./lib/umd/main", + "module": "./lib/esm/main.js", + "scripts": { + "prepublishOnly": "npm run clean && npm run compile-esm && npm run compile && npm run test", + "postpublish": "node ../build/npm/post-publish.js", + "compile": "node ../build/bin/tsc -b ./tsconfig.json", + "compile-esm": "node ../build/bin/tsc -b ./tsconfig.esm.json", + "clean": "node ../node_modules/rimraf/bin.js lib", + "watch": "node ../build/bin/tsc -b ./tsconfig.json -w", + "test": "node ../node_modules/mocha/bin/_mocha", + "preversion": "npm test" + } +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/tsconfig.esm.json b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/tsconfig.esm.json new file mode 100644 index 0000000..0aff94b --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-languageserver-textdocument/tsconfig.esm.json @@ -0,0 +1,18 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "target": "es5", + "module": "es6", + "sourceMap": false, + "declaration": true, + "stripInternal": true, + "lib": [ "es2015" ], + "outDir": "lib/esm", + "incremental": true, + "tsBuildInfoFile":"./lib/tsconfig.esm.tsbuildInfo", + "rootDir": "src" + }, + "include": [ + "src" + ] +} \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/LICENSE.md b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/LICENSE.md new file mode 100644 index 0000000..29db530 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/LICENSE.md @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) Microsoft + +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/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/README.md b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/README.md new file mode 100644 index 0000000..ee7b725 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/README.md @@ -0,0 +1,67 @@ +## vscode-uri + +[![Build Status](https://travis-ci.org/Microsoft/vscode-uri.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-uri) + +This module contains the URI implementation that is used by VS Code and its extensions. +It has support for parsing a string into `scheme`, `authority`, `path`, `query`, and +`fragment` URI components as defined in: http://tools.ietf.org/html/rfc3986 + +``` + foo://example.com:8042/over/there?name=ferret#nose + \_/ \______________/\_________/ \_________/ \__/ + | | | | | +scheme authority path query fragment + | _____________________|__ + / \ / \ + urn:example:animal:ferret:nose +``` + +## Usage + +```js +import { URI } from 'vscode-uri' + +// parse an URI from string + +let uri = URI.parse('https://code.visualstudio.com/docs/extensions/overview#frag') + +assert.ok(uri.scheme === 'https'); +assert.ok(uri.authority === 'code.visualstudio.com'); +assert.ok(uri.path === '/docs/extensions/overview'); +assert.ok(uri.query === ''); +assert.ok(uri.fragment === 'frag'); +assert.ok(uri.toString() === 'https://code.visualstudio.com/docs/extensions/overview#frag') + + +// create an URI from a fs path + +let uri = URI.file('/users/me/c#-projects/'); + +assert.ok(uri.scheme === 'file'); +assert.ok(uri.authority === ''); +assert.ok(uri.path === '/users/me/c#-projects/'); +assert.ok(uri.query === ''); +assert.ok(uri.fragment === ''); +assert.ok(uri.toString() === 'file:///users/me/c%23-projects/') +``` + +## Usage: Util + +This module also exports a `Utils` package which is an extension, not part of `vscode.Uri`, and useful for path-math. There is: + +* `Utils.joinPath(URI, paths): URI` +* `Utils.resolvePath(URI, paths): URI` +* `Utils.dirname(URI): string` +* `Utils.basename(URI): string` +* `Utils.extname(URI): string` + +All util use posix path-math as defined by the node.js path module. + + +## Contributing + +The source of this module is taken straight from the [vscode](https://github.com/microsoft/vscode)-sources and because of that issues and pull request should be created in that repository. Thanks and Happy Coding! + +## Code of Conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/esm/index.js b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/esm/index.js new file mode 100644 index 0000000..9b39052 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/esm/index.js @@ -0,0 +1,2 @@ +var LIB;LIB=(()=>{"use strict";var t={470:t=>{function e(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function r(t,e){for(var r,n="",o=0,i=-1,a=0,h=0;h<=t.length;++h){if(h2){var s=n.lastIndexOf("/");if(s!==n.length-1){-1===s?(n="",o=0):o=(n=n.slice(0,s)).length-1-n.lastIndexOf("/"),i=h,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=h,a=0;continue}e&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+t.slice(i+1,h):n=t.slice(i+1,h),o=h-i-1;i=h,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var n={resolve:function(){for(var t,n="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var a;i>=0?a=arguments[i]:(void 0===t&&(t=process.cwd()),a=t),e(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0))}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(t){if(e(t),0===t.length)return".";var n=47===t.charCodeAt(0),o=47===t.charCodeAt(t.length-1);return 0!==(t=r(t,!n)).length||n||(t="."),t.length>0&&o&&(t+="/"),n?"/"+t:t},isAbsolute:function(t){return e(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,r=0;r0&&(void 0===t?t=o:t+="/"+o)}return void 0===t?".":n.normalize(t)},relative:function(t,r){if(e(t),e(r),t===r)return"";if((t=n.resolve(t))===(r=n.resolve(r)))return"";for(var o=1;of){if(47===r.charCodeAt(h+c))return r.slice(h+c+1);if(0===c)return r.slice(h+c)}else a>f&&(47===t.charCodeAt(o+c)?u=c:0===c&&(u=0));break}var l=t.charCodeAt(o+c);if(l!==r.charCodeAt(h+c))break;47===l&&(u=c)}var p="";for(c=o+u+1;c<=i;++c)c!==i&&47!==t.charCodeAt(c)||(0===p.length?p+="..":p+="/..");return p.length>0?p+r.slice(h+u):(h+=u,47===r.charCodeAt(h)&&++h,r.slice(h))},_makeLong:function(t){return t},dirname:function(t){if(e(t),0===t.length)return".";for(var r=t.charCodeAt(0),n=47===r,o=-1,i=!0,a=t.length-1;a>=1;--a)if(47===(r=t.charCodeAt(a))){if(!i){o=a;break}}else i=!1;return-1===o?n?"/":".":n&&1===o?"//":t.slice(0,o)},basename:function(t,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');e(t);var n,o=0,i=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=t.length){if(r.length===t.length&&r===t)return"";var h=r.length-1,s=-1;for(n=t.length-1;n>=0;--n){var f=t.charCodeAt(n);if(47===f){if(!a){o=n+1;break}}else-1===s&&(a=!1,s=n+1),h>=0&&(f===r.charCodeAt(h)?-1==--h&&(i=n):(h=-1,i=s))}return o===i?i=s:-1===i&&(i=t.length),t.slice(o,i)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!a){o=n+1;break}}else-1===i&&(a=!1,i=n+1);return-1===i?"":t.slice(o,i)},extname:function(t){e(t);for(var r=-1,n=0,o=-1,i=!0,a=0,h=t.length-1;h>=0;--h){var s=t.charCodeAt(h);if(47!==s)-1===o&&(i=!1,o=h+1),46===s?-1===r?r=h:1!==a&&(a=1):-1!==r&&(a=-1);else if(!i){n=h+1;break}}return-1===r||-1===o||0===a||1===a&&r===o-1&&r===n+1?"":t.slice(r,o)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+"/"+n:n}(0,t)},parse:function(t){e(t);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return r;var n,o=t.charCodeAt(0),i=47===o;i?(r.root="/",n=1):n=0;for(var a=-1,h=0,s=-1,f=!0,u=t.length-1,c=0;u>=n;--u)if(47!==(o=t.charCodeAt(u)))-1===s&&(f=!1,s=u+1),46===o?-1===a?a=u:1!==c&&(c=1):-1!==a&&(c=-1);else if(!f){h=u+1;break}return-1===a||-1===s||0===c||1===c&&a===s-1&&a===h+1?-1!==s&&(r.base=r.name=0===h&&i?t.slice(1,s):t.slice(h,s)):(0===h&&i?(r.name=t.slice(1,a),r.base=t.slice(1,s)):(r.name=t.slice(h,a),r.base=t.slice(h,s)),r.ext=t.slice(a,s)),h>0?r.dir=t.slice(0,h-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,t.exports=n},447:(t,e,r)=>{var n;if(r.r(e),r.d(e,{URI:()=>g,Utils:()=>O}),"object"==typeof process)n="win32"===process.platform;else if("object"==typeof navigator){var o=navigator.userAgent;n=o.indexOf("Windows")>=0}var i,a,h=(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=/^\w[\w\d+.-]*$/,f=/^\//,u=/^\/\//,c="",l="/",p=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,g=function(){function t(t,e,r,n,o,i){void 0===i&&(i=!1),"object"==typeof t?(this.scheme=t.scheme||c,this.authority=t.authority||c,this.path=t.path||c,this.query=t.query||c,this.fragment=t.fragment||c):(this.scheme=function(t,e){return t||e?t:"file"}(t,i),this.authority=e||c,this.path=function(t,e){switch(t){case"https":case"http":case"file":e?e[0]!==l&&(e=l+e):e=l}return e}(this.scheme,r||c),this.query=n||c,this.fragment=o||c,function(t,e){if(!t.scheme&&e)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'+t.authority+'", path: "'+t.path+'", query: "'+t.query+'", fragment: "'+t.fragment+'"}');if(t.scheme&&!s.test(t.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t.path)if(t.authority){if(!f.test(t.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(u.test(t.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}(this,i))}return t.isUri=function(e){return e instanceof t||!!e&&"string"==typeof e.authority&&"string"==typeof e.fragment&&"string"==typeof e.path&&"string"==typeof e.query&&"string"==typeof e.scheme&&"function"==typeof e.fsPath&&"function"==typeof e.with&&"function"==typeof e.toString},Object.defineProperty(t.prototype,"fsPath",{get:function(){return C(this,!1)},enumerable:!1,configurable:!0}),t.prototype.with=function(t){if(!t)return this;var e=t.scheme,r=t.authority,n=t.path,o=t.query,i=t.fragment;return void 0===e?e=this.scheme:null===e&&(e=c),void 0===r?r=this.authority:null===r&&(r=c),void 0===n?n=this.path:null===n&&(n=c),void 0===o?o=this.query:null===o&&(o=c),void 0===i?i=this.fragment:null===i&&(i=c),e===this.scheme&&r===this.authority&&n===this.path&&o===this.query&&i===this.fragment?this:new v(e,r,n,o,i)},t.parse=function(t,e){void 0===e&&(e=!1);var r=p.exec(t);return r?new v(r[2]||c,x(r[4]||c),x(r[5]||c),x(r[7]||c),x(r[9]||c),e):new v(c,c,c,c,c)},t.file=function(t){var e=c;if(n&&(t=t.replace(/\\/g,l)),t[0]===l&&t[1]===l){var r=t.indexOf(l,2);-1===r?(e=t.substring(2),t=l):(e=t.substring(2,r),t=t.substring(r)||l)}return new v("file",e,t,c,c)},t.from=function(t){return new v(t.scheme,t.authority,t.path,t.query,t.fragment)},t.prototype.toString=function(t){return void 0===t&&(t=!1),A(this,t)},t.prototype.toJSON=function(){return this},t.revive=function(e){if(e){if(e instanceof t)return e;var r=new v(e);return r._formatted=e.external,r._fsPath=e._sep===d?e.fsPath:null,r}return e},t}(),d=n?1:void 0,v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._formatted=null,e._fsPath=null,e}return h(e,t),Object.defineProperty(e.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=C(this,!1)),this._fsPath},enumerable:!1,configurable:!0}),e.prototype.toString=function(t){return void 0===t&&(t=!1),t?A(this,!0):(this._formatted||(this._formatted=A(this,!1)),this._formatted)},e.prototype.toJSON=function(){var t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=d),this._formatted&&(t.external=this._formatted),this.path&&(t.path=this.path),this.scheme&&(t.scheme=this.scheme),this.authority&&(t.authority=this.authority),this.query&&(t.query=this.query),this.fragment&&(t.fragment=this.fragment),t},e}(g),m=((a={})[58]="%3A",a[47]="%2F",a[63]="%3F",a[35]="%23",a[91]="%5B",a[93]="%5D",a[64]="%40",a[33]="%21",a[36]="%24",a[38]="%26",a[39]="%27",a[40]="%28",a[41]="%29",a[42]="%2A",a[43]="%2B",a[44]="%2C",a[59]="%3B",a[61]="%3D",a[32]="%20",a);function y(t,e){for(var r=void 0,n=-1,o=0;o=97&&i<=122||i>=65&&i<=90||i>=48&&i<=57||45===i||46===i||95===i||126===i||e&&47===i)-1!==n&&(r+=encodeURIComponent(t.substring(n,o)),n=-1),void 0!==r&&(r+=t.charAt(o));else{void 0===r&&(r=t.substr(0,o));var a=m[i];void 0!==a?(-1!==n&&(r+=encodeURIComponent(t.substring(n,o)),n=-1),r+=a):-1===n&&(n=o)}}return-1!==n&&(r+=encodeURIComponent(t.substring(n))),void 0!==r?r:t}function b(t){for(var e=void 0,r=0;r1&&"file"===t.scheme?"//"+t.authority+t.path:47===t.path.charCodeAt(0)&&(t.path.charCodeAt(1)>=65&&t.path.charCodeAt(1)<=90||t.path.charCodeAt(1)>=97&&t.path.charCodeAt(1)<=122)&&58===t.path.charCodeAt(2)?e?t.path.substr(1):t.path[1].toLowerCase()+t.path.substr(2):t.path,n&&(r=r.replace(/\//g,"\\")),r}function A(t,e){var r=e?b:y,n="",o=t.scheme,i=t.authority,a=t.path,h=t.query,s=t.fragment;if(o&&(n+=o,n+=":"),(i||"file"===o)&&(n+=l,n+=l),i){var f=i.indexOf("@");if(-1!==f){var u=i.substr(0,f);i=i.substr(f+1),-1===(f=u.indexOf(":"))?n+=r(u,!1):(n+=r(u.substr(0,f),!1),n+=":",n+=r(u.substr(f+1),!1)),n+="@"}-1===(f=(i=i.toLowerCase()).indexOf(":"))?n+=r(i,!1):(n+=r(i.substr(0,f),!1),n+=i.substr(f))}if(a){if(a.length>=3&&47===a.charCodeAt(0)&&58===a.charCodeAt(2))(c=a.charCodeAt(1))>=65&&c<=90&&(a="/"+String.fromCharCode(c+32)+":"+a.substr(3));else if(a.length>=2&&58===a.charCodeAt(1)){var c;(c=a.charCodeAt(0))>=65&&c<=90&&(a=String.fromCharCode(c+32)+":"+a.substr(2))}n+=r(a,!0)}return h&&(n+="?",n+=r(h,!1)),s&&(n+="#",n+=e?s:y(s,!1)),n}function w(t){try{return decodeURIComponent(t)}catch(e){return t.length>3?t.substr(0,3)+w(t.substr(3)):t}}var _=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function x(t){return t.match(_)?t.replace(_,(function(t){return w(t)})):t}var O,P=r(470),j=function(){for(var t=0,e=0,r=arguments.length;e{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(447)})();export const{URI,Utils}=LIB; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/esm/index.js.map b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/esm/index.js.map new file mode 100644 index 0000000..5a3b747 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack://LIB/./node_modules/path-browserify/index.js","webpack://LIB/./src/platform.ts","webpack://LIB/./src/uri.ts","webpack://LIB/./src/utils.ts","webpack://LIB/webpack/bootstrap","webpack://LIB/webpack/startup","webpack://LIB/webpack/runtime/define property getters","webpack://LIB/webpack/runtime/hasOwnProperty shorthand","webpack://LIB/webpack/runtime/make namespace object"],"names":["assertPath","path","TypeError","JSON","stringify","normalizeStringPosix","allowAboveRoot","code","res","lastSegmentLength","lastSlash","dots","i","length","charCodeAt","lastSlashIndex","lastIndexOf","slice","posix","resolve","cwd","resolvedPath","resolvedAbsolute","arguments","undefined","process","normalize","isAbsolute","trailingSeparator","join","joined","arg","relative","from","to","fromStart","fromEnd","fromLen","toStart","toLen","lastCommonSep","fromCode","out","_makeLong","dirname","hasRoot","end","matchedSlash","basename","ext","start","extIdx","firstNonSlashEnd","extname","startDot","startPart","preDotState","format","pathObject","sep","dir","root","base","name","_format","parse","ret","delimiter","win32","module","exports","isWindows","platform","navigator","userAgent","indexOf","_schemePattern","_singleSlashStart","_doubleSlashStart","_empty","_slash","_regexp","schemeOrData","authority","query","fragment","_strict","this","scheme","_schemeFix","_referenceResolution","Error","test","_validateUri","isUri","thing","URI","fsPath","with","toString","uriToFsPath","change","Uri","value","match","exec","percentDecode","file","replace","idx","substring","components","skipEncoding","_asFormatted","toJSON","revive","data","result","_formatted","external","_fsPath","_sep","_pathSepMarker","$mid","encodeTable","encodeURIComponentFast","uriComponent","allowSlash","nativeEncodePos","pos","encodeURIComponent","charAt","substr","escaped","encodeURIComponentMinimal","uri","keepDriveLetterCasing","toLowerCase","encoder","userinfo","String","fromCharCode","decodeURIComponentGraceful","str","decodeURIComponent","_rEncodedAsHex","Utils","posixPath","joinPath","paths","resolvePath","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag"],"mappings":"8CA0BA,SAASA,EAAWC,GAClB,GAAoB,iBAATA,EACT,MAAM,IAAIC,UAAU,mCAAqCC,KAAKC,UAAUH,IAK5E,SAASI,EAAqBJ,EAAMK,GAMlC,IALA,IAIIC,EAJAC,EAAM,GACNC,EAAoB,EACpBC,GAAa,EACbC,EAAO,EAEFC,EAAI,EAAGA,GAAKX,EAAKY,SAAUD,EAAG,CACrC,GAAIA,EAAIX,EAAKY,OACXN,EAAON,EAAKa,WAAWF,OACpB,IAAa,KAATL,EACP,MAEAA,EAAO,GACT,GAAa,KAATA,EAAmB,CACrB,GAAIG,IAAcE,EAAI,GAAc,IAATD,QAEpB,GAAID,IAAcE,EAAI,GAAc,IAATD,EAAY,CAC5C,GAAIH,EAAIK,OAAS,GAA2B,IAAtBJ,GAA8D,KAAnCD,EAAIM,WAAWN,EAAIK,OAAS,IAAsD,KAAnCL,EAAIM,WAAWN,EAAIK,OAAS,GAC1H,GAAIL,EAAIK,OAAS,EAAG,CAClB,IAAIE,EAAiBP,EAAIQ,YAAY,KACrC,GAAID,IAAmBP,EAAIK,OAAS,EAAG,EACb,IAApBE,GACFP,EAAM,GACNC,EAAoB,GAGpBA,GADAD,EAAMA,EAAIS,MAAM,EAAGF,IACKF,OAAS,EAAIL,EAAIQ,YAAY,KAEvDN,EAAYE,EACZD,EAAO,EACP,eAEG,GAAmB,IAAfH,EAAIK,QAA+B,IAAfL,EAAIK,OAAc,CAC/CL,EAAM,GACNC,EAAoB,EACpBC,EAAYE,EACZD,EAAO,EACP,SAGAL,IACEE,EAAIK,OAAS,EACfL,GAAO,MAEPA,EAAM,KACRC,EAAoB,QAGlBD,EAAIK,OAAS,EACfL,GAAO,IAAMP,EAAKgB,MAAMP,EAAY,EAAGE,GAEvCJ,EAAMP,EAAKgB,MAAMP,EAAY,EAAGE,GAClCH,EAAoBG,EAAIF,EAAY,EAEtCA,EAAYE,EACZD,EAAO,OACW,KAATJ,IAA+B,IAAVI,IAC5BA,EAEFA,GAAQ,EAGZ,OAAOH,EAeT,IAAIU,EAAQ,CAEVC,QAAS,WAKP,IAJA,IAEIC,EAFAC,EAAe,GACfC,GAAmB,EAGdV,EAAIW,UAAUV,OAAS,EAAGD,IAAM,IAAMU,EAAkBV,IAAK,CACpE,IAAIX,EACAW,GAAK,EACPX,EAAOsB,UAAUX,SAELY,IAARJ,IACFA,EAAMK,QAAQL,OAChBnB,EAAOmB,GAGTpB,EAAWC,GAGS,IAAhBA,EAAKY,SAITQ,EAAepB,EAAO,IAAMoB,EAC5BC,EAA0C,KAAvBrB,EAAKa,WAAW,IASrC,OAFAO,EAAehB,EAAqBgB,GAAeC,GAE/CA,EACED,EAAaR,OAAS,EACjB,IAAMQ,EAEN,IACAA,EAAaR,OAAS,EACxBQ,EAEA,KAIXK,UAAW,SAAmBzB,GAG5B,GAFAD,EAAWC,GAES,IAAhBA,EAAKY,OAAc,MAAO,IAE9B,IAAIc,EAAoC,KAAvB1B,EAAKa,WAAW,GAC7Bc,EAAyD,KAArC3B,EAAKa,WAAWb,EAAKY,OAAS,GAQtD,OAHoB,KAFpBZ,EAAOI,EAAqBJ,GAAO0B,IAE1Bd,QAAiBc,IAAY1B,EAAO,KACzCA,EAAKY,OAAS,GAAKe,IAAmB3B,GAAQ,KAE9C0B,EAAmB,IAAM1B,EACtBA,GAGT0B,WAAY,SAAoB1B,GAE9B,OADAD,EAAWC,GACJA,EAAKY,OAAS,GAA4B,KAAvBZ,EAAKa,WAAW,IAG5Ce,KAAM,WACJ,GAAyB,IAArBN,UAAUV,OACZ,MAAO,IAET,IADA,IAAIiB,EACKlB,EAAI,EAAGA,EAAIW,UAAUV,SAAUD,EAAG,CACzC,IAAImB,EAAMR,UAAUX,GACpBZ,EAAW+B,GACPA,EAAIlB,OAAS,SACAW,IAAXM,EACFA,EAASC,EAETD,GAAU,IAAMC,GAGtB,YAAeP,IAAXM,EACK,IACFZ,EAAMQ,UAAUI,IAGzBE,SAAU,SAAkBC,EAAMC,GAIhC,GAHAlC,EAAWiC,GACXjC,EAAWkC,GAEPD,IAASC,EAAI,MAAO,GAKxB,IAHAD,EAAOf,EAAMC,QAAQc,OACrBC,EAAKhB,EAAMC,QAAQe,IAEF,MAAO,GAIxB,IADA,IAAIC,EAAY,EACTA,EAAYF,EAAKpB,QACa,KAA/BoB,EAAKnB,WAAWqB,KADYA,GASlC,IALA,IAAIC,EAAUH,EAAKpB,OACfwB,EAAUD,EAAUD,EAGpBG,EAAU,EACPA,EAAUJ,EAAGrB,QACa,KAA3BqB,EAAGpB,WAAWwB,KADUA,GAW9B,IAPA,IACIC,EADQL,EAAGrB,OACKyB,EAGhBzB,EAASwB,EAAUE,EAAQF,EAAUE,EACrCC,GAAiB,EACjB5B,EAAI,EACDA,GAAKC,IAAUD,EAAG,CACvB,GAAIA,IAAMC,EAAQ,CAChB,GAAI0B,EAAQ1B,EAAQ,CAClB,GAAmC,KAA/BqB,EAAGpB,WAAWwB,EAAU1B,GAG1B,OAAOsB,EAAGjB,MAAMqB,EAAU1B,EAAI,GACzB,GAAU,IAANA,EAGT,OAAOsB,EAAGjB,MAAMqB,EAAU1B,QAEnByB,EAAUxB,IACoB,KAAnCoB,EAAKnB,WAAWqB,EAAYvB,GAG9B4B,EAAgB5B,EACD,IAANA,IAGT4B,EAAgB,IAGpB,MAEF,IAAIC,EAAWR,EAAKnB,WAAWqB,EAAYvB,GAE3C,GAAI6B,IADSP,EAAGpB,WAAWwB,EAAU1B,GAEnC,MACoB,KAAb6B,IACPD,EAAgB5B,GAGpB,IAAI8B,EAAM,GAGV,IAAK9B,EAAIuB,EAAYK,EAAgB,EAAG5B,GAAKwB,IAAWxB,EAClDA,IAAMwB,GAAkC,KAAvBH,EAAKnB,WAAWF,KAChB,IAAf8B,EAAI7B,OACN6B,GAAO,KAEPA,GAAO,OAMb,OAAIA,EAAI7B,OAAS,EACR6B,EAAMR,EAAGjB,MAAMqB,EAAUE,IAEhCF,GAAWE,EACoB,KAA3BN,EAAGpB,WAAWwB,MACdA,EACGJ,EAAGjB,MAAMqB,KAIpBK,UAAW,SAAmB1C,GAC5B,OAAOA,GAGT2C,QAAS,SAAiB3C,GAExB,GADAD,EAAWC,GACS,IAAhBA,EAAKY,OAAc,MAAO,IAK9B,IAJA,IAAIN,EAAON,EAAKa,WAAW,GACvB+B,EAAmB,KAATtC,EACVuC,GAAO,EACPC,GAAe,EACVnC,EAAIX,EAAKY,OAAS,EAAGD,GAAK,IAAKA,EAEtC,GAAa,MADbL,EAAON,EAAKa,WAAWF,KAEnB,IAAKmC,EAAc,CACjBD,EAAMlC,EACN,YAIJmC,GAAe,EAInB,OAAa,IAATD,EAAmBD,EAAU,IAAM,IACnCA,GAAmB,IAARC,EAAkB,KAC1B7C,EAAKgB,MAAM,EAAG6B,IAGvBE,SAAU,SAAkB/C,EAAMgD,GAChC,QAAYzB,IAARyB,GAAoC,iBAARA,EAAkB,MAAM,IAAI/C,UAAU,mCACtEF,EAAWC,GAEX,IAGIW,EAHAsC,EAAQ,EACRJ,GAAO,EACPC,GAAe,EAGnB,QAAYvB,IAARyB,GAAqBA,EAAIpC,OAAS,GAAKoC,EAAIpC,QAAUZ,EAAKY,OAAQ,CACpE,GAAIoC,EAAIpC,SAAWZ,EAAKY,QAAUoC,IAAQhD,EAAM,MAAO,GACvD,IAAIkD,EAASF,EAAIpC,OAAS,EACtBuC,GAAoB,EACxB,IAAKxC,EAAIX,EAAKY,OAAS,EAAGD,GAAK,IAAKA,EAAG,CACrC,IAAIL,EAAON,EAAKa,WAAWF,GAC3B,GAAa,KAATL,GAGA,IAAKwC,EAAc,CACjBG,EAAQtC,EAAI,EACZ,YAGsB,IAAtBwC,IAGFL,GAAe,EACfK,EAAmBxC,EAAI,GAErBuC,GAAU,IAER5C,IAAS0C,EAAInC,WAAWqC,IACR,KAAZA,IAGJL,EAAMlC,IAKRuC,GAAU,EACVL,EAAMM,IAOd,OADIF,IAAUJ,EAAKA,EAAMM,GAAmC,IAATN,IAAYA,EAAM7C,EAAKY,QACnEZ,EAAKgB,MAAMiC,EAAOJ,GAEzB,IAAKlC,EAAIX,EAAKY,OAAS,EAAGD,GAAK,IAAKA,EAClC,GAA2B,KAAvBX,EAAKa,WAAWF,IAGhB,IAAKmC,EAAc,CACjBG,EAAQtC,EAAI,EACZ,YAEgB,IAATkC,IAGXC,GAAe,EACfD,EAAMlC,EAAI,GAId,OAAa,IAATkC,EAAmB,GAChB7C,EAAKgB,MAAMiC,EAAOJ,IAI7BO,QAAS,SAAiBpD,GACxBD,EAAWC,GAQX,IAPA,IAAIqD,GAAY,EACZC,EAAY,EACZT,GAAO,EACPC,GAAe,EAGfS,EAAc,EACT5C,EAAIX,EAAKY,OAAS,EAAGD,GAAK,IAAKA,EAAG,CACzC,IAAIL,EAAON,EAAKa,WAAWF,GAC3B,GAAa,KAATL,GASS,IAATuC,IAGFC,GAAe,EACfD,EAAMlC,EAAI,GAEC,KAATL,GAEkB,IAAd+C,EACFA,EAAW1C,EACY,IAAhB4C,IACPA,EAAc,IACK,IAAdF,IAGTE,GAAe,QArBb,IAAKT,EAAc,CACjBQ,EAAY3C,EAAI,EAChB,OAuBR,OAAkB,IAAd0C,IAA4B,IAATR,GAEH,IAAhBU,GAEgB,IAAhBA,GAAqBF,IAAaR,EAAM,GAAKQ,IAAaC,EAAY,EACjE,GAEFtD,EAAKgB,MAAMqC,EAAUR,IAG9BW,OAAQ,SAAgBC,GACtB,GAAmB,OAAfA,GAA6C,iBAAfA,EAChC,MAAM,IAAIxD,UAAU,0EAA4EwD,GAElG,OAvVJ,SAAiBC,EAAKD,GACpB,IAAIE,EAAMF,EAAWE,KAAOF,EAAWG,KACnCC,EAAOJ,EAAWI,OAASJ,EAAWK,MAAQ,KAAOL,EAAWT,KAAO,IAC3E,OAAKW,EAGDA,IAAQF,EAAWG,KACdD,EAAME,EAERF,EA8UU,IA9UEE,EALVA,EAmVAE,CAAQ,EAAKN,IAGtBO,MAAO,SAAehE,GACpBD,EAAWC,GAEX,IAAIiE,EAAM,CAAEL,KAAM,GAAID,IAAK,GAAIE,KAAM,GAAIb,IAAK,GAAIc,KAAM,IACxD,GAAoB,IAAhB9D,EAAKY,OAAc,OAAOqD,EAC9B,IAEIhB,EAFA3C,EAAON,EAAKa,WAAW,GACvBa,EAAsB,KAATpB,EAEboB,GACFuC,EAAIL,KAAO,IACXX,EAAQ,GAERA,EAAQ,EAaV,IAXA,IAAII,GAAY,EACZC,EAAY,EACZT,GAAO,EACPC,GAAe,EACfnC,EAAIX,EAAKY,OAAS,EAIlB2C,EAAc,EAGX5C,GAAKsC,IAAStC,EAEnB,GAAa,MADbL,EAAON,EAAKa,WAAWF,KAUV,IAATkC,IAGFC,GAAe,EACfD,EAAMlC,EAAI,GAEC,KAATL,GAEkB,IAAd+C,EAAiBA,EAAW1C,EAA2B,IAAhB4C,IAAmBA,EAAc,IACrD,IAAdF,IAGXE,GAAe,QAlBb,IAAKT,EAAc,CACjBQ,EAAY3C,EAAI,EAChB,MAyCR,OArBkB,IAAd0C,IAA4B,IAATR,GAEP,IAAhBU,GAEgB,IAAhBA,GAAqBF,IAAaR,EAAM,GAAKQ,IAAaC,EAAY,GACvD,IAATT,IACiCoB,EAAIJ,KAAOI,EAAIH,KAAhC,IAAdR,GAAmB5B,EAAkC1B,EAAKgB,MAAM,EAAG6B,GAAgC7C,EAAKgB,MAAMsC,EAAWT,KAG7G,IAAdS,GAAmB5B,GACrBuC,EAAIH,KAAO9D,EAAKgB,MAAM,EAAGqC,GACzBY,EAAIJ,KAAO7D,EAAKgB,MAAM,EAAG6B,KAEzBoB,EAAIH,KAAO9D,EAAKgB,MAAMsC,EAAWD,GACjCY,EAAIJ,KAAO7D,EAAKgB,MAAMsC,EAAWT,IAEnCoB,EAAIjB,IAAMhD,EAAKgB,MAAMqC,EAAUR,IAG7BS,EAAY,EAAGW,EAAIN,IAAM3D,EAAKgB,MAAM,EAAGsC,EAAY,GAAY5B,IAAYuC,EAAIN,IAAM,KAElFM,GAGTP,IAAK,IACLQ,UAAW,IACXC,MAAO,KACPlD,MAAO,MAGTA,EAAMA,MAAQA,EAEdmD,EAAOC,QAAUpD,G,cCngBV,IAAIqD,EAEX,G,sCAAuB,iBAAZ9C,QACV8C,EAAiC,UAArB9C,QAAQ+C,cACd,GAAyB,iBAAdC,UAAwB,CACzC,IAAIC,EAAYD,UAAUC,UAC1BH,EAAYG,EAAUC,QAAQ,YAAc,E,kVCVvCC,EAAiB,iBACjBC,EAAoB,MACpBC,EAAoB,QAiEpBC,EAAS,GACTC,EAAS,IACTC,EAAU,+DAkBhB,aA2DC,WAAsBC,EAAsCC,EAAoBlF,EAAemF,EAAgBC,EAAmBC,QAAA,IAAAA,OAAA,GAErG,iBAAjBJ,GACVK,KAAKC,OAASN,EAAaM,QAAUT,EACrCQ,KAAKJ,UAAYD,EAAaC,WAAaJ,EAC3CQ,KAAKtF,KAAOiF,EAAajF,MAAQ8E,EACjCQ,KAAKH,MAAQF,EAAaE,OAASL,EACnCQ,KAAKF,SAAWH,EAAaG,UAAYN,IAKzCQ,KAAKC,OAvHR,SAAoBA,EAAgBF,GACnC,OAAKE,GAAWF,EAGTE,EAFC,OAqHQC,CAAWP,EAAcI,GACvCC,KAAKJ,UAAYA,GAAaJ,EAC9BQ,KAAKtF,KAjHR,SAA8BuF,EAAgBvF,GAM7C,OAAQuF,GACP,IAAK,QACL,IAAK,OACL,IAAK,OACCvF,EAEMA,EAAK,KAAO+E,IACtB/E,EAAO+E,EAAS/E,GAFhBA,EAAO+E,EAMV,OAAO/E,EAgGOyF,CAAqBH,KAAKC,OAAQvF,GAAQ8E,GACtDQ,KAAKH,MAAQA,GAASL,EACtBQ,KAAKF,SAAWA,GAAYN,EA9J/B,SAAsBb,EAAUoB,GAG/B,IAAKpB,EAAIsB,QAAUF,EAClB,MAAM,IAAIK,MAAM,2DAA2DzB,EAAIiB,UAAS,aAAajB,EAAIjE,KAAI,cAAciE,EAAIkB,MAAK,iBAAiBlB,EAAImB,SAAQ,MAKlK,GAAInB,EAAIsB,SAAWZ,EAAegB,KAAK1B,EAAIsB,QAC1C,MAAM,IAAIG,MAAM,mDAQjB,GAAIzB,EAAIjE,KACP,GAAIiE,EAAIiB,WACP,IAAKN,EAAkBe,KAAK1B,EAAIjE,MAC/B,MAAM,IAAI0F,MAAM,iJAGjB,GAAIb,EAAkBc,KAAK1B,EAAIjE,MAC9B,MAAM,IAAI0F,MAAM,6HAuIjBE,CAAaN,KAAMD,IA0MtB,OArRQ,EAAAQ,MAAP,SAAaC,GACZ,OAAIA,aAAiBC,KAGhBD,GAGoC,iBAArBA,EAAOZ,WACU,iBAApBY,EAAOV,UACS,iBAAhBU,EAAO9F,MACU,iBAAjB8F,EAAOX,OACW,iBAAlBW,EAAOP,QACW,mBAAlBO,EAAOE,QACS,mBAAhBF,EAAOG,MACa,mBAApBH,EAAOI,UA2FzB,sBAAI,qBAAM,C,IAAV,WAIC,OAAOC,EAAYb,MAAM,I,gCAK1B,YAAAW,KAAA,SAAKG,GAEJ,IAAKA,EACJ,OAAOd,KAGF,IAAAC,EAA6Ca,EAAM,OAA3ClB,EAAqCkB,EAAM,UAAhCpG,EAA0BoG,EAAM,KAA1BjB,EAAoBiB,EAAM,MAAnBhB,EAAagB,EAAM,SA2BzD,YA1Be7E,IAAXgE,EACHA,EAASD,KAAKC,OACO,OAAXA,IACVA,EAAST,QAEQvD,IAAd2D,EACHA,EAAYI,KAAKJ,UACO,OAAdA,IACVA,EAAYJ,QAEAvD,IAATvB,EACHA,EAAOsF,KAAKtF,KACO,OAATA,IACVA,EAAO8E,QAEMvD,IAAV4D,EACHA,EAAQG,KAAKH,MACO,OAAVA,IACVA,EAAQL,QAEQvD,IAAb6D,EACHA,EAAWE,KAAKF,SACO,OAAbA,IACVA,EAAWN,GAGRS,IAAWD,KAAKC,QAChBL,IAAcI,KAAKJ,WACnBlF,IAASsF,KAAKtF,MACdmF,IAAUG,KAAKH,OACfC,IAAaE,KAAKF,SAEdE,KAGD,IAAIe,EAAId,EAAQL,EAAWlF,EAAMmF,EAAOC,IAWzC,EAAApB,MAAP,SAAasC,EAAejB,QAAA,IAAAA,OAAA,GAC3B,IAAMkB,EAAQvB,EAAQwB,KAAKF,GAC3B,OAAKC,EAGE,IAAIF,EACVE,EAAM,IAAMzB,EACZ2B,EAAcF,EAAM,IAAMzB,GAC1B2B,EAAcF,EAAM,IAAMzB,GAC1B2B,EAAcF,EAAM,IAAMzB,GAC1B2B,EAAcF,EAAM,IAAMzB,GAC1BO,GARO,IAAIgB,EAAIvB,EAAQA,EAAQA,EAAQA,EAAQA,IAiC1C,EAAA4B,KAAP,SAAY1G,GAEX,IAAIkF,EAAYJ,EAWhB,GANIR,IACHtE,EAAOA,EAAK2G,QAAQ,MAAO5B,IAKxB/E,EAAK,KAAO+E,GAAU/E,EAAK,KAAO+E,EAAQ,CAC7C,IAAM6B,EAAM5G,EAAK0E,QAAQK,EAAQ,IACpB,IAAT6B,GACH1B,EAAYlF,EAAK6G,UAAU,GAC3B7G,EAAO+E,IAEPG,EAAYlF,EAAK6G,UAAU,EAAGD,GAC9B5G,EAAOA,EAAK6G,UAAUD,IAAQ7B,GAIhC,OAAO,IAAIsB,EAAI,OAAQnB,EAAWlF,EAAM8E,EAAQA,IAG1C,EAAA9C,KAAP,SAAY8E,GACX,OAAO,IAAIT,EACVS,EAAWvB,OACXuB,EAAW5B,UACX4B,EAAW9G,KACX8G,EAAW3B,MACX2B,EAAW1B,WAiBb,YAAAc,SAAA,SAASa,GACR,YADQ,IAAAA,OAAA,GACDC,EAAa1B,KAAMyB,IAG3B,YAAAE,OAAA,WACC,OAAO3B,MAOD,EAAA4B,OAAP,SAAcC,GACb,GAAKA,EAEE,IAAIA,aAAgBpB,EAC1B,OAAOoB,EAEP,IAAMC,EAAS,IAAIf,EAAIc,GAGvB,OAFAC,EAAOC,WAAwBF,EAAMG,SACrCF,EAAOG,QAAqBJ,EAAMK,OAASC,EAA4BN,EAAMnB,OAAS,KAC/EoB,EAPP,OAAYD,GAUf,EAvRA,GAwSMM,EAAiBnD,EAAY,OAAI/C,EAGvC,yE,OAEC,EAAA8F,WAA4B,KAC5B,EAAAE,QAAyB,K,EAmD1B,OAtDkB,OAKjB,sBAAI,qBAAM,C,IAAV,WAIC,OAHKjC,KAAKiC,UACTjC,KAAKiC,QAAUpB,EAAYb,MAAM,IAE3BA,KAAKiC,S,gCAGb,YAAArB,SAAA,SAASa,GACR,YADQ,IAAAA,OAAA,GACHA,EAOGC,EAAa1B,MAAM,IANrBA,KAAK+B,aACT/B,KAAK+B,WAAaL,EAAa1B,MAAM,IAE/BA,KAAK+B,aAOd,YAAAJ,OAAA,WACC,IAAM1G,EAAgB,CACrBmH,KAAM,GA0BP,OAvBIpC,KAAKiC,UACRhH,EAAIyF,OAASV,KAAKiC,QAClBhH,EAAIiH,KAAOC,GAERnC,KAAK+B,aACR9G,EAAI+G,SAAWhC,KAAK+B,YAGjB/B,KAAKtF,OACRO,EAAIP,KAAOsF,KAAKtF,MAEbsF,KAAKC,SACRhF,EAAIgF,OAASD,KAAKC,QAEfD,KAAKJ,YACR3E,EAAI2E,UAAYI,KAAKJ,WAElBI,KAAKH,QACR5E,EAAI4E,MAAQG,KAAKH,OAEdG,KAAKF,WACR7E,EAAI6E,SAAWE,KAAKF,UAEd7E,GAET,EAtDA,CAAkBwF,GAyDZ4B,IAAW,MAChB,IAAkB,MAClB,MAAkB,MAClB,MAAyB,MACzB,MAAiB,MACjB,MAA8B,MAC9B,MAA+B,MAC/B,MAAmB,MAEnB,MAA4B,MAC5B,MAAuB,MACvB,MAAsB,MACtB,MAAwB,MACxB,MAAsB,MACtB,MAAuB,MACvB,MAAqB,MACrB,MAAiB,MACjB,MAAkB,MAClB,MAAsB,MACtB,MAAmB,MAEnB,MAAkB,M,GAGnB,SAASC,EAAuBC,EAAsBC,GAIrD,IAHA,IAAIvH,OAA0BgB,EAC1BwG,GAAmB,EAEdC,EAAM,EAAGA,EAAMH,EAAajH,OAAQoH,IAAO,CACnD,IAAM1H,EAAOuH,EAAahH,WAAWmH,GAGrC,GACE1H,GAAQ,IAAcA,GAAQ,KAC3BA,GAAQ,IAAcA,GAAQ,IAC9BA,GAAQ,IAAmBA,GAAQ,IAC3B,KAATA,GACS,KAATA,GACS,KAATA,GACS,MAATA,GACCwH,GAAuB,KAATxH,GAGO,IAArByH,IACHxH,GAAO0H,mBAAmBJ,EAAahB,UAAUkB,EAAiBC,IAClED,GAAmB,QAGRxG,IAARhB,IACHA,GAAOsH,EAAaK,OAAOF,QAGtB,MAEMzG,IAARhB,IACHA,EAAMsH,EAAaM,OAAO,EAAGH,IAI9B,IAAMI,EAAUT,EAAYrH,QACZiB,IAAZ6G,IAGsB,IAArBL,IACHxH,GAAO0H,mBAAmBJ,EAAahB,UAAUkB,EAAiBC,IAClED,GAAmB,GAIpBxH,GAAO6H,IAEwB,IAArBL,IAEVA,EAAkBC,IASrB,OAJyB,IAArBD,IACHxH,GAAO0H,mBAAmBJ,EAAahB,UAAUkB,UAGnCxG,IAARhB,EAAoBA,EAAMsH,EAGlC,SAASQ,EAA0BrI,GAElC,IADA,IAAIO,OAA0BgB,EACrByG,EAAM,EAAGA,EAAMhI,EAAKY,OAAQoH,IAAO,CAC3C,IAAM1H,EAAON,EAAKa,WAAWmH,GAChB,KAAT1H,GAAmC,KAATA,QACjBiB,IAARhB,IACHA,EAAMP,EAAKmI,OAAO,EAAGH,IAEtBzH,GAAOoH,EAAYrH,SAEPiB,IAARhB,IACHA,GAAOP,EAAKgI,IAIf,YAAezG,IAARhB,EAAoBA,EAAMP,EAM3B,SAASmG,EAAYmC,EAAUC,GAErC,IAAIjC,EAsBJ,OAnBCA,EAFGgC,EAAIpD,WAAaoD,EAAItI,KAAKY,OAAS,GAAoB,SAAf0H,EAAI/C,OAEvC,KAAK+C,EAAIpD,UAAYoD,EAAItI,KAEN,KAA3BsI,EAAItI,KAAKa,WAAW,KAChByH,EAAItI,KAAKa,WAAW,IAAM,IAAcyH,EAAItI,KAAKa,WAAW,IAAM,IAAcyH,EAAItI,KAAKa,WAAW,IAAM,IAAcyH,EAAItI,KAAKa,WAAW,IAAM,MACxH,KAA3ByH,EAAItI,KAAKa,WAAW,GAElB0H,EAIID,EAAItI,KAAKmI,OAAO,GAFhBG,EAAItI,KAAK,GAAGwI,cAAgBF,EAAItI,KAAKmI,OAAO,GAM7CG,EAAItI,KAETsE,IACHgC,EAAQA,EAAMK,QAAQ,MAAO,OAEvBL,EAMR,SAASU,EAAasB,EAAUvB,GAE/B,IAAM0B,EAAW1B,EAEdsB,EADAT,EAGCrH,EAAM,GACJgF,EAA6C+C,EAAG,OAAxCpD,EAAqCoD,EAAG,UAA7BtI,EAA0BsI,EAAG,KAAvBnD,EAAoBmD,EAAG,MAAhBlD,EAAakD,EAAG,SAStD,GARI/C,IACHhF,GAAOgF,EACPhF,GAAO,MAEJ2E,GAAwB,SAAXK,KAChBhF,GAAOwE,EACPxE,GAAOwE,GAEJG,EAAW,CACd,IAAI0B,EAAM1B,EAAUR,QAAQ,KAC5B,IAAa,IAATkC,EAAY,CAEf,IAAM8B,EAAWxD,EAAUiD,OAAO,EAAGvB,GACrC1B,EAAYA,EAAUiD,OAAOvB,EAAM,IAEtB,KADbA,EAAM8B,EAAShE,QAAQ,MAEtBnE,GAAOkI,EAAQC,GAAU,IAGzBnI,GAAOkI,EAAQC,EAASP,OAAO,EAAGvB,IAAM,GACxCrG,GAAO,IACPA,GAAOkI,EAAQC,EAASP,OAAOvB,EAAM,IAAI,IAE1CrG,GAAO,KAIK,KADbqG,GADA1B,EAAYA,EAAUsD,eACN9D,QAAQ,MAEvBnE,GAAOkI,EAAQvD,GAAW,IAG1B3E,GAAOkI,EAAQvD,EAAUiD,OAAO,EAAGvB,IAAM,GACzCrG,GAAO2E,EAAUiD,OAAOvB,IAG1B,GAAI5G,EAAM,CAET,GAAIA,EAAKY,QAAU,GAA4B,KAAvBZ,EAAKa,WAAW,IAAgD,KAAvBb,EAAKa,WAAW,IAC1EP,EAAON,EAAKa,WAAW,KACjB,IAAcP,GAAQ,KACjCN,EAAO,IAAI2I,OAAOC,aAAatI,EAAO,IAAG,IAAIN,EAAKmI,OAAO,SAEpD,GAAInI,EAAKY,QAAU,GAA4B,KAAvBZ,EAAKa,WAAW,GAAuB,CACrE,IAAMP,KAAON,EAAKa,WAAW,KACjB,IAAcP,GAAQ,KACjCN,EAAU2I,OAAOC,aAAatI,EAAO,IAAG,IAAIN,EAAKmI,OAAO,IAI1D5H,GAAOkI,EAAQzI,GAAM,GAUtB,OARImF,IACH5E,GAAO,IACPA,GAAOkI,EAAQtD,GAAO,IAEnBC,IACH7E,GAAO,IACPA,GAAQwG,EAAyD3B,EAA1CwC,EAAuBxC,GAAU,IAElD7E,EAKR,SAASsI,EAA2BC,GACnC,IACC,OAAOC,mBAAmBD,GACzB,SACD,OAAIA,EAAIlI,OAAS,EACTkI,EAAIX,OAAO,EAAG,GAAKU,EAA2BC,EAAIX,OAAO,IAEzDW,GAKV,IAAME,EAAiB,8BAEvB,SAASvC,EAAcqC,GACtB,OAAKA,EAAIvC,MAAMyC,GAGRF,EAAInC,QAAQqC,GAAgB,SAACzC,GAAU,OAAAsC,EAA2BtC,MAFjEuC,E,ICvpBQG,E,iMAFXC,EAAY,SAAkB,GAEpC,SAAiBD,GAeG,EAAAE,SAAhB,SAAyBb,G,IAAU,wDAC/B,OAAOA,EAAIrC,KAAK,CAAEjG,KAAMkJ,EAAUtH,KAAI,MAAdsH,EAAS,GAAMZ,EAAItI,MAASoJ,OAiBxC,EAAAC,YAAhB,SAA4Bf,G,IAAU,wDAClC,IAAMtI,EAAOsI,EAAItI,MAAQ,IACzB,OAAOsI,EAAIrC,KAAK,CAAEjG,KAAMkJ,EAAUhI,QAAO,MAAjBgI,EAAS,GAASlJ,GAASoJ,OAWvC,EAAAzG,QAAhB,SAAwB2F,GACpB,IAAItI,EAAOkJ,EAAUvG,QAAQ2F,EAAItI,MACjC,OAAoB,IAAhBA,EAAKY,QAAuC,KAAvBZ,EAAKa,WAAW,GAC9ByH,EAEJA,EAAIrC,KAAK,CAAEjG,KAAI,KAWV,EAAA+C,SAAhB,SAAyBuF,GACrB,OAAOY,EAAUnG,SAASuF,EAAItI,OAWlB,EAAAoD,QAAhB,SAAwBkF,GACpB,OAAOY,EAAU9F,QAAQkF,EAAItI,OA3ErC,CAAiBiJ,MAAK,OCZlBK,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUnF,QAG3C,IAAID,EAASkF,EAAyBE,GAAY,CAGjDnF,QAAS,IAOV,OAHAoF,EAAoBD,GAAUpF,EAAQA,EAAOC,QAASkF,GAG/CnF,EAAOC,QCjBf,OCFAkF,EAAoBG,EAAI,CAACrF,EAASsF,KACjC,IAAI,IAAIC,KAAOD,EACXJ,EAAoBM,EAAEF,EAAYC,KAASL,EAAoBM,EAAExF,EAASuF,IAC5EE,OAAOC,eAAe1F,EAASuF,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EL,EAAoBM,EAAI,CAACK,EAAKC,IAASL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCCjFZ,EAAoBgB,EAAKlG,IACH,oBAAXmG,QAA0BA,OAAOC,aAC1CX,OAAOC,eAAe1F,EAASmG,OAAOC,YAAa,CAAEnE,MAAO,WAE7DwD,OAAOC,eAAe1F,EAAS,aAAc,CAAEiC,OAAO,KHFhDiD,EAAoB,M","file":"index.js","sourcesContent":["// 'path' module extracted from Node.js v8.11.1 (only the posix part)\n// transplited with Babel\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSegmentLength = 0;\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47 /*/*/)\n break;\n else\n code = 47 /*/*/;\n if (code === 47 /*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {\n if (res.length > 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 /*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47 /*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute) path = '.';\n if (path.length > 0 && trailingSeparator) path += '/';\n\n if (isAbsolute) return '/' + path;\n return path;\n },\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;\n },\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to) return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to) return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47 /*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = fromEnd - fromStart;\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47 /*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = toEnd - toStart;\n\n // Compare paths to find the longest common path from root\n var length = fromLen < toLen ? fromLen : toLen;\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47 /*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47 /*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47 /*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47 /*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) return '//';\n return path.slice(0, end);\n },\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path) return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n }\n },\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError('The \"pathObject\" argument must be of type Object. Received type ' + typeof pathObject);\n }\n return _format('/', pathObject);\n },\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = code === 47 /*/*/;\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\n\nposix.posix = posix;\n\nmodule.exports = posix;\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\n\n// !!!!!\n// SEE https://github.com/microsoft/vscode/blob/master/src/vs/base/common/platform.ts\n// !!!!!\n\ndeclare const process: { platform: 'win32' };\ndeclare const navigator: { userAgent: string };\n\nexport let isWindows: boolean;\n\nif (typeof process === 'object') {\n\tisWindows = process.platform === 'win32';\n} else if (typeof navigator === 'object') {\n\tlet userAgent = navigator.userAgent;\n\tisWindows = userAgent.indexOf('Windows') >= 0;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\n\nimport { CharCode } from './charCode'\nimport { isWindows } from './platform';\n\nconst _schemePattern = /^\\w[\\w\\d+.-]*$/;\nconst _singleSlashStart = /^\\//;\nconst _doubleSlashStart = /^\\/\\//;\n\nfunction _validateUri(ret: URI, _strict?: boolean): void {\n\n\t// scheme, must be set\n\tif (!ret.scheme && _strict) {\n\t\tthrow new Error(`[UriError]: Scheme is missing: {scheme: \"\", authority: \"${ret.authority}\", path: \"${ret.path}\", query: \"${ret.query}\", fragment: \"${ret.fragment}\"}`);\n\t}\n\n\t// scheme, https://tools.ietf.org/html/rfc3986#section-3.1\n\t// ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\n\tif (ret.scheme && !_schemePattern.test(ret.scheme)) {\n\t\tthrow new Error('[UriError]: Scheme contains illegal characters.');\n\t}\n\n\t// path, http://tools.ietf.org/html/rfc3986#section-3.3\n\t// If a URI contains an authority component, then the path component\n\t// must either be empty or begin with a slash (\"/\") character. If a URI\n\t// does not contain an authority component, then the path cannot begin\n\t// with two slash characters (\"//\").\n\tif (ret.path) {\n\t\tif (ret.authority) {\n\t\t\tif (!_singleSlashStart.test(ret.path)) {\n\t\t\t\tthrow new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash (\"/\") character');\n\t\t\t}\n\t\t} else {\n\t\t\tif (_doubleSlashStart.test(ret.path)) {\n\t\t\t\tthrow new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters (\"//\")');\n\t\t\t}\n\t\t}\n\t}\n}\n\n// for a while we allowed uris *without* schemes and this is the migration\n// for them, e.g. an uri without scheme and without strict-mode warns and falls\n// back to the file-scheme. that should cause the least carnage and still be a\n// clear warning\nfunction _schemeFix(scheme: string, _strict: boolean): string {\n\tif (!scheme && !_strict) {\n\t\treturn 'file';\n\t}\n\treturn scheme;\n}\n\n// implements a bit of https://tools.ietf.org/html/rfc3986#section-5\nfunction _referenceResolution(scheme: string, path: string): string {\n\n\t// the slash-character is our 'default base' as we don't\n\t// support constructing URIs relative to other URIs. This\n\t// also means that we alter and potentially break paths.\n\t// see https://tools.ietf.org/html/rfc3986#section-5.1.4\n\tswitch (scheme) {\n\t\tcase 'https':\n\t\tcase 'http':\n\t\tcase 'file':\n\t\t\tif (!path) {\n\t\t\t\tpath = _slash;\n\t\t\t} else if (path[0] !== _slash) {\n\t\t\t\tpath = _slash + path;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn path;\n}\n\nconst _empty = '';\nconst _slash = '/';\nconst _regexp = /^(([^:/?#]+?):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/;\n\n/**\n * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.\n * This class is a simple parser which creates the basic component parts\n * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation\n * and encoding.\n *\n * ```txt\n * foo://example.com:8042/over/there?name=ferret#nose\n * \\_/ \\______________/\\_________/ \\_________/ \\__/\n * | | | | |\n * scheme authority path query fragment\n * | _____________________|__\n * / \\ / \\\n * urn:example:animal:ferret:nose\n * ```\n */\nexport class URI implements UriComponents {\n\n\tstatic isUri(thing: any): thing is URI {\n\t\tif (thing instanceof URI) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing).authority === 'string'\n\t\t\t&& typeof (thing).fragment === 'string'\n\t\t\t&& typeof (thing).path === 'string'\n\t\t\t&& typeof (thing).query === 'string'\n\t\t\t&& typeof (thing).scheme === 'string'\n\t\t\t&& typeof (thing).fsPath === 'function'\n\t\t\t&& typeof (thing).with === 'function'\n\t\t\t&& typeof (thing).toString === 'function';\n\t}\n\n\t/**\n\t * scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'.\n\t * The part before the first colon.\n\t */\n\treadonly scheme: string;\n\n\t/**\n\t * authority is the 'www.msft.com' part of 'http://www.msft.com/some/path?query#fragment'.\n\t * The part between the first double slashes and the next slash.\n\t */\n\treadonly authority: string;\n\n\t/**\n\t * path is the '/some/path' part of 'http://www.msft.com/some/path?query#fragment'.\n\t */\n\treadonly path: string;\n\n\t/**\n\t * query is the 'query' part of 'http://www.msft.com/some/path?query#fragment'.\n\t */\n\treadonly query: string;\n\n\t/**\n\t * fragment is the 'fragment' part of 'http://www.msft.com/some/path?query#fragment'.\n\t */\n\treadonly fragment: string;\n\n\t/**\n\t * @internal\n\t */\n\tprotected constructor(scheme: string, authority?: string, path?: string, query?: string, fragment?: string, _strict?: boolean);\n\n\t/**\n\t * @internal\n\t */\n\tprotected constructor(components: UriComponents);\n\n\t/**\n\t * @internal\n\t */\n\tprotected constructor(schemeOrData: string | UriComponents, authority?: string, path?: string, query?: string, fragment?: string, _strict: boolean = false) {\n\n\t\tif (typeof schemeOrData === 'object') {\n\t\t\tthis.scheme = schemeOrData.scheme || _empty;\n\t\t\tthis.authority = schemeOrData.authority || _empty;\n\t\t\tthis.path = schemeOrData.path || _empty;\n\t\t\tthis.query = schemeOrData.query || _empty;\n\t\t\tthis.fragment = schemeOrData.fragment || _empty;\n\t\t\t// no validation because it's this URI\n\t\t\t// that creates uri components.\n\t\t\t// _validateUri(this);\n\t\t} else {\n\t\t\tthis.scheme = _schemeFix(schemeOrData, _strict);\n\t\t\tthis.authority = authority || _empty;\n\t\t\tthis.path = _referenceResolution(this.scheme, path || _empty);\n\t\t\tthis.query = query || _empty;\n\t\t\tthis.fragment = fragment || _empty;\n\n\t\t\t_validateUri(this, _strict);\n\t\t}\n\t}\n\n\t// ---- filesystem path -----------------------\n\n\t/**\n\t * Returns a string representing the corresponding file system path of this URI.\n\t * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the\n\t * platform specific path separator.\n\t *\n\t * * Will *not* validate the path for invalid characters and semantics.\n\t * * Will *not* look at the scheme of this URI.\n\t * * The result shall *not* be used for display purposes but for accessing a file on disk.\n\t *\n\t *\n\t * The *difference* to `URI#path` is the use of the platform specific separator and the handling\n\t * of UNC paths. See the below sample of a file-uri with an authority (UNC path).\n\t *\n\t * ```ts\n\t\tconst u = URI.parse('file://server/c$/folder/file.txt')\n\t\tu.authority === 'server'\n\t\tu.path === '/shares/c$/file.txt'\n\t\tu.fsPath === '\\\\server\\c$\\folder\\file.txt'\n\t```\n\t *\n\t * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,\n\t * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working\n\t * with URIs that represent files on disk (`file` scheme).\n\t */\n\tget fsPath(): string {\n\t\t// if (this.scheme !== 'file') {\n\t\t// \tconsole.warn(`[UriError] calling fsPath with scheme ${this.scheme}`);\n\t\t// }\n\t\treturn uriToFsPath(this, false);\n\t}\n\n\t// ---- modify to new -------------------------\n\n\twith(change: { scheme?: string; authority?: string | null; path?: string | null; query?: string | null; fragment?: string | null }): URI {\n\n\t\tif (!change) {\n\t\t\treturn this;\n\t\t}\n\n\t\tlet { scheme, authority, path, query, fragment } = change;\n\t\tif (scheme === undefined) {\n\t\t\tscheme = this.scheme;\n\t\t} else if (scheme === null) {\n\t\t\tscheme = _empty;\n\t\t}\n\t\tif (authority === undefined) {\n\t\t\tauthority = this.authority;\n\t\t} else if (authority === null) {\n\t\t\tauthority = _empty;\n\t\t}\n\t\tif (path === undefined) {\n\t\t\tpath = this.path;\n\t\t} else if (path === null) {\n\t\t\tpath = _empty;\n\t\t}\n\t\tif (query === undefined) {\n\t\t\tquery = this.query;\n\t\t} else if (query === null) {\n\t\t\tquery = _empty;\n\t\t}\n\t\tif (fragment === undefined) {\n\t\t\tfragment = this.fragment;\n\t\t} else if (fragment === null) {\n\t\t\tfragment = _empty;\n\t\t}\n\n\t\tif (scheme === this.scheme\n\t\t\t&& authority === this.authority\n\t\t\t&& path === this.path\n\t\t\t&& query === this.query\n\t\t\t&& fragment === this.fragment) {\n\n\t\t\treturn this;\n\t\t}\n\n\t\treturn new Uri(scheme, authority, path, query, fragment);\n\t}\n\n\t// ---- parse & validate ------------------------\n\n\t/**\n\t * Creates a new URI from a string, e.g. `http://www.msft.com/some/path`,\n\t * `file:///usr/home`, or `scheme:with/path`.\n\t *\n\t * @param value A string which represents an URI (see `URI#toString`).\n\t */\n\tstatic parse(value: string, _strict: boolean = false): URI {\n\t\tconst match = _regexp.exec(value);\n\t\tif (!match) {\n\t\t\treturn new Uri(_empty, _empty, _empty, _empty, _empty);\n\t\t}\n\t\treturn new Uri(\n\t\t\tmatch[2] || _empty,\n\t\t\tpercentDecode(match[4] || _empty),\n\t\t\tpercentDecode(match[5] || _empty),\n\t\t\tpercentDecode(match[7] || _empty),\n\t\t\tpercentDecode(match[9] || _empty),\n\t\t\t_strict\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new URI from a file system path, e.g. `c:\\my\\files`,\n\t * `/usr/home`, or `\\\\server\\share\\some\\path`.\n\t *\n\t * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument\n\t * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**\n\t * `URI.parse('file://' + path)` because the path might contain characters that are\n\t * interpreted (# and ?). See the following sample:\n\t * ```ts\n\tconst good = URI.file('/coding/c#/project1');\n\tgood.scheme === 'file';\n\tgood.path === '/coding/c#/project1';\n\tgood.fragment === '';\n\tconst bad = URI.parse('file://' + '/coding/c#/project1');\n\tbad.scheme === 'file';\n\tbad.path === '/coding/c'; // path is now broken\n\tbad.fragment === '/project1';\n\t```\n\t *\n\t * @param path A file system path (see `URI#fsPath`)\n\t */\n\tstatic file(path: string): URI {\n\n\t\tlet authority = _empty;\n\n\t\t// normalize to fwd-slashes on windows,\n\t\t// on other systems bwd-slashes are valid\n\t\t// filename character, eg /f\\oo/ba\\r.txt\n\t\tif (isWindows) {\n\t\t\tpath = path.replace(/\\\\/g, _slash);\n\t\t}\n\n\t\t// check for authority as used in UNC shares\n\t\t// or use the path as given\n\t\tif (path[0] === _slash && path[1] === _slash) {\n\t\t\tconst idx = path.indexOf(_slash, 2);\n\t\t\tif (idx === -1) {\n\t\t\t\tauthority = path.substring(2);\n\t\t\t\tpath = _slash;\n\t\t\t} else {\n\t\t\t\tauthority = path.substring(2, idx);\n\t\t\t\tpath = path.substring(idx) || _slash;\n\t\t\t}\n\t\t}\n\n\t\treturn new Uri('file', authority, path, _empty, _empty);\n\t}\n\n\tstatic from(components: { scheme: string; authority?: string; path?: string; query?: string; fragment?: string }): URI {\n\t\treturn new Uri(\n\t\t\tcomponents.scheme,\n\t\t\tcomponents.authority,\n\t\t\tcomponents.path,\n\t\t\tcomponents.query,\n\t\t\tcomponents.fragment,\n\t\t);\n\t}\n\n\t// ---- printing/externalize ---------------------------\n\n\t/**\n\t * Creates a string representation for this URI. It's guaranteed that calling\n\t * `URI.parse` with the result of this function creates an URI which is equal\n\t * to this URI.\n\t *\n\t * * The result shall *not* be used for display purposes but for externalization or transport.\n\t * * The result will be encoded using the percentage encoding and encoding happens mostly\n\t * ignore the scheme-specific encoding rules.\n\t *\n\t * @param skipEncoding Do not encode the result, default is `false`\n\t */\n\ttoString(skipEncoding: boolean = false): string {\n\t\treturn _asFormatted(this, skipEncoding);\n\t}\n\n\ttoJSON(): UriComponents {\n\t\treturn this;\n\t}\n\n\tstatic revive(data: UriComponents | URI): URI;\n\tstatic revive(data: UriComponents | URI | undefined): URI | undefined;\n\tstatic revive(data: UriComponents | URI | null): URI | null;\n\tstatic revive(data: UriComponents | URI | undefined | null): URI | undefined | null;\n\tstatic revive(data: UriComponents | URI | undefined | null): URI | undefined | null {\n\t\tif (!data) {\n\t\t\treturn data;\n\t\t} else if (data instanceof URI) {\n\t\t\treturn data;\n\t\t} else {\n\t\t\tconst result = new Uri(data);\n\t\t\tresult._formatted = (data).external;\n\t\t\tresult._fsPath = (data)._sep === _pathSepMarker ? (data).fsPath : null;\n\t\t\treturn result;\n\t\t}\n\t}\n}\n\nexport interface UriComponents {\n\tscheme: string;\n\tauthority: string;\n\tpath: string;\n\tquery: string;\n\tfragment: string;\n}\n\ninterface UriState extends UriComponents {\n\t$mid: number;\n\texternal: string;\n\tfsPath: string;\n\t_sep: 1 | undefined;\n}\n\nconst _pathSepMarker = isWindows ? 1 : undefined;\n\n// This class exists so that URI is compatibile with vscode.Uri (API).\nclass Uri extends URI {\n\n\t_formatted: string | null = null;\n\t_fsPath: string | null = null;\n\n\tget fsPath(): string {\n\t\tif (!this._fsPath) {\n\t\t\tthis._fsPath = uriToFsPath(this, false);\n\t\t}\n\t\treturn this._fsPath;\n\t}\n\n\ttoString(skipEncoding: boolean = false): string {\n\t\tif (!skipEncoding) {\n\t\t\tif (!this._formatted) {\n\t\t\t\tthis._formatted = _asFormatted(this, false);\n\t\t\t}\n\t\t\treturn this._formatted;\n\t\t} else {\n\t\t\t// we don't cache that\n\t\t\treturn _asFormatted(this, true);\n\t\t}\n\t}\n\n\ttoJSON(): UriComponents {\n\t\tconst res = {\n\t\t\t$mid: 1\n\t\t};\n\t\t// cached state\n\t\tif (this._fsPath) {\n\t\t\tres.fsPath = this._fsPath;\n\t\t\tres._sep = _pathSepMarker;\n\t\t}\n\t\tif (this._formatted) {\n\t\t\tres.external = this._formatted;\n\t\t}\n\t\t// uri components\n\t\tif (this.path) {\n\t\t\tres.path = this.path;\n\t\t}\n\t\tif (this.scheme) {\n\t\t\tres.scheme = this.scheme;\n\t\t}\n\t\tif (this.authority) {\n\t\t\tres.authority = this.authority;\n\t\t}\n\t\tif (this.query) {\n\t\t\tres.query = this.query;\n\t\t}\n\t\tif (this.fragment) {\n\t\t\tres.fragment = this.fragment;\n\t\t}\n\t\treturn res;\n\t}\n}\n\n// reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2\nconst encodeTable: { [ch: number]: string } = {\n\t[CharCode.Colon]: '%3A', // gen-delims\n\t[CharCode.Slash]: '%2F',\n\t[CharCode.QuestionMark]: '%3F',\n\t[CharCode.Hash]: '%23',\n\t[CharCode.OpenSquareBracket]: '%5B',\n\t[CharCode.CloseSquareBracket]: '%5D',\n\t[CharCode.AtSign]: '%40',\n\n\t[CharCode.ExclamationMark]: '%21', // sub-delims\n\t[CharCode.DollarSign]: '%24',\n\t[CharCode.Ampersand]: '%26',\n\t[CharCode.SingleQuote]: '%27',\n\t[CharCode.OpenParen]: '%28',\n\t[CharCode.CloseParen]: '%29',\n\t[CharCode.Asterisk]: '%2A',\n\t[CharCode.Plus]: '%2B',\n\t[CharCode.Comma]: '%2C',\n\t[CharCode.Semicolon]: '%3B',\n\t[CharCode.Equals]: '%3D',\n\n\t[CharCode.Space]: '%20',\n};\n\nfunction encodeURIComponentFast(uriComponent: string, allowSlash: boolean): string {\n\tlet res: string | undefined = undefined;\n\tlet nativeEncodePos = -1;\n\n\tfor (let pos = 0; pos < uriComponent.length; pos++) {\n\t\tconst code = uriComponent.charCodeAt(pos);\n\n\t\t// unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3\n\t\tif (\n\t\t\t(code >= CharCode.a && code <= CharCode.z)\n\t\t\t|| (code >= CharCode.A && code <= CharCode.Z)\n\t\t\t|| (code >= CharCode.Digit0 && code <= CharCode.Digit9)\n\t\t\t|| code === CharCode.Dash\n\t\t\t|| code === CharCode.Period\n\t\t\t|| code === CharCode.Underline\n\t\t\t|| code === CharCode.Tilde\n\t\t\t|| (allowSlash && code === CharCode.Slash)\n\t\t) {\n\t\t\t// check if we are delaying native encode\n\t\t\tif (nativeEncodePos !== -1) {\n\t\t\t\tres += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\n\t\t\t\tnativeEncodePos = -1;\n\t\t\t}\n\t\t\t// check if we write into a new string (by default we try to return the param)\n\t\t\tif (res !== undefined) {\n\t\t\t\tres += uriComponent.charAt(pos);\n\t\t\t}\n\n\t\t} else {\n\t\t\t// encoding needed, we need to allocate a new string\n\t\t\tif (res === undefined) {\n\t\t\t\tres = uriComponent.substr(0, pos);\n\t\t\t}\n\n\t\t\t// check with default table first\n\t\t\tconst escaped = encodeTable[code];\n\t\t\tif (escaped !== undefined) {\n\n\t\t\t\t// check if we are delaying native encode\n\t\t\t\tif (nativeEncodePos !== -1) {\n\t\t\t\t\tres += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\n\t\t\t\t\tnativeEncodePos = -1;\n\t\t\t\t}\n\n\t\t\t\t// append escaped variant to result\n\t\t\t\tres += escaped;\n\n\t\t\t} else if (nativeEncodePos === -1) {\n\t\t\t\t// use native encode only when needed\n\t\t\t\tnativeEncodePos = pos;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (nativeEncodePos !== -1) {\n\t\tres += encodeURIComponent(uriComponent.substring(nativeEncodePos));\n\t}\n\n\treturn res !== undefined ? res : uriComponent;\n}\n\nfunction encodeURIComponentMinimal(path: string): string {\n\tlet res: string | undefined = undefined;\n\tfor (let pos = 0; pos < path.length; pos++) {\n\t\tconst code = path.charCodeAt(pos);\n\t\tif (code === CharCode.Hash || code === CharCode.QuestionMark) {\n\t\t\tif (res === undefined) {\n\t\t\t\tres = path.substr(0, pos);\n\t\t\t}\n\t\t\tres += encodeTable[code];\n\t\t} else {\n\t\t\tif (res !== undefined) {\n\t\t\t\tres += path[pos];\n\t\t\t}\n\t\t}\n\t}\n\treturn res !== undefined ? res : path;\n}\n\n/**\n * Compute `fsPath` for the given uri\n */\nexport function uriToFsPath(uri: URI, keepDriveLetterCasing: boolean): string {\n\n\tlet value: string;\n\tif (uri.authority && uri.path.length > 1 && uri.scheme === 'file') {\n\t\t// unc path: file://shares/c$/far/boo\n\t\tvalue = `//${uri.authority}${uri.path}`;\n\t} else if (\n\t\turi.path.charCodeAt(0) === CharCode.Slash\n\t\t&& (uri.path.charCodeAt(1) >= CharCode.A && uri.path.charCodeAt(1) <= CharCode.Z || uri.path.charCodeAt(1) >= CharCode.a && uri.path.charCodeAt(1) <= CharCode.z)\n\t\t&& uri.path.charCodeAt(2) === CharCode.Colon\n\t) {\n\t\tif (!keepDriveLetterCasing) {\n\t\t\t// windows drive letter: file:///c:/far/boo\n\t\t\tvalue = uri.path[1].toLowerCase() + uri.path.substr(2);\n\t\t} else {\n\t\t\tvalue = uri.path.substr(1);\n\t\t}\n\t} else {\n\t\t// other path\n\t\tvalue = uri.path;\n\t}\n\tif (isWindows) {\n\t\tvalue = value.replace(/\\//g, '\\\\');\n\t}\n\treturn value;\n}\n\n/**\n * Create the external version of a uri\n */\nfunction _asFormatted(uri: URI, skipEncoding: boolean): string {\n\n\tconst encoder = !skipEncoding\n\t\t? encodeURIComponentFast\n\t\t: encodeURIComponentMinimal;\n\n\tlet res = '';\n\tlet { scheme, authority, path, query, fragment } = uri;\n\tif (scheme) {\n\t\tres += scheme;\n\t\tres += ':';\n\t}\n\tif (authority || scheme === 'file') {\n\t\tres += _slash;\n\t\tres += _slash;\n\t}\n\tif (authority) {\n\t\tlet idx = authority.indexOf('@');\n\t\tif (idx !== -1) {\n\t\t\t// @\n\t\t\tconst userinfo = authority.substr(0, idx);\n\t\t\tauthority = authority.substr(idx + 1);\n\t\t\tidx = userinfo.indexOf(':');\n\t\t\tif (idx === -1) {\n\t\t\t\tres += encoder(userinfo, false);\n\t\t\t} else {\n\t\t\t\t// :@\n\t\t\t\tres += encoder(userinfo.substr(0, idx), false);\n\t\t\t\tres += ':';\n\t\t\t\tres += encoder(userinfo.substr(idx + 1), false);\n\t\t\t}\n\t\t\tres += '@';\n\t\t}\n\t\tauthority = authority.toLowerCase();\n\t\tidx = authority.indexOf(':');\n\t\tif (idx === -1) {\n\t\t\tres += encoder(authority, false);\n\t\t} else {\n\t\t\t// :\n\t\t\tres += encoder(authority.substr(0, idx), false);\n\t\t\tres += authority.substr(idx);\n\t\t}\n\t}\n\tif (path) {\n\t\t// lower-case windows drive letters in /C:/fff or C:/fff\n\t\tif (path.length >= 3 && path.charCodeAt(0) === CharCode.Slash && path.charCodeAt(2) === CharCode.Colon) {\n\t\t\tconst code = path.charCodeAt(1);\n\t\t\tif (code >= CharCode.A && code <= CharCode.Z) {\n\t\t\t\tpath = `/${String.fromCharCode(code + 32)}:${path.substr(3)}`; // \"/c:\".length === 3\n\t\t\t}\n\t\t} else if (path.length >= 2 && path.charCodeAt(1) === CharCode.Colon) {\n\t\t\tconst code = path.charCodeAt(0);\n\t\t\tif (code >= CharCode.A && code <= CharCode.Z) {\n\t\t\t\tpath = `${String.fromCharCode(code + 32)}:${path.substr(2)}`; // \"/c:\".length === 3\n\t\t\t}\n\t\t}\n\t\t// encode the rest of the path\n\t\tres += encoder(path, true);\n\t}\n\tif (query) {\n\t\tres += '?';\n\t\tres += encoder(query, false);\n\t}\n\tif (fragment) {\n\t\tres += '#';\n\t\tres += !skipEncoding ? encodeURIComponentFast(fragment, false) : fragment;\n\t}\n\treturn res;\n}\n\n// --- decode\n\nfunction decodeURIComponentGraceful(str: string): string {\n\ttry {\n\t\treturn decodeURIComponent(str);\n\t} catch {\n\t\tif (str.length > 3) {\n\t\t\treturn str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3));\n\t\t} else {\n\t\t\treturn str;\n\t\t}\n\t}\n}\n\nconst _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g;\n\nfunction percentDecode(str: string): string {\n\tif (!str.match(_rEncodedAsHex)) {\n\t\treturn str;\n\t}\n\treturn str.replace(_rEncodedAsHex, (match) => decodeURIComponentGraceful(match));\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n'use strict';\n\nimport { CharCode } from './charCode';\nimport { URI } from './uri';\nimport * as nodePath from 'path';\n\nconst posixPath = nodePath.posix || nodePath;\n\nexport namespace Utils {\n\n /**\n * Joins one or more input paths to the path of URI. \n * '/' is used as the directory separation character. \n * \n * The resolved path will be normalized. That means:\n * - all '..' and '.' segments are resolved.\n * - multiple, sequential occurences of '/' are replaced by a single instance of '/'.\n * - trailing separators are preserved.\n * \n * @param uri The input URI.\n * @param paths The paths to be joined with the path of URI.\n * @returns A URI with the joined path. All other properties of the URI (scheme, authority, query, fragments, ...) will be taken from the input URI.\n */\n export function joinPath(uri: URI, ...paths: string[]): URI {\n return uri.with({ path: posixPath.join(uri.path, ...paths) });\n }\n\n\n /**\n * Resolves one or more paths against the path of a URI. \n * '/' is used as the directory separation character. \n * \n * The resolved path will be normalized. That means:\n * - all '..' and '.' segments are resolved. \n * - multiple, sequential occurences of '/' are replaced by a single instance of '/'.\n * - trailing separators are removed.\n * \n * @param uri The input URI.\n * @param paths The paths to resolve against the path of URI.\n * @returns A URI with the resolved path. All other properties of the URI (scheme, authority, query, fragments, ...) will be taken from the input URI.\n */\n export function resolvePath(uri: URI, ...paths: string[]): URI {\n const path = uri.path || '/'; // normalize the path which is necessary as for posixPath.resolve the first segments has to be absolute or cwd is used.\n return uri.with({ path: posixPath.resolve(path, ...paths) });\n }\n\n /**\n * Returns a URI where the path is the directory name of the input uri, similar to the Unix dirname command. \n * In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.\n * The orignal URI is returned if the URIs path is empty or does not contain any path segments.\n * \n * @param uri The input URI.\n * @return The last segment of the URIs path.\n */\n export function dirname(uri: URI): URI {\n let path = posixPath.dirname(uri.path);\n if (path.length === 1 && path.charCodeAt(0) === CharCode.Period) {\n return uri;\n }\n return uri.with({ path });\n }\n\n /**\n * Returns the last segment of the path of a URI, similar to the Unix basename command. \n * In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.\n * The empty string is returned if the URIs path is empty or does not contain any path segments.\n * \n * @param uri The input URI.\n * @return The base name of the URIs path.\n */\n export function basename(uri: URI): string {\n return posixPath.basename(uri.path);\n }\n\n /**\n * Returns the extension name of the path of a URI, similar to the Unix extname command. \n * In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.\n * The empty string is returned if the URIs path is empty or does not contain any path segments.\n * \n * @param uri The input URI.\n * @return The extension name of the URIs path.\n */\n export function extname(uri: URI): string {\n return posixPath.extname(uri.path);\n }\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(447);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};"],"sourceRoot":""} \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/charCode.d.ts b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/charCode.d.ts new file mode 100644 index 0000000..61c9a2f --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/charCode.d.ts @@ -0,0 +1,415 @@ +/** + * An inlined enum containing useful character codes (to be used with String.charCodeAt). + * Please leave the const keyword such that it gets inlined when compiled to JavaScript! + */ +export declare const enum CharCode { + Null = 0, + /** + * The `\b` character. + */ + Backspace = 8, + /** + * The `\t` character. + */ + Tab = 9, + /** + * The `\n` character. + */ + LineFeed = 10, + /** + * The `\r` character. + */ + CarriageReturn = 13, + Space = 32, + /** + * The `!` character. + */ + ExclamationMark = 33, + /** + * The `"` character. + */ + DoubleQuote = 34, + /** + * The `#` character. + */ + Hash = 35, + /** + * The `$` character. + */ + DollarSign = 36, + /** + * The `%` character. + */ + PercentSign = 37, + /** + * The `&` character. + */ + Ampersand = 38, + /** + * The `'` character. + */ + SingleQuote = 39, + /** + * The `(` character. + */ + OpenParen = 40, + /** + * The `)` character. + */ + CloseParen = 41, + /** + * The `*` character. + */ + Asterisk = 42, + /** + * The `+` character. + */ + Plus = 43, + /** + * The `,` character. + */ + Comma = 44, + /** + * The `-` character. + */ + Dash = 45, + /** + * The `.` character. + */ + Period = 46, + /** + * The `/` character. + */ + Slash = 47, + Digit0 = 48, + Digit1 = 49, + Digit2 = 50, + Digit3 = 51, + Digit4 = 52, + Digit5 = 53, + Digit6 = 54, + Digit7 = 55, + Digit8 = 56, + Digit9 = 57, + /** + * The `:` character. + */ + Colon = 58, + /** + * The `;` character. + */ + Semicolon = 59, + /** + * The `<` character. + */ + LessThan = 60, + /** + * The `=` character. + */ + Equals = 61, + /** + * The `>` character. + */ + GreaterThan = 62, + /** + * The `?` character. + */ + QuestionMark = 63, + /** + * The `@` character. + */ + AtSign = 64, + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + /** + * The `[` character. + */ + OpenSquareBracket = 91, + /** + * The `\` character. + */ + Backslash = 92, + /** + * The `]` character. + */ + CloseSquareBracket = 93, + /** + * The `^` character. + */ + Caret = 94, + /** + * The `_` character. + */ + Underline = 95, + /** + * The ``(`)`` character. + */ + BackTick = 96, + a = 97, + b = 98, + c = 99, + d = 100, + e = 101, + f = 102, + g = 103, + h = 104, + i = 105, + j = 106, + k = 107, + l = 108, + m = 109, + n = 110, + o = 111, + p = 112, + q = 113, + r = 114, + s = 115, + t = 116, + u = 117, + v = 118, + w = 119, + x = 120, + y = 121, + z = 122, + /** + * The `{` character. + */ + OpenCurlyBrace = 123, + /** + * The `|` character. + */ + Pipe = 124, + /** + * The `}` character. + */ + CloseCurlyBrace = 125, + /** + * The `~` character. + */ + Tilde = 126, + U_Combining_Grave_Accent = 768, + U_Combining_Acute_Accent = 769, + U_Combining_Circumflex_Accent = 770, + U_Combining_Tilde = 771, + U_Combining_Macron = 772, + U_Combining_Overline = 773, + U_Combining_Breve = 774, + U_Combining_Dot_Above = 775, + U_Combining_Diaeresis = 776, + U_Combining_Hook_Above = 777, + U_Combining_Ring_Above = 778, + U_Combining_Double_Acute_Accent = 779, + U_Combining_Caron = 780, + U_Combining_Vertical_Line_Above = 781, + U_Combining_Double_Vertical_Line_Above = 782, + U_Combining_Double_Grave_Accent = 783, + U_Combining_Candrabindu = 784, + U_Combining_Inverted_Breve = 785, + U_Combining_Turned_Comma_Above = 786, + U_Combining_Comma_Above = 787, + U_Combining_Reversed_Comma_Above = 788, + U_Combining_Comma_Above_Right = 789, + U_Combining_Grave_Accent_Below = 790, + U_Combining_Acute_Accent_Below = 791, + U_Combining_Left_Tack_Below = 792, + U_Combining_Right_Tack_Below = 793, + U_Combining_Left_Angle_Above = 794, + U_Combining_Horn = 795, + U_Combining_Left_Half_Ring_Below = 796, + U_Combining_Up_Tack_Below = 797, + U_Combining_Down_Tack_Below = 798, + U_Combining_Plus_Sign_Below = 799, + U_Combining_Minus_Sign_Below = 800, + U_Combining_Palatalized_Hook_Below = 801, + U_Combining_Retroflex_Hook_Below = 802, + U_Combining_Dot_Below = 803, + U_Combining_Diaeresis_Below = 804, + U_Combining_Ring_Below = 805, + U_Combining_Comma_Below = 806, + U_Combining_Cedilla = 807, + U_Combining_Ogonek = 808, + U_Combining_Vertical_Line_Below = 809, + U_Combining_Bridge_Below = 810, + U_Combining_Inverted_Double_Arch_Below = 811, + U_Combining_Caron_Below = 812, + U_Combining_Circumflex_Accent_Below = 813, + U_Combining_Breve_Below = 814, + U_Combining_Inverted_Breve_Below = 815, + U_Combining_Tilde_Below = 816, + U_Combining_Macron_Below = 817, + U_Combining_Low_Line = 818, + U_Combining_Double_Low_Line = 819, + U_Combining_Tilde_Overlay = 820, + U_Combining_Short_Stroke_Overlay = 821, + U_Combining_Long_Stroke_Overlay = 822, + U_Combining_Short_Solidus_Overlay = 823, + U_Combining_Long_Solidus_Overlay = 824, + U_Combining_Right_Half_Ring_Below = 825, + U_Combining_Inverted_Bridge_Below = 826, + U_Combining_Square_Below = 827, + U_Combining_Seagull_Below = 828, + U_Combining_X_Above = 829, + U_Combining_Vertical_Tilde = 830, + U_Combining_Double_Overline = 831, + U_Combining_Grave_Tone_Mark = 832, + U_Combining_Acute_Tone_Mark = 833, + U_Combining_Greek_Perispomeni = 834, + U_Combining_Greek_Koronis = 835, + U_Combining_Greek_Dialytika_Tonos = 836, + U_Combining_Greek_Ypogegrammeni = 837, + U_Combining_Bridge_Above = 838, + U_Combining_Equals_Sign_Below = 839, + U_Combining_Double_Vertical_Line_Below = 840, + U_Combining_Left_Angle_Below = 841, + U_Combining_Not_Tilde_Above = 842, + U_Combining_Homothetic_Above = 843, + U_Combining_Almost_Equal_To_Above = 844, + U_Combining_Left_Right_Arrow_Below = 845, + U_Combining_Upwards_Arrow_Below = 846, + U_Combining_Grapheme_Joiner = 847, + U_Combining_Right_Arrowhead_Above = 848, + U_Combining_Left_Half_Ring_Above = 849, + U_Combining_Fermata = 850, + U_Combining_X_Below = 851, + U_Combining_Left_Arrowhead_Below = 852, + U_Combining_Right_Arrowhead_Below = 853, + U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below = 854, + U_Combining_Right_Half_Ring_Above = 855, + U_Combining_Dot_Above_Right = 856, + U_Combining_Asterisk_Below = 857, + U_Combining_Double_Ring_Below = 858, + U_Combining_Zigzag_Above = 859, + U_Combining_Double_Breve_Below = 860, + U_Combining_Double_Breve = 861, + U_Combining_Double_Macron = 862, + U_Combining_Double_Macron_Below = 863, + U_Combining_Double_Tilde = 864, + U_Combining_Double_Inverted_Breve = 865, + U_Combining_Double_Rightwards_Arrow_Below = 866, + U_Combining_Latin_Small_Letter_A = 867, + U_Combining_Latin_Small_Letter_E = 868, + U_Combining_Latin_Small_Letter_I = 869, + U_Combining_Latin_Small_Letter_O = 870, + U_Combining_Latin_Small_Letter_U = 871, + U_Combining_Latin_Small_Letter_C = 872, + U_Combining_Latin_Small_Letter_D = 873, + U_Combining_Latin_Small_Letter_H = 874, + U_Combining_Latin_Small_Letter_M = 875, + U_Combining_Latin_Small_Letter_R = 876, + U_Combining_Latin_Small_Letter_T = 877, + U_Combining_Latin_Small_Letter_V = 878, + U_Combining_Latin_Small_Letter_X = 879, + /** + * Unicode Character 'LINE SEPARATOR' (U+2028) + * http://www.fileformat.info/info/unicode/char/2028/index.htm + */ + LINE_SEPARATOR = 8232, + /** + * Unicode Character 'PARAGRAPH SEPARATOR' (U+2029) + * http://www.fileformat.info/info/unicode/char/2029/index.htm + */ + PARAGRAPH_SEPARATOR = 8233, + /** + * Unicode Character 'NEXT LINE' (U+0085) + * http://www.fileformat.info/info/unicode/char/0085/index.htm + */ + NEXT_LINE = 133, + U_CIRCUMFLEX = 94, + U_GRAVE_ACCENT = 96, + U_DIAERESIS = 168, + U_MACRON = 175, + U_ACUTE_ACCENT = 180, + U_CEDILLA = 184, + U_MODIFIER_LETTER_LEFT_ARROWHEAD = 706, + U_MODIFIER_LETTER_RIGHT_ARROWHEAD = 707, + U_MODIFIER_LETTER_UP_ARROWHEAD = 708, + U_MODIFIER_LETTER_DOWN_ARROWHEAD = 709, + U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING = 722, + U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING = 723, + U_MODIFIER_LETTER_UP_TACK = 724, + U_MODIFIER_LETTER_DOWN_TACK = 725, + U_MODIFIER_LETTER_PLUS_SIGN = 726, + U_MODIFIER_LETTER_MINUS_SIGN = 727, + U_BREVE = 728, + U_DOT_ABOVE = 729, + U_RING_ABOVE = 730, + U_OGONEK = 731, + U_SMALL_TILDE = 732, + U_DOUBLE_ACUTE_ACCENT = 733, + U_MODIFIER_LETTER_RHOTIC_HOOK = 734, + U_MODIFIER_LETTER_CROSS_ACCENT = 735, + U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR = 741, + U_MODIFIER_LETTER_HIGH_TONE_BAR = 742, + U_MODIFIER_LETTER_MID_TONE_BAR = 743, + U_MODIFIER_LETTER_LOW_TONE_BAR = 744, + U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR = 745, + U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK = 746, + U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK = 747, + U_MODIFIER_LETTER_UNASPIRATED = 749, + U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD = 751, + U_MODIFIER_LETTER_LOW_UP_ARROWHEAD = 752, + U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD = 753, + U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD = 754, + U_MODIFIER_LETTER_LOW_RING = 755, + U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT = 756, + U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT = 757, + U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT = 758, + U_MODIFIER_LETTER_LOW_TILDE = 759, + U_MODIFIER_LETTER_RAISED_COLON = 760, + U_MODIFIER_LETTER_BEGIN_HIGH_TONE = 761, + U_MODIFIER_LETTER_END_HIGH_TONE = 762, + U_MODIFIER_LETTER_BEGIN_LOW_TONE = 763, + U_MODIFIER_LETTER_END_LOW_TONE = 764, + U_MODIFIER_LETTER_SHELF = 765, + U_MODIFIER_LETTER_OPEN_SHELF = 766, + U_MODIFIER_LETTER_LOW_LEFT_ARROW = 767, + U_GREEK_LOWER_NUMERAL_SIGN = 885, + U_GREEK_TONOS = 900, + U_GREEK_DIALYTIKA_TONOS = 901, + U_GREEK_KORONIS = 8125, + U_GREEK_PSILI = 8127, + U_GREEK_PERISPOMENI = 8128, + U_GREEK_DIALYTIKA_AND_PERISPOMENI = 8129, + U_GREEK_PSILI_AND_VARIA = 8141, + U_GREEK_PSILI_AND_OXIA = 8142, + U_GREEK_PSILI_AND_PERISPOMENI = 8143, + U_GREEK_DASIA_AND_VARIA = 8157, + U_GREEK_DASIA_AND_OXIA = 8158, + U_GREEK_DASIA_AND_PERISPOMENI = 8159, + U_GREEK_DIALYTIKA_AND_VARIA = 8173, + U_GREEK_DIALYTIKA_AND_OXIA = 8174, + U_GREEK_VARIA = 8175, + U_GREEK_OXIA = 8189, + U_GREEK_DASIA = 8190, + U_OVERLINE = 8254, + /** + * UTF-8 BOM + * Unicode Character 'ZERO WIDTH NO-BREAK SPACE' (U+FEFF) + * http://www.fileformat.info/info/unicode/char/feff/index.htm + */ + UTF8_BOM = 65279 +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/index.d.ts b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/index.d.ts new file mode 100644 index 0000000..e1c71f7 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/index.d.ts @@ -0,0 +1,3 @@ +import { URI } from './uri'; +import { Utils } from './utils'; +export { URI, Utils }; diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/index.js b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/index.js new file mode 100644 index 0000000..2acdb89 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/index.js @@ -0,0 +1,2 @@ +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(this,(function(){return(()=>{"use strict";var t={470:t=>{function e(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function r(t,e){for(var r,n="",i=0,o=-1,a=0,h=0;h<=t.length;++h){if(h2){var s=n.lastIndexOf("/");if(s!==n.length-1){-1===s?(n="",i=0):i=(n=n.slice(0,s)).length-1-n.lastIndexOf("/"),o=h,a=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=h,a=0;continue}e&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+t.slice(o+1,h):n=t.slice(o+1,h),i=h-o-1;o=h,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var n={resolve:function(){for(var t,n="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var a;o>=0?a=arguments[o]:(void 0===t&&(t=process.cwd()),a=t),e(a),0!==a.length&&(n=a+"/"+n,i=47===a.charCodeAt(0))}return n=r(n,!i),i?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(t){if(e(t),0===t.length)return".";var n=47===t.charCodeAt(0),i=47===t.charCodeAt(t.length-1);return 0!==(t=r(t,!n)).length||n||(t="."),t.length>0&&i&&(t+="/"),n?"/"+t:t},isAbsolute:function(t){return e(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,r=0;r0&&(void 0===t?t=i:t+="/"+i)}return void 0===t?".":n.normalize(t)},relative:function(t,r){if(e(t),e(r),t===r)return"";if((t=n.resolve(t))===(r=n.resolve(r)))return"";for(var i=1;if){if(47===r.charCodeAt(h+c))return r.slice(h+c+1);if(0===c)return r.slice(h+c)}else a>f&&(47===t.charCodeAt(i+c)?u=c:0===c&&(u=0));break}var l=t.charCodeAt(i+c);if(l!==r.charCodeAt(h+c))break;47===l&&(u=c)}var p="";for(c=i+u+1;c<=o;++c)c!==o&&47!==t.charCodeAt(c)||(0===p.length?p+="..":p+="/..");return p.length>0?p+r.slice(h+u):(h+=u,47===r.charCodeAt(h)&&++h,r.slice(h))},_makeLong:function(t){return t},dirname:function(t){if(e(t),0===t.length)return".";for(var r=t.charCodeAt(0),n=47===r,i=-1,o=!0,a=t.length-1;a>=1;--a)if(47===(r=t.charCodeAt(a))){if(!o){i=a;break}}else o=!1;return-1===i?n?"/":".":n&&1===i?"//":t.slice(0,i)},basename:function(t,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');e(t);var n,i=0,o=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=t.length){if(r.length===t.length&&r===t)return"";var h=r.length-1,s=-1;for(n=t.length-1;n>=0;--n){var f=t.charCodeAt(n);if(47===f){if(!a){i=n+1;break}}else-1===s&&(a=!1,s=n+1),h>=0&&(f===r.charCodeAt(h)?-1==--h&&(o=n):(h=-1,o=s))}return i===o?o=s:-1===o&&(o=t.length),t.slice(i,o)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!a){i=n+1;break}}else-1===o&&(a=!1,o=n+1);return-1===o?"":t.slice(i,o)},extname:function(t){e(t);for(var r=-1,n=0,i=-1,o=!0,a=0,h=t.length-1;h>=0;--h){var s=t.charCodeAt(h);if(47!==s)-1===i&&(o=!1,i=h+1),46===s?-1===r?r=h:1!==a&&(a=1):-1!==r&&(a=-1);else if(!o){n=h+1;break}}return-1===r||-1===i||0===a||1===a&&r===i-1&&r===n+1?"":t.slice(r,i)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+"/"+n:n}(0,t)},parse:function(t){e(t);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return r;var n,i=t.charCodeAt(0),o=47===i;o?(r.root="/",n=1):n=0;for(var a=-1,h=0,s=-1,f=!0,u=t.length-1,c=0;u>=n;--u)if(47!==(i=t.charCodeAt(u)))-1===s&&(f=!1,s=u+1),46===i?-1===a?a=u:1!==c&&(c=1):-1!==a&&(c=-1);else if(!f){h=u+1;break}return-1===a||-1===s||0===c||1===c&&a===s-1&&a===h+1?-1!==s&&(r.base=r.name=0===h&&o?t.slice(1,s):t.slice(h,s)):(0===h&&o?(r.name=t.slice(1,a),r.base=t.slice(1,s)):(r.name=t.slice(h,a),r.base=t.slice(h,s)),r.ext=t.slice(a,s)),h>0?r.dir=t.slice(0,h-1):o&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,t.exports=n},465:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Utils=e.URI=void 0;var n=r(796);Object.defineProperty(e,"URI",{enumerable:!0,get:function(){return n.URI}});var i=r(679);Object.defineProperty(e,"Utils",{enumerable:!0,get:function(){return i.Utils}})},674:(t,e)=>{if(Object.defineProperty(e,"__esModule",{value:!0}),e.isWindows=void 0,"object"==typeof process)e.isWindows="win32"===process.platform;else if("object"==typeof navigator){var r=navigator.userAgent;e.isWindows=r.indexOf("Windows")>=0}},796:function(t,e,r){var n,i,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.uriToFsPath=e.URI=void 0;var a=r(674),h=/^\w[\w\d+.-]*$/,s=/^\//,f=/^\/\//,u="",c="/",l=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,p=function(){function t(t,e,r,n,i,o){void 0===o&&(o=!1),"object"==typeof t?(this.scheme=t.scheme||u,this.authority=t.authority||u,this.path=t.path||u,this.query=t.query||u,this.fragment=t.fragment||u):(this.scheme=function(t,e){return t||e?t:"file"}(t,o),this.authority=e||u,this.path=function(t,e){switch(t){case"https":case"http":case"file":e?e[0]!==c&&(e=c+e):e=c}return e}(this.scheme,r||u),this.query=n||u,this.fragment=i||u,function(t,e){if(!t.scheme&&e)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'+t.authority+'", path: "'+t.path+'", query: "'+t.query+'", fragment: "'+t.fragment+'"}');if(t.scheme&&!h.test(t.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t.path)if(t.authority){if(!s.test(t.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(f.test(t.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}(this,o))}return t.isUri=function(e){return e instanceof t||!!e&&"string"==typeof e.authority&&"string"==typeof e.fragment&&"string"==typeof e.path&&"string"==typeof e.query&&"string"==typeof e.scheme&&"function"==typeof e.fsPath&&"function"==typeof e.with&&"function"==typeof e.toString},Object.defineProperty(t.prototype,"fsPath",{get:function(){return b(this,!1)},enumerable:!1,configurable:!0}),t.prototype.with=function(t){if(!t)return this;var e=t.scheme,r=t.authority,n=t.path,i=t.query,o=t.fragment;return void 0===e?e=this.scheme:null===e&&(e=u),void 0===r?r=this.authority:null===r&&(r=u),void 0===n?n=this.path:null===n&&(n=u),void 0===i?i=this.query:null===i&&(i=u),void 0===o?o=this.fragment:null===o&&(o=u),e===this.scheme&&r===this.authority&&n===this.path&&i===this.query&&o===this.fragment?this:new g(e,r,n,i,o)},t.parse=function(t,e){void 0===e&&(e=!1);var r=l.exec(t);return r?new g(r[2]||u,_(r[4]||u),_(r[5]||u),_(r[7]||u),_(r[9]||u),e):new g(u,u,u,u,u)},t.file=function(t){var e=u;if(a.isWindows&&(t=t.replace(/\\/g,c)),t[0]===c&&t[1]===c){var r=t.indexOf(c,2);-1===r?(e=t.substring(2),t=c):(e=t.substring(2,r),t=t.substring(r)||c)}return new g("file",e,t,u,u)},t.from=function(t){return new g(t.scheme,t.authority,t.path,t.query,t.fragment)},t.prototype.toString=function(t){return void 0===t&&(t=!1),C(this,t)},t.prototype.toJSON=function(){return this},t.revive=function(e){if(e){if(e instanceof t)return e;var r=new g(e);return r._formatted=e.external,r._fsPath=e._sep===d?e.fsPath:null,r}return e},t}();e.URI=p;var d=a.isWindows?1:void 0,g=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._formatted=null,e._fsPath=null,e}return o(e,t),Object.defineProperty(e.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=b(this,!1)),this._fsPath},enumerable:!1,configurable:!0}),e.prototype.toString=function(t){return void 0===t&&(t=!1),t?C(this,!0):(this._formatted||(this._formatted=C(this,!1)),this._formatted)},e.prototype.toJSON=function(){var t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=d),this._formatted&&(t.external=this._formatted),this.path&&(t.path=this.path),this.scheme&&(t.scheme=this.scheme),this.authority&&(t.authority=this.authority),this.query&&(t.query=this.query),this.fragment&&(t.fragment=this.fragment),t},e}(p),v=((i={})[58]="%3A",i[47]="%2F",i[63]="%3F",i[35]="%23",i[91]="%5B",i[93]="%5D",i[64]="%40",i[33]="%21",i[36]="%24",i[38]="%26",i[39]="%27",i[40]="%28",i[41]="%29",i[42]="%2A",i[43]="%2B",i[44]="%2C",i[59]="%3B",i[61]="%3D",i[32]="%20",i);function m(t,e){for(var r=void 0,n=-1,i=0;i=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||45===o||46===o||95===o||126===o||e&&47===o)-1!==n&&(r+=encodeURIComponent(t.substring(n,i)),n=-1),void 0!==r&&(r+=t.charAt(i));else{void 0===r&&(r=t.substr(0,i));var a=v[o];void 0!==a?(-1!==n&&(r+=encodeURIComponent(t.substring(n,i)),n=-1),r+=a):-1===n&&(n=i)}}return-1!==n&&(r+=encodeURIComponent(t.substring(n))),void 0!==r?r:t}function y(t){for(var e=void 0,r=0;r1&&"file"===t.scheme?"//"+t.authority+t.path:47===t.path.charCodeAt(0)&&(t.path.charCodeAt(1)>=65&&t.path.charCodeAt(1)<=90||t.path.charCodeAt(1)>=97&&t.path.charCodeAt(1)<=122)&&58===t.path.charCodeAt(2)?e?t.path.substr(1):t.path[1].toLowerCase()+t.path.substr(2):t.path,a.isWindows&&(r=r.replace(/\//g,"\\")),r}function C(t,e){var r=e?y:m,n="",i=t.scheme,o=t.authority,a=t.path,h=t.query,s=t.fragment;if(i&&(n+=i,n+=":"),(o||"file"===i)&&(n+=c,n+=c),o){var f=o.indexOf("@");if(-1!==f){var u=o.substr(0,f);o=o.substr(f+1),-1===(f=u.indexOf(":"))?n+=r(u,!1):(n+=r(u.substr(0,f),!1),n+=":",n+=r(u.substr(f+1),!1)),n+="@"}-1===(f=(o=o.toLowerCase()).indexOf(":"))?n+=r(o,!1):(n+=r(o.substr(0,f),!1),n+=o.substr(f))}if(a){if(a.length>=3&&47===a.charCodeAt(0)&&58===a.charCodeAt(2))(l=a.charCodeAt(1))>=65&&l<=90&&(a="/"+String.fromCharCode(l+32)+":"+a.substr(3));else if(a.length>=2&&58===a.charCodeAt(1)){var l;(l=a.charCodeAt(0))>=65&&l<=90&&(a=String.fromCharCode(l+32)+":"+a.substr(2))}n+=r(a,!0)}return h&&(n+="?",n+=r(h,!1)),s&&(n+="#",n+=e?s:m(s,!1)),n}function A(t){try{return decodeURIComponent(t)}catch(e){return t.length>3?t.substr(0,3)+A(t.substr(3)):t}}e.uriToFsPath=b;var w=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function _(t){return t.match(w)?t.replace(w,(function(t){return A(t)})):t}},679:function(t,e,r){var n=this&&this.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 /*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47 /*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute) path = '.';\n if (path.length > 0 && trailingSeparator) path += '/';\n\n if (isAbsolute) return '/' + path;\n return path;\n },\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;\n },\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to) return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to) return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47 /*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = fromEnd - fromStart;\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47 /*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = toEnd - toStart;\n\n // Compare paths to find the longest common path from root\n var length = fromLen < toLen ? fromLen : toLen;\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47 /*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47 /*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47 /*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47 /*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) return '//';\n return path.slice(0, end);\n },\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path) return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n }\n },\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError('The \"pathObject\" argument must be of type Object. Received type ' + typeof pathObject);\n }\n return _format('/', pathObject);\n },\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = code === 47 /*/*/;\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\n\nposix.posix = posix;\n\nmodule.exports = posix;\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\n\nimport { URI } from './uri';\nimport { Utils } from './utils';\n\nexport { URI, Utils }","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\n\n// !!!!!\n// SEE https://github.com/microsoft/vscode/blob/master/src/vs/base/common/platform.ts\n// !!!!!\n\ndeclare const process: { platform: 'win32' };\ndeclare const navigator: { userAgent: string };\n\nexport let isWindows: boolean;\n\nif (typeof process === 'object') {\n\tisWindows = process.platform === 'win32';\n} else if (typeof navigator === 'object') {\n\tlet userAgent = navigator.userAgent;\n\tisWindows = userAgent.indexOf('Windows') >= 0;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\n\nimport { CharCode } from './charCode'\nimport { isWindows } from './platform';\n\nconst _schemePattern = /^\\w[\\w\\d+.-]*$/;\nconst _singleSlashStart = /^\\//;\nconst _doubleSlashStart = /^\\/\\//;\n\nfunction _validateUri(ret: URI, _strict?: boolean): void {\n\n\t// scheme, must be set\n\tif (!ret.scheme && _strict) {\n\t\tthrow new Error(`[UriError]: Scheme is missing: {scheme: \"\", authority: \"${ret.authority}\", path: \"${ret.path}\", query: \"${ret.query}\", fragment: \"${ret.fragment}\"}`);\n\t}\n\n\t// scheme, https://tools.ietf.org/html/rfc3986#section-3.1\n\t// ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\n\tif (ret.scheme && !_schemePattern.test(ret.scheme)) {\n\t\tthrow new Error('[UriError]: Scheme contains illegal characters.');\n\t}\n\n\t// path, http://tools.ietf.org/html/rfc3986#section-3.3\n\t// If a URI contains an authority component, then the path component\n\t// must either be empty or begin with a slash (\"/\") character. If a URI\n\t// does not contain an authority component, then the path cannot begin\n\t// with two slash characters (\"//\").\n\tif (ret.path) {\n\t\tif (ret.authority) {\n\t\t\tif (!_singleSlashStart.test(ret.path)) {\n\t\t\t\tthrow new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash (\"/\") character');\n\t\t\t}\n\t\t} else {\n\t\t\tif (_doubleSlashStart.test(ret.path)) {\n\t\t\t\tthrow new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters (\"//\")');\n\t\t\t}\n\t\t}\n\t}\n}\n\n// for a while we allowed uris *without* schemes and this is the migration\n// for them, e.g. an uri without scheme and without strict-mode warns and falls\n// back to the file-scheme. that should cause the least carnage and still be a\n// clear warning\nfunction _schemeFix(scheme: string, _strict: boolean): string {\n\tif (!scheme && !_strict) {\n\t\treturn 'file';\n\t}\n\treturn scheme;\n}\n\n// implements a bit of https://tools.ietf.org/html/rfc3986#section-5\nfunction _referenceResolution(scheme: string, path: string): string {\n\n\t// the slash-character is our 'default base' as we don't\n\t// support constructing URIs relative to other URIs. This\n\t// also means that we alter and potentially break paths.\n\t// see https://tools.ietf.org/html/rfc3986#section-5.1.4\n\tswitch (scheme) {\n\t\tcase 'https':\n\t\tcase 'http':\n\t\tcase 'file':\n\t\t\tif (!path) {\n\t\t\t\tpath = _slash;\n\t\t\t} else if (path[0] !== _slash) {\n\t\t\t\tpath = _slash + path;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn path;\n}\n\nconst _empty = '';\nconst _slash = '/';\nconst _regexp = /^(([^:/?#]+?):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/;\n\n/**\n * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.\n * This class is a simple parser which creates the basic component parts\n * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation\n * and encoding.\n *\n * ```txt\n * foo://example.com:8042/over/there?name=ferret#nose\n * \\_/ \\______________/\\_________/ \\_________/ \\__/\n * | | | | |\n * scheme authority path query fragment\n * | _____________________|__\n * / \\ / \\\n * urn:example:animal:ferret:nose\n * ```\n */\nexport class URI implements UriComponents {\n\n\tstatic isUri(thing: any): thing is URI {\n\t\tif (thing instanceof URI) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing).authority === 'string'\n\t\t\t&& typeof (thing).fragment === 'string'\n\t\t\t&& typeof (thing).path === 'string'\n\t\t\t&& typeof (thing).query === 'string'\n\t\t\t&& typeof (thing).scheme === 'string'\n\t\t\t&& typeof (thing).fsPath === 'function'\n\t\t\t&& typeof (thing).with === 'function'\n\t\t\t&& typeof (thing).toString === 'function';\n\t}\n\n\t/**\n\t * scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'.\n\t * The part before the first colon.\n\t */\n\treadonly scheme: string;\n\n\t/**\n\t * authority is the 'www.msft.com' part of 'http://www.msft.com/some/path?query#fragment'.\n\t * The part between the first double slashes and the next slash.\n\t */\n\treadonly authority: string;\n\n\t/**\n\t * path is the '/some/path' part of 'http://www.msft.com/some/path?query#fragment'.\n\t */\n\treadonly path: string;\n\n\t/**\n\t * query is the 'query' part of 'http://www.msft.com/some/path?query#fragment'.\n\t */\n\treadonly query: string;\n\n\t/**\n\t * fragment is the 'fragment' part of 'http://www.msft.com/some/path?query#fragment'.\n\t */\n\treadonly fragment: string;\n\n\t/**\n\t * @internal\n\t */\n\tprotected constructor(scheme: string, authority?: string, path?: string, query?: string, fragment?: string, _strict?: boolean);\n\n\t/**\n\t * @internal\n\t */\n\tprotected constructor(components: UriComponents);\n\n\t/**\n\t * @internal\n\t */\n\tprotected constructor(schemeOrData: string | UriComponents, authority?: string, path?: string, query?: string, fragment?: string, _strict: boolean = false) {\n\n\t\tif (typeof schemeOrData === 'object') {\n\t\t\tthis.scheme = schemeOrData.scheme || _empty;\n\t\t\tthis.authority = schemeOrData.authority || _empty;\n\t\t\tthis.path = schemeOrData.path || _empty;\n\t\t\tthis.query = schemeOrData.query || _empty;\n\t\t\tthis.fragment = schemeOrData.fragment || _empty;\n\t\t\t// no validation because it's this URI\n\t\t\t// that creates uri components.\n\t\t\t// _validateUri(this);\n\t\t} else {\n\t\t\tthis.scheme = _schemeFix(schemeOrData, _strict);\n\t\t\tthis.authority = authority || _empty;\n\t\t\tthis.path = _referenceResolution(this.scheme, path || _empty);\n\t\t\tthis.query = query || _empty;\n\t\t\tthis.fragment = fragment || _empty;\n\n\t\t\t_validateUri(this, _strict);\n\t\t}\n\t}\n\n\t// ---- filesystem path -----------------------\n\n\t/**\n\t * Returns a string representing the corresponding file system path of this URI.\n\t * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the\n\t * platform specific path separator.\n\t *\n\t * * Will *not* validate the path for invalid characters and semantics.\n\t * * Will *not* look at the scheme of this URI.\n\t * * The result shall *not* be used for display purposes but for accessing a file on disk.\n\t *\n\t *\n\t * The *difference* to `URI#path` is the use of the platform specific separator and the handling\n\t * of UNC paths. See the below sample of a file-uri with an authority (UNC path).\n\t *\n\t * ```ts\n\t\tconst u = URI.parse('file://server/c$/folder/file.txt')\n\t\tu.authority === 'server'\n\t\tu.path === '/shares/c$/file.txt'\n\t\tu.fsPath === '\\\\server\\c$\\folder\\file.txt'\n\t```\n\t *\n\t * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,\n\t * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working\n\t * with URIs that represent files on disk (`file` scheme).\n\t */\n\tget fsPath(): string {\n\t\t// if (this.scheme !== 'file') {\n\t\t// \tconsole.warn(`[UriError] calling fsPath with scheme ${this.scheme}`);\n\t\t// }\n\t\treturn uriToFsPath(this, false);\n\t}\n\n\t// ---- modify to new -------------------------\n\n\twith(change: { scheme?: string; authority?: string | null; path?: string | null; query?: string | null; fragment?: string | null }): URI {\n\n\t\tif (!change) {\n\t\t\treturn this;\n\t\t}\n\n\t\tlet { scheme, authority, path, query, fragment } = change;\n\t\tif (scheme === undefined) {\n\t\t\tscheme = this.scheme;\n\t\t} else if (scheme === null) {\n\t\t\tscheme = _empty;\n\t\t}\n\t\tif (authority === undefined) {\n\t\t\tauthority = this.authority;\n\t\t} else if (authority === null) {\n\t\t\tauthority = _empty;\n\t\t}\n\t\tif (path === undefined) {\n\t\t\tpath = this.path;\n\t\t} else if (path === null) {\n\t\t\tpath = _empty;\n\t\t}\n\t\tif (query === undefined) {\n\t\t\tquery = this.query;\n\t\t} else if (query === null) {\n\t\t\tquery = _empty;\n\t\t}\n\t\tif (fragment === undefined) {\n\t\t\tfragment = this.fragment;\n\t\t} else if (fragment === null) {\n\t\t\tfragment = _empty;\n\t\t}\n\n\t\tif (scheme === this.scheme\n\t\t\t&& authority === this.authority\n\t\t\t&& path === this.path\n\t\t\t&& query === this.query\n\t\t\t&& fragment === this.fragment) {\n\n\t\t\treturn this;\n\t\t}\n\n\t\treturn new Uri(scheme, authority, path, query, fragment);\n\t}\n\n\t// ---- parse & validate ------------------------\n\n\t/**\n\t * Creates a new URI from a string, e.g. `http://www.msft.com/some/path`,\n\t * `file:///usr/home`, or `scheme:with/path`.\n\t *\n\t * @param value A string which represents an URI (see `URI#toString`).\n\t */\n\tstatic parse(value: string, _strict: boolean = false): URI {\n\t\tconst match = _regexp.exec(value);\n\t\tif (!match) {\n\t\t\treturn new Uri(_empty, _empty, _empty, _empty, _empty);\n\t\t}\n\t\treturn new Uri(\n\t\t\tmatch[2] || _empty,\n\t\t\tpercentDecode(match[4] || _empty),\n\t\t\tpercentDecode(match[5] || _empty),\n\t\t\tpercentDecode(match[7] || _empty),\n\t\t\tpercentDecode(match[9] || _empty),\n\t\t\t_strict\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new URI from a file system path, e.g. `c:\\my\\files`,\n\t * `/usr/home`, or `\\\\server\\share\\some\\path`.\n\t *\n\t * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument\n\t * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**\n\t * `URI.parse('file://' + path)` because the path might contain characters that are\n\t * interpreted (# and ?). See the following sample:\n\t * ```ts\n\tconst good = URI.file('/coding/c#/project1');\n\tgood.scheme === 'file';\n\tgood.path === '/coding/c#/project1';\n\tgood.fragment === '';\n\tconst bad = URI.parse('file://' + '/coding/c#/project1');\n\tbad.scheme === 'file';\n\tbad.path === '/coding/c'; // path is now broken\n\tbad.fragment === '/project1';\n\t```\n\t *\n\t * @param path A file system path (see `URI#fsPath`)\n\t */\n\tstatic file(path: string): URI {\n\n\t\tlet authority = _empty;\n\n\t\t// normalize to fwd-slashes on windows,\n\t\t// on other systems bwd-slashes are valid\n\t\t// filename character, eg /f\\oo/ba\\r.txt\n\t\tif (isWindows) {\n\t\t\tpath = path.replace(/\\\\/g, _slash);\n\t\t}\n\n\t\t// check for authority as used in UNC shares\n\t\t// or use the path as given\n\t\tif (path[0] === _slash && path[1] === _slash) {\n\t\t\tconst idx = path.indexOf(_slash, 2);\n\t\t\tif (idx === -1) {\n\t\t\t\tauthority = path.substring(2);\n\t\t\t\tpath = _slash;\n\t\t\t} else {\n\t\t\t\tauthority = path.substring(2, idx);\n\t\t\t\tpath = path.substring(idx) || _slash;\n\t\t\t}\n\t\t}\n\n\t\treturn new Uri('file', authority, path, _empty, _empty);\n\t}\n\n\tstatic from(components: { scheme: string; authority?: string; path?: string; query?: string; fragment?: string }): URI {\n\t\treturn new Uri(\n\t\t\tcomponents.scheme,\n\t\t\tcomponents.authority,\n\t\t\tcomponents.path,\n\t\t\tcomponents.query,\n\t\t\tcomponents.fragment,\n\t\t);\n\t}\n\n\t// ---- printing/externalize ---------------------------\n\n\t/**\n\t * Creates a string representation for this URI. It's guaranteed that calling\n\t * `URI.parse` with the result of this function creates an URI which is equal\n\t * to this URI.\n\t *\n\t * * The result shall *not* be used for display purposes but for externalization or transport.\n\t * * The result will be encoded using the percentage encoding and encoding happens mostly\n\t * ignore the scheme-specific encoding rules.\n\t *\n\t * @param skipEncoding Do not encode the result, default is `false`\n\t */\n\ttoString(skipEncoding: boolean = false): string {\n\t\treturn _asFormatted(this, skipEncoding);\n\t}\n\n\ttoJSON(): UriComponents {\n\t\treturn this;\n\t}\n\n\tstatic revive(data: UriComponents | URI): URI;\n\tstatic revive(data: UriComponents | URI | undefined): URI | undefined;\n\tstatic revive(data: UriComponents | URI | null): URI | null;\n\tstatic revive(data: UriComponents | URI | undefined | null): URI | undefined | null;\n\tstatic revive(data: UriComponents | URI | undefined | null): URI | undefined | null {\n\t\tif (!data) {\n\t\t\treturn data;\n\t\t} else if (data instanceof URI) {\n\t\t\treturn data;\n\t\t} else {\n\t\t\tconst result = new Uri(data);\n\t\t\tresult._formatted = (data).external;\n\t\t\tresult._fsPath = (data)._sep === _pathSepMarker ? (data).fsPath : null;\n\t\t\treturn result;\n\t\t}\n\t}\n}\n\nexport interface UriComponents {\n\tscheme: string;\n\tauthority: string;\n\tpath: string;\n\tquery: string;\n\tfragment: string;\n}\n\ninterface UriState extends UriComponents {\n\t$mid: number;\n\texternal: string;\n\tfsPath: string;\n\t_sep: 1 | undefined;\n}\n\nconst _pathSepMarker = isWindows ? 1 : undefined;\n\n// This class exists so that URI is compatibile with vscode.Uri (API).\nclass Uri extends URI {\n\n\t_formatted: string | null = null;\n\t_fsPath: string | null = null;\n\n\tget fsPath(): string {\n\t\tif (!this._fsPath) {\n\t\t\tthis._fsPath = uriToFsPath(this, false);\n\t\t}\n\t\treturn this._fsPath;\n\t}\n\n\ttoString(skipEncoding: boolean = false): string {\n\t\tif (!skipEncoding) {\n\t\t\tif (!this._formatted) {\n\t\t\t\tthis._formatted = _asFormatted(this, false);\n\t\t\t}\n\t\t\treturn this._formatted;\n\t\t} else {\n\t\t\t// we don't cache that\n\t\t\treturn _asFormatted(this, true);\n\t\t}\n\t}\n\n\ttoJSON(): UriComponents {\n\t\tconst res = {\n\t\t\t$mid: 1\n\t\t};\n\t\t// cached state\n\t\tif (this._fsPath) {\n\t\t\tres.fsPath = this._fsPath;\n\t\t\tres._sep = _pathSepMarker;\n\t\t}\n\t\tif (this._formatted) {\n\t\t\tres.external = this._formatted;\n\t\t}\n\t\t// uri components\n\t\tif (this.path) {\n\t\t\tres.path = this.path;\n\t\t}\n\t\tif (this.scheme) {\n\t\t\tres.scheme = this.scheme;\n\t\t}\n\t\tif (this.authority) {\n\t\t\tres.authority = this.authority;\n\t\t}\n\t\tif (this.query) {\n\t\t\tres.query = this.query;\n\t\t}\n\t\tif (this.fragment) {\n\t\t\tres.fragment = this.fragment;\n\t\t}\n\t\treturn res;\n\t}\n}\n\n// reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2\nconst encodeTable: { [ch: number]: string } = {\n\t[CharCode.Colon]: '%3A', // gen-delims\n\t[CharCode.Slash]: '%2F',\n\t[CharCode.QuestionMark]: '%3F',\n\t[CharCode.Hash]: '%23',\n\t[CharCode.OpenSquareBracket]: '%5B',\n\t[CharCode.CloseSquareBracket]: '%5D',\n\t[CharCode.AtSign]: '%40',\n\n\t[CharCode.ExclamationMark]: '%21', // sub-delims\n\t[CharCode.DollarSign]: '%24',\n\t[CharCode.Ampersand]: '%26',\n\t[CharCode.SingleQuote]: '%27',\n\t[CharCode.OpenParen]: '%28',\n\t[CharCode.CloseParen]: '%29',\n\t[CharCode.Asterisk]: '%2A',\n\t[CharCode.Plus]: '%2B',\n\t[CharCode.Comma]: '%2C',\n\t[CharCode.Semicolon]: '%3B',\n\t[CharCode.Equals]: '%3D',\n\n\t[CharCode.Space]: '%20',\n};\n\nfunction encodeURIComponentFast(uriComponent: string, allowSlash: boolean): string {\n\tlet res: string | undefined = undefined;\n\tlet nativeEncodePos = -1;\n\n\tfor (let pos = 0; pos < uriComponent.length; pos++) {\n\t\tconst code = uriComponent.charCodeAt(pos);\n\n\t\t// unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3\n\t\tif (\n\t\t\t(code >= CharCode.a && code <= CharCode.z)\n\t\t\t|| (code >= CharCode.A && code <= CharCode.Z)\n\t\t\t|| (code >= CharCode.Digit0 && code <= CharCode.Digit9)\n\t\t\t|| code === CharCode.Dash\n\t\t\t|| code === CharCode.Period\n\t\t\t|| code === CharCode.Underline\n\t\t\t|| code === CharCode.Tilde\n\t\t\t|| (allowSlash && code === CharCode.Slash)\n\t\t) {\n\t\t\t// check if we are delaying native encode\n\t\t\tif (nativeEncodePos !== -1) {\n\t\t\t\tres += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\n\t\t\t\tnativeEncodePos = -1;\n\t\t\t}\n\t\t\t// check if we write into a new string (by default we try to return the param)\n\t\t\tif (res !== undefined) {\n\t\t\t\tres += uriComponent.charAt(pos);\n\t\t\t}\n\n\t\t} else {\n\t\t\t// encoding needed, we need to allocate a new string\n\t\t\tif (res === undefined) {\n\t\t\t\tres = uriComponent.substr(0, pos);\n\t\t\t}\n\n\t\t\t// check with default table first\n\t\t\tconst escaped = encodeTable[code];\n\t\t\tif (escaped !== undefined) {\n\n\t\t\t\t// check if we are delaying native encode\n\t\t\t\tif (nativeEncodePos !== -1) {\n\t\t\t\t\tres += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\n\t\t\t\t\tnativeEncodePos = -1;\n\t\t\t\t}\n\n\t\t\t\t// append escaped variant to result\n\t\t\t\tres += escaped;\n\n\t\t\t} else if (nativeEncodePos === -1) {\n\t\t\t\t// use native encode only when needed\n\t\t\t\tnativeEncodePos = pos;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (nativeEncodePos !== -1) {\n\t\tres += encodeURIComponent(uriComponent.substring(nativeEncodePos));\n\t}\n\n\treturn res !== undefined ? res : uriComponent;\n}\n\nfunction encodeURIComponentMinimal(path: string): string {\n\tlet res: string | undefined = undefined;\n\tfor (let pos = 0; pos < path.length; pos++) {\n\t\tconst code = path.charCodeAt(pos);\n\t\tif (code === CharCode.Hash || code === CharCode.QuestionMark) {\n\t\t\tif (res === undefined) {\n\t\t\t\tres = path.substr(0, pos);\n\t\t\t}\n\t\t\tres += encodeTable[code];\n\t\t} else {\n\t\t\tif (res !== undefined) {\n\t\t\t\tres += path[pos];\n\t\t\t}\n\t\t}\n\t}\n\treturn res !== undefined ? res : path;\n}\n\n/**\n * Compute `fsPath` for the given uri\n */\nexport function uriToFsPath(uri: URI, keepDriveLetterCasing: boolean): string {\n\n\tlet value: string;\n\tif (uri.authority && uri.path.length > 1 && uri.scheme === 'file') {\n\t\t// unc path: file://shares/c$/far/boo\n\t\tvalue = `//${uri.authority}${uri.path}`;\n\t} else if (\n\t\turi.path.charCodeAt(0) === CharCode.Slash\n\t\t&& (uri.path.charCodeAt(1) >= CharCode.A && uri.path.charCodeAt(1) <= CharCode.Z || uri.path.charCodeAt(1) >= CharCode.a && uri.path.charCodeAt(1) <= CharCode.z)\n\t\t&& uri.path.charCodeAt(2) === CharCode.Colon\n\t) {\n\t\tif (!keepDriveLetterCasing) {\n\t\t\t// windows drive letter: file:///c:/far/boo\n\t\t\tvalue = uri.path[1].toLowerCase() + uri.path.substr(2);\n\t\t} else {\n\t\t\tvalue = uri.path.substr(1);\n\t\t}\n\t} else {\n\t\t// other path\n\t\tvalue = uri.path;\n\t}\n\tif (isWindows) {\n\t\tvalue = value.replace(/\\//g, '\\\\');\n\t}\n\treturn value;\n}\n\n/**\n * Create the external version of a uri\n */\nfunction _asFormatted(uri: URI, skipEncoding: boolean): string {\n\n\tconst encoder = !skipEncoding\n\t\t? encodeURIComponentFast\n\t\t: encodeURIComponentMinimal;\n\n\tlet res = '';\n\tlet { scheme, authority, path, query, fragment } = uri;\n\tif (scheme) {\n\t\tres += scheme;\n\t\tres += ':';\n\t}\n\tif (authority || scheme === 'file') {\n\t\tres += _slash;\n\t\tres += _slash;\n\t}\n\tif (authority) {\n\t\tlet idx = authority.indexOf('@');\n\t\tif (idx !== -1) {\n\t\t\t// @\n\t\t\tconst userinfo = authority.substr(0, idx);\n\t\t\tauthority = authority.substr(idx + 1);\n\t\t\tidx = userinfo.indexOf(':');\n\t\t\tif (idx === -1) {\n\t\t\t\tres += encoder(userinfo, false);\n\t\t\t} else {\n\t\t\t\t// :@\n\t\t\t\tres += encoder(userinfo.substr(0, idx), false);\n\t\t\t\tres += ':';\n\t\t\t\tres += encoder(userinfo.substr(idx + 1), false);\n\t\t\t}\n\t\t\tres += '@';\n\t\t}\n\t\tauthority = authority.toLowerCase();\n\t\tidx = authority.indexOf(':');\n\t\tif (idx === -1) {\n\t\t\tres += encoder(authority, false);\n\t\t} else {\n\t\t\t// :\n\t\t\tres += encoder(authority.substr(0, idx), false);\n\t\t\tres += authority.substr(idx);\n\t\t}\n\t}\n\tif (path) {\n\t\t// lower-case windows drive letters in /C:/fff or C:/fff\n\t\tif (path.length >= 3 && path.charCodeAt(0) === CharCode.Slash && path.charCodeAt(2) === CharCode.Colon) {\n\t\t\tconst code = path.charCodeAt(1);\n\t\t\tif (code >= CharCode.A && code <= CharCode.Z) {\n\t\t\t\tpath = `/${String.fromCharCode(code + 32)}:${path.substr(3)}`; // \"/c:\".length === 3\n\t\t\t}\n\t\t} else if (path.length >= 2 && path.charCodeAt(1) === CharCode.Colon) {\n\t\t\tconst code = path.charCodeAt(0);\n\t\t\tif (code >= CharCode.A && code <= CharCode.Z) {\n\t\t\t\tpath = `${String.fromCharCode(code + 32)}:${path.substr(2)}`; // \"/c:\".length === 3\n\t\t\t}\n\t\t}\n\t\t// encode the rest of the path\n\t\tres += encoder(path, true);\n\t}\n\tif (query) {\n\t\tres += '?';\n\t\tres += encoder(query, false);\n\t}\n\tif (fragment) {\n\t\tres += '#';\n\t\tres += !skipEncoding ? encodeURIComponentFast(fragment, false) : fragment;\n\t}\n\treturn res;\n}\n\n// --- decode\n\nfunction decodeURIComponentGraceful(str: string): string {\n\ttry {\n\t\treturn decodeURIComponent(str);\n\t} catch {\n\t\tif (str.length > 3) {\n\t\t\treturn str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3));\n\t\t} else {\n\t\t\treturn str;\n\t\t}\n\t}\n}\n\nconst _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g;\n\nfunction percentDecode(str: string): string {\n\tif (!str.match(_rEncodedAsHex)) {\n\t\treturn str;\n\t}\n\treturn str.replace(_rEncodedAsHex, (match) => decodeURIComponentGraceful(match));\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n'use strict';\n\nimport { CharCode } from './charCode';\nimport { URI } from './uri';\nimport * as nodePath from 'path';\n\nconst posixPath = nodePath.posix || nodePath;\n\nexport namespace Utils {\n\n /**\n * Joins one or more input paths to the path of URI. \n * '/' is used as the directory separation character. \n * \n * The resolved path will be normalized. That means:\n * - all '..' and '.' segments are resolved.\n * - multiple, sequential occurences of '/' are replaced by a single instance of '/'.\n * - trailing separators are preserved.\n * \n * @param uri The input URI.\n * @param paths The paths to be joined with the path of URI.\n * @returns A URI with the joined path. All other properties of the URI (scheme, authority, query, fragments, ...) will be taken from the input URI.\n */\n export function joinPath(uri: URI, ...paths: string[]): URI {\n return uri.with({ path: posixPath.join(uri.path, ...paths) });\n }\n\n\n /**\n * Resolves one or more paths against the path of a URI. \n * '/' is used as the directory separation character. \n * \n * The resolved path will be normalized. That means:\n * - all '..' and '.' segments are resolved. \n * - multiple, sequential occurences of '/' are replaced by a single instance of '/'.\n * - trailing separators are removed.\n * \n * @param uri The input URI.\n * @param paths The paths to resolve against the path of URI.\n * @returns A URI with the resolved path. All other properties of the URI (scheme, authority, query, fragments, ...) will be taken from the input URI.\n */\n export function resolvePath(uri: URI, ...paths: string[]): URI {\n const path = uri.path || '/'; // normalize the path which is necessary as for posixPath.resolve the first segments has to be absolute or cwd is used.\n return uri.with({ path: posixPath.resolve(path, ...paths) });\n }\n\n /**\n * Returns a URI where the path is the directory name of the input uri, similar to the Unix dirname command. \n * In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.\n * The orignal URI is returned if the URIs path is empty or does not contain any path segments.\n * \n * @param uri The input URI.\n * @return The last segment of the URIs path.\n */\n export function dirname(uri: URI): URI {\n let path = posixPath.dirname(uri.path);\n if (path.length === 1 && path.charCodeAt(0) === CharCode.Period) {\n return uri;\n }\n return uri.with({ path });\n }\n\n /**\n * Returns the last segment of the path of a URI, similar to the Unix basename command. \n * In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.\n * The empty string is returned if the URIs path is empty or does not contain any path segments.\n * \n * @param uri The input URI.\n * @return The base name of the URIs path.\n */\n export function basename(uri: URI): string {\n return posixPath.basename(uri.path);\n }\n\n /**\n * Returns the extension name of the path of a URI, similar to the Unix extname command. \n * In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.\n * The empty string is returned if the URIs path is empty or does not contain any path segments.\n * \n * @param uri The input URI.\n * @return The extension name of the URIs path.\n */\n export function extname(uri: URI): string {\n return posixPath.extname(uri.path);\n }\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(465);\n"],"sourceRoot":""} \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/platform.d.ts b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/platform.d.ts new file mode 100644 index 0000000..1660688 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/platform.d.ts @@ -0,0 +1 @@ +export declare let isWindows: boolean; diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/uri.d.ts b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/uri.d.ts new file mode 100644 index 0000000..e686ed2 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/uri.d.ts @@ -0,0 +1,145 @@ +/** + * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986. + * This class is a simple parser which creates the basic component parts + * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation + * and encoding. + * + * ```txt + * foo://example.com:8042/over/there?name=ferret#nose + * \_/ \______________/\_________/ \_________/ \__/ + * | | | | | + * scheme authority path query fragment + * | _____________________|__ + * / \ / \ + * urn:example:animal:ferret:nose + * ``` + */ +export declare class URI implements UriComponents { + static isUri(thing: any): thing is URI; + /** + * scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'. + * The part before the first colon. + */ + readonly scheme: string; + /** + * authority is the 'www.msft.com' part of 'http://www.msft.com/some/path?query#fragment'. + * The part between the first double slashes and the next slash. + */ + readonly authority: string; + /** + * path is the '/some/path' part of 'http://www.msft.com/some/path?query#fragment'. + */ + readonly path: string; + /** + * query is the 'query' part of 'http://www.msft.com/some/path?query#fragment'. + */ + readonly query: string; + /** + * fragment is the 'fragment' part of 'http://www.msft.com/some/path?query#fragment'. + */ + readonly fragment: string; + /** + * @internal + */ + protected constructor(scheme: string, authority?: string, path?: string, query?: string, fragment?: string, _strict?: boolean); + /** + * @internal + */ + protected constructor(components: UriComponents); + /** + * Returns a string representing the corresponding file system path of this URI. + * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the + * platform specific path separator. + * + * * Will *not* validate the path for invalid characters and semantics. + * * Will *not* look at the scheme of this URI. + * * The result shall *not* be used for display purposes but for accessing a file on disk. + * + * + * The *difference* to `URI#path` is the use of the platform specific separator and the handling + * of UNC paths. See the below sample of a file-uri with an authority (UNC path). + * + * ```ts + const u = URI.parse('file://server/c$/folder/file.txt') + u.authority === 'server' + u.path === '/shares/c$/file.txt' + u.fsPath === '\\server\c$\folder\file.txt' + ``` + * + * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path, + * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working + * with URIs that represent files on disk (`file` scheme). + */ + get fsPath(): string; + with(change: { + scheme?: string; + authority?: string | null; + path?: string | null; + query?: string | null; + fragment?: string | null; + }): URI; + /** + * Creates a new URI from a string, e.g. `http://www.msft.com/some/path`, + * `file:///usr/home`, or `scheme:with/path`. + * + * @param value A string which represents an URI (see `URI#toString`). + */ + static parse(value: string, _strict?: boolean): URI; + /** + * Creates a new URI from a file system path, e.g. `c:\my\files`, + * `/usr/home`, or `\\server\share\some\path`. + * + * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument + * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as** + * `URI.parse('file://' + path)` because the path might contain characters that are + * interpreted (# and ?). See the following sample: + * ```ts + const good = URI.file('/coding/c#/project1'); + good.scheme === 'file'; + good.path === '/coding/c#/project1'; + good.fragment === ''; + const bad = URI.parse('file://' + '/coding/c#/project1'); + bad.scheme === 'file'; + bad.path === '/coding/c'; // path is now broken + bad.fragment === '/project1'; + ``` + * + * @param path A file system path (see `URI#fsPath`) + */ + static file(path: string): URI; + static from(components: { + scheme: string; + authority?: string; + path?: string; + query?: string; + fragment?: string; + }): URI; + /** + * Creates a string representation for this URI. It's guaranteed that calling + * `URI.parse` with the result of this function creates an URI which is equal + * to this URI. + * + * * The result shall *not* be used for display purposes but for externalization or transport. + * * The result will be encoded using the percentage encoding and encoding happens mostly + * ignore the scheme-specific encoding rules. + * + * @param skipEncoding Do not encode the result, default is `false` + */ + toString(skipEncoding?: boolean): string; + toJSON(): UriComponents; + static revive(data: UriComponents | URI): URI; + static revive(data: UriComponents | URI | undefined): URI | undefined; + static revive(data: UriComponents | URI | null): URI | null; + static revive(data: UriComponents | URI | undefined | null): URI | undefined | null; +} +export interface UriComponents { + scheme: string; + authority: string; + path: string; + query: string; + fragment: string; +} +/** + * Compute `fsPath` for the given uri + */ +export declare function uriToFsPath(uri: URI, keepDriveLetterCasing: boolean): string; diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/utils.d.ts b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/utils.d.ts new file mode 100644 index 0000000..26ed5e6 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/lib/umd/utils.d.ts @@ -0,0 +1,58 @@ +import { URI } from './uri'; +export declare namespace Utils { + /** + * Joins one or more input paths to the path of URI. + * '/' is used as the directory separation character. + * + * The resolved path will be normalized. That means: + * - all '..' and '.' segments are resolved. + * - multiple, sequential occurences of '/' are replaced by a single instance of '/'. + * - trailing separators are preserved. + * + * @param uri The input URI. + * @param paths The paths to be joined with the path of URI. + * @returns A URI with the joined path. All other properties of the URI (scheme, authority, query, fragments, ...) will be taken from the input URI. + */ + function joinPath(uri: URI, ...paths: string[]): URI; + /** + * Resolves one or more paths against the path of a URI. + * '/' is used as the directory separation character. + * + * The resolved path will be normalized. That means: + * - all '..' and '.' segments are resolved. + * - multiple, sequential occurences of '/' are replaced by a single instance of '/'. + * - trailing separators are removed. + * + * @param uri The input URI. + * @param paths The paths to resolve against the path of URI. + * @returns A URI with the resolved path. All other properties of the URI (scheme, authority, query, fragments, ...) will be taken from the input URI. + */ + function resolvePath(uri: URI, ...paths: string[]): URI; + /** + * Returns a URI where the path is the directory name of the input uri, similar to the Unix dirname command. + * In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored. + * The orignal URI is returned if the URIs path is empty or does not contain any path segments. + * + * @param uri The input URI. + * @return The last segment of the URIs path. + */ + function dirname(uri: URI): URI; + /** + * Returns the last segment of the path of a URI, similar to the Unix basename command. + * In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored. + * The empty string is returned if the URIs path is empty or does not contain any path segments. + * + * @param uri The input URI. + * @return The base name of the URIs path. + */ + function basename(uri: URI): string; + /** + * Returns the extension name of the path of a URI, similar to the Unix extname command. + * In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored. + * The empty string is returned if the URIs path is empty or does not contain any path segments. + * + * @param uri The input URI. + * @return The extension name of the URIs path. + */ + function extname(uri: URI): string; +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/package.json b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/package.json new file mode 100644 index 0000000..c9a4f51 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/vscode-uri/package.json @@ -0,0 +1,37 @@ +{ + "name": "vscode-uri", + "author": "Microsoft", + "version": "3.0.2", + "description": "The URI implementation that is used by VS Code and its extensions", + "main": "./lib/umd/index.js", + "typings": "./lib/umd/index", + "module": "./lib/esm/index.js", + "sideEffects": false, + "scripts": { + "clean": "rimraf lib", + "pack-production": "webpack --mode=production", + "pack-dev": "webpack", + "prepublish": "npm run test && npm run clean && npm run pack-production", + "test": "tsc -p ./src && npm run pack-dev && mocha" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/microsoft/vscode-uri.git" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/microsoft/vscode-uri/issues" + }, + "homepage": "https://github.com/microsoft/vscode-uri#readme", + "devDependencies": { + "@types/mocha": "^8.0.3", + "@types/node": "^10.12.21", + "mocha": "8.1.3", + "path-browserify": "^1.0.1", + "rimraf": "^3.0.2", + "ts-loader": "^8.0.13", + "typescript": "^4.0.3", + "webpack": "^5.11.1", + "webpack-cli": "^4.3.1" + } +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/which/CHANGELOG.md b/coc/extensions/node_modules/coc-go/node_modules/which/CHANGELOG.md new file mode 100644 index 0000000..7fb1f20 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/which/CHANGELOG.md @@ -0,0 +1,166 @@ +# Changes + + +## 2.0.2 + +* Rename bin to `node-which` + +## 2.0.1 + +* generate changelog and publish on version bump +* enforce 100% test coverage +* Promise interface + +## 2.0.0 + +* Parallel tests, modern JavaScript, and drop support for node < 8 + +## 1.3.1 + +* update deps +* update travis + +## v1.3.0 + +* Add nothrow option to which.sync +* update tap + +## v1.2.14 + +* appveyor: drop node 5 and 0.x +* travis-ci: add node 6, drop 0.x + +## v1.2.13 + +* test: Pass missing option to pass on windows +* update tap +* update isexe to 2.0.0 +* neveragain.tech pledge request + +## v1.2.12 + +* Removed unused require + +## v1.2.11 + +* Prevent changelog script from being included in package + +## v1.2.10 + +* Use env.PATH only, not env.Path + +## v1.2.9 + +* fix for paths starting with ../ +* Remove unused `is-absolute` module + +## v1.2.8 + +* bullet items in changelog that contain (but don't start with) # + +## v1.2.7 + +* strip 'update changelog' changelog entries out of changelog + +## v1.2.6 + +* make the changelog bulleted + +## v1.2.5 + +* make a changelog, and keep it up to date +* don't include tests in package +* Properly handle relative-path executables +* appveyor +* Attach error code to Not Found error +* Make tests pass on Windows + +## v1.2.4 + +* Fix typo + +## v1.2.3 + +* update isexe, fix regression in pathExt handling + +## v1.2.2 + +* update deps, use isexe module, test windows + +## v1.2.1 + +* Sometimes windows PATH entries are quoted +* Fixed a bug in the check for group and user mode bits. This bug was introduced during refactoring for supporting strict mode. +* doc cli + +## v1.2.0 + +* Add support for opt.all and -as cli flags +* test the bin +* update travis +* Allow checking for multiple programs in bin/which +* tap 2 + +## v1.1.2 + +* travis +* Refactored and fixed undefined error on Windows +* Support strict mode + +## v1.1.1 + +* test +g exes against secondary groups, if available +* Use windows exe semantics on cygwin & msys +* cwd should be first in path on win32, not last +* Handle lower-case 'env.Path' on Windows +* Update docs +* use single-quotes + +## v1.1.0 + +* Add tests, depend on is-absolute + +## v1.0.9 + +* which.js: root is allowed to execute files owned by anyone + +## v1.0.8 + +* don't use graceful-fs + +## v1.0.7 + +* add license to package.json + +## v1.0.6 + +* isc license + +## 1.0.5 + +* Awful typo + +## 1.0.4 + +* Test for path absoluteness properly +* win: Allow '' as a pathext if cmd has a . in it + +## 1.0.3 + +* Remove references to execPath +* Make `which.sync()` work on Windows by honoring the PATHEXT variable. +* Make `isExe()` always return true on Windows. +* MIT + +## 1.0.2 + +* Only files can be exes + +## 1.0.1 + +* Respect the PATHEXT env for win32 support +* should 0755 the bin +* binary +* guts +* package +* 1st diff --git a/coc/extensions/node_modules/coc-go/node_modules/which/LICENSE b/coc/extensions/node_modules/coc-go/node_modules/which/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/which/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/coc/extensions/node_modules/coc-go/node_modules/which/README.md b/coc/extensions/node_modules/coc-go/node_modules/which/README.md new file mode 100644 index 0000000..cd83350 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/which/README.md @@ -0,0 +1,54 @@ +# which + +Like the unix `which` utility. + +Finds the first instance of a specified executable in the PATH +environment variable. Does not cache the results, so `hash -r` is not +needed when the PATH changes. + +## USAGE + +```javascript +var which = require('which') + +// async usage +which('node', function (er, resolvedPath) { + // er is returned if no "node" is found on the PATH + // if it is found, then the absolute path to the exec is returned +}) + +// or promise +which('node').then(resolvedPath => { ... }).catch(er => { ... not found ... }) + +// sync usage +// throws if not found +var resolved = which.sync('node') + +// if nothrow option is used, returns null if not found +resolved = which.sync('node', {nothrow: true}) + +// Pass options to override the PATH and PATHEXT environment vars. +which('node', { path: someOtherPath }, function (er, resolved) { + if (er) + throw er + console.log('found at %j', resolved) +}) +``` + +## CLI USAGE + +Same as the BSD `which(1)` binary. + +``` +usage: which [-as] program ... +``` + +## OPTIONS + +You may pass an options object as the second argument. + +- `path`: Use instead of the `PATH` environment variable. +- `pathExt`: Use instead of the `PATHEXT` environment variable. +- `all`: Return all matches, instead of just the first one. Note that + this means the function returns an array of strings instead of a + single string. diff --git a/coc/extensions/node_modules/coc-go/node_modules/which/bin/node-which b/coc/extensions/node_modules/coc-go/node_modules/which/bin/node-which new file mode 100755 index 0000000..7cee372 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/which/bin/node-which @@ -0,0 +1,52 @@ +#!/usr/bin/env node +var which = require("../") +if (process.argv.length < 3) + usage() + +function usage () { + console.error('usage: which [-as] program ...') + process.exit(1) +} + +var all = false +var silent = false +var dashdash = false +var args = process.argv.slice(2).filter(function (arg) { + if (dashdash || !/^-/.test(arg)) + return true + + if (arg === '--') { + dashdash = true + return false + } + + var flags = arg.substr(1).split('') + for (var f = 0; f < flags.length; f++) { + var flag = flags[f] + switch (flag) { + case 's': + silent = true + break + case 'a': + all = true + break + default: + console.error('which: illegal option -- ' + flag) + usage() + } + } + return false +}) + +process.exit(args.reduce(function (pv, current) { + try { + var f = which.sync(current, { all: all }) + if (all) + f = f.join('\n') + if (!silent) + console.log(f) + return pv; + } catch (e) { + return 1; + } +}, 0)) diff --git a/coc/extensions/node_modules/coc-go/node_modules/which/package.json b/coc/extensions/node_modules/coc-go/node_modules/which/package.json new file mode 100644 index 0000000..97ad7fb --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/which/package.json @@ -0,0 +1,43 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me)", + "name": "which", + "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", + "version": "2.0.2", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-which.git" + }, + "main": "which.js", + "bin": { + "node-which": "./bin/node-which" + }, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "devDependencies": { + "mkdirp": "^0.5.0", + "rimraf": "^2.6.2", + "tap": "^14.6.9" + }, + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublish": "npm run changelog", + "prechangelog": "bash gen-changelog.sh", + "changelog": "git add CHANGELOG.md", + "postchangelog": "git commit -m 'update changelog - '${npm_package_version}", + "postpublish": "git push origin --follow-tags" + }, + "files": [ + "which.js", + "bin/node-which" + ], + "tap": { + "check-coverage": true + }, + "engines": { + "node": ">= 8" + } +} diff --git a/coc/extensions/node_modules/coc-go/node_modules/which/which.js b/coc/extensions/node_modules/coc-go/node_modules/which/which.js new file mode 100644 index 0000000..82afffd --- /dev/null +++ b/coc/extensions/node_modules/coc-go/node_modules/which/which.js @@ -0,0 +1,125 @@ +const isWindows = process.platform === 'win32' || + process.env.OSTYPE === 'cygwin' || + process.env.OSTYPE === 'msys' + +const path = require('path') +const COLON = isWindows ? ';' : ':' +const isexe = require('isexe') + +const getNotFoundError = (cmd) => + Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }) + +const getPathInfo = (cmd, opt) => { + const colon = opt.colon || COLON + + // If it has a slash, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [''] + : ( + [ + // windows always checks the cwd first + ...(isWindows ? [process.cwd()] : []), + ...(opt.path || process.env.PATH || + /* istanbul ignore next: very unusual */ '').split(colon), + ] + ) + const pathExtExe = isWindows + ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' + : '' + const pathExt = isWindows ? pathExtExe.split(colon) : [''] + + if (isWindows) { + if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') + pathExt.unshift('') + } + + return { + pathEnv, + pathExt, + pathExtExe, + } +} + +const which = (cmd, opt, cb) => { + if (typeof opt === 'function') { + cb = opt + opt = {} + } + if (!opt) + opt = {} + + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + const step = i => new Promise((resolve, reject) => { + if (i === pathEnv.length) + return opt.all && found.length ? resolve(found) + : reject(getNotFoundError(cmd)) + + const ppRaw = pathEnv[i] + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw + + const pCmd = path.join(pathPart, cmd) + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd + : pCmd + + resolve(subStep(p, i, 0)) + }) + + const subStep = (p, i, ii) => new Promise((resolve, reject) => { + if (ii === pathExt.length) + return resolve(step(i + 1)) + const ext = pathExt[ii] + isexe(p + ext, { pathExt: pathExtExe }, (er, is) => { + if (!er && is) { + if (opt.all) + found.push(p + ext) + else + return resolve(p + ext) + } + return resolve(subStep(p, i, ii + 1)) + }) + }) + + return cb ? step(0).then(res => cb(null, res), cb) : step(0) +} + +const whichSync = (cmd, opt) => { + opt = opt || {} + + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + for (let i = 0; i < pathEnv.length; i ++) { + const ppRaw = pathEnv[i] + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw + + const pCmd = path.join(pathPart, cmd) + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd + : pCmd + + for (let j = 0; j < pathExt.length; j ++) { + const cur = p + pathExt[j] + try { + const is = isexe.sync(cur, { pathExt: pathExtExe }) + if (is) { + if (opt.all) + found.push(cur) + else + return cur + } + } catch (ex) {} + } + } + + if (opt.all && found.length) + return found + + if (opt.nothrow) + return null + + throw getNotFoundError(cmd) +} + +module.exports = which +which.sync = whichSync diff --git a/coc/extensions/node_modules/coc-go/package-lock.json b/coc/extensions/node_modules/coc-go/package-lock.json new file mode 100644 index 0000000..8a248ed --- /dev/null +++ b/coc/extensions/node_modules/coc-go/package-lock.json @@ -0,0 +1,4365 @@ +{ + "name": "coc-go", + "version": "0.13.3", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "coc-go", + "version": "0.13.3", + "license": "MIT", + "dependencies": { + "node-fetch": "^2.6.1", + "tslib": "^2.0.0", + "vscode-languageserver-textdocument": "^1.0.1", + "vscode-uri": "^3.0.1", + "which": "^2.0.2" + }, + "devDependencies": { + "@types/mocha": "^8.0.3", + "@types/node": "^14.11.1", + "@types/node-fetch": "^2.5.7", + "@types/tmp": "^0.2.0", + "@types/which": "^2.0.0", + "@typescript-eslint/eslint-plugin": "^4.1.1", + "@typescript-eslint/parser": "^4.1.1", + "coc-dev-tools": "^0.1.0", + "coc.nvim": "0.0.80", + "eslint": "^7.9.0", + "eslint-config-josa-typescript": "^0.1.2", + "mocha": "^8.1.3", + "rimraf": "^3.0.2", + "tmp": "^0.2.1", + "ts-node": "^9.0.0", + "typescript": "~4.1.2" + }, + "engines": { + "coc": "^0.0.80", + "node": ">=10" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.10.4" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", + "dev": true + }, + "node_modules/@babel/highlight": { + "version": "7.13.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", + "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.12.11", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.0.tgz", + "integrity": "sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", + "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.4", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.4", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.7", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", + "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==", + "dev": true + }, + "node_modules/@types/mocha": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.1.tgz", + "integrity": "sha512-NysN+bNqj6E0Hv4CTGWSlPzMW6vTKjDpOteycDkV4IWBsO+PU48JonrPzV9ODjiI2XrjmA05KInLgF5ivZ/YGQ==", + "dev": true + }, + "node_modules/@types/node": { + "version": "14.14.32", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.32.tgz", + "integrity": "sha512-/Ctrftx/zp4m8JOujM5ZhwzlWLx22nbQJiVqz8/zE15gOeEW+uly3FSX4fGFpcfEvFzXcMCJwq9lGVWgyARXhg==", + "dev": true + }, + "node_modules/@types/node-fetch": { + "version": "2.5.8", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.8.tgz", + "integrity": "sha512-fbjI6ja0N5ZA8TV53RUqzsKNkl9fv8Oj3T7zxW7FGv1GSH7gwJaNF8dzCjrqKaxKeUpTz4yT1DaJFq/omNpGfw==", + "dev": true, + "dependencies": { + "@types/node": "*", + "form-data": "^3.0.0" + } + }, + "node_modules/@types/tmp": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.2.0.tgz", + "integrity": "sha512-flgpHJjntpBAdJD43ShRosQvNC0ME97DCfGvZEDlAThQmnerRXrLbX6YgzRBQCZTthET9eAWFAMaYP0m0Y4HzQ==", + "dev": true + }, + "node_modules/@types/which": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/which/-/which-2.0.0.tgz", + "integrity": "sha512-JHTNOEpZnACQdsTojWggn+SQ8IucfqEhtz7g8Z0G67WdSj4x3F0X5I2c/CVcl8z/QukGrIHeQ/N49v1au74XFQ==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.17.0.tgz", + "integrity": "sha512-/fKFDcoHg8oNan39IKFOb5WmV7oWhQe1K6CDaAVfJaNWEhmfqlA24g+u1lqU5bMH7zuNasfMId4LaYWC5ijRLw==", + "dev": true, + "dependencies": { + "@typescript-eslint/experimental-utils": "4.17.0", + "@typescript-eslint/scope-manager": "4.17.0", + "debug": "^4.1.1", + "functional-red-black-tree": "^1.0.1", + "lodash": "^4.17.15", + "regexpp": "^3.0.0", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^4.0.0", + "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/experimental-utils": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.17.0.tgz", + "integrity": "sha512-ZR2NIUbnIBj+LGqCFGQ9yk2EBQrpVVFOh9/Kd0Lm6gLpSAcCuLLe5lUCibKGCqyH9HPwYC0GIJce2O1i8VYmWA==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/scope-manager": "4.17.0", + "@typescript-eslint/types": "4.17.0", + "@typescript-eslint/typescript-estree": "4.17.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.17.0.tgz", + "integrity": "sha512-KYdksiZQ0N1t+6qpnl6JeK9ycCFprS9xBAiIrw4gSphqONt8wydBw4BXJi3C11ywZmyHulvMaLjWsxDjUSDwAw==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "4.17.0", + "@typescript-eslint/types": "4.17.0", + "@typescript-eslint/typescript-estree": "4.17.0", + "debug": "^4.1.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.17.0.tgz", + "integrity": "sha512-OJ+CeTliuW+UZ9qgULrnGpPQ1bhrZNFpfT/Bc0pzNeyZwMik7/ykJ0JHnQ7krHanFN9wcnPK89pwn84cRUmYjw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.17.0", + "@typescript-eslint/visitor-keys": "4.17.0" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.17.0.tgz", + "integrity": "sha512-RN5z8qYpJ+kXwnLlyzZkiJwfW2AY458Bf8WqllkondQIcN2ZxQowAToGSd9BlAUZDB5Ea8I6mqL2quGYCLT+2g==", + "dev": true, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.17.0.tgz", + "integrity": "sha512-lRhSFIZKUEPPWpWfwuZBH9trYIEJSI0vYsrxbvVvNyIUDoKWaklOAelsSkeh3E2VBSZiNe9BZ4E5tYBZbUczVQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.17.0", + "@typescript-eslint/visitor-keys": "4.17.0", + "debug": "^4.1.1", + "globby": "^11.0.1", + "is-glob": "^4.0.1", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.17.0.tgz", + "integrity": "sha512-WfuMN8mm5SSqXuAr9NM+fItJ0SVVphobWYkWOwQ1odsfC014Vdxk/92t4JwS1Q6fCA/ABfCKpa3AVtpUKTNKGQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.17.0", + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "node_modules/buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chokidar": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.3.1", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.1" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/coc-dev-tools": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/coc-dev-tools/-/coc-dev-tools-0.1.0.tgz", + "integrity": "sha512-uZ0LwQX+KBoyrv8/9gsfGqM5sryFm61x27Fzd5kyUDxEZStPfP81fZcys+yOwebCUjIDOIetzF4Z+NKVvFFZsw==", + "dev": true, + "dependencies": { + "eslint": "^7.10.0", + "prettier": "^2.1.2", + "yargs": "^16.0.3" + }, + "bin": { + "coc-dev": "cli/index.js" + } + }, + "node_modules/coc.nvim": { + "version": "0.0.80", + "resolved": "https://registry.npmjs.org/coc.nvim/-/coc.nvim-0.0.80.tgz", + "integrity": "sha512-/3vTcnofoAYMrdENrlQmADTzfXX4+PZ0fiM10a39UA37dTR2dpIGi9O469kcIksuunLjToqWG8S45AGx/9wV7g==", + "dev": true, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/cocnvim" + }, + "peerDependencies": { + "@types/node": "10.12.0", + "typescript": "^4" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/confusing-browser-globals": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz", + "integrity": "sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw==", + "dev": true + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "dependencies": { + "ansi-colors": "^4.1.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.21.0.tgz", + "integrity": "sha512-W2aJbXpMNofUp0ztQaF40fveSsJBjlSCSWpy//gzfTvwC+USs/nceBrKmlJOiM8r1bLwP2EuYkCqArn/6QTIgg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash": "^4.17.20", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.4", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-josa": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-josa/-/eslint-config-josa-0.1.0.tgz", + "integrity": "sha512-xsR0V2uPAUVkRRYg8TwuXt+Nw+J5zO0XL03QTkU2RYUKdENLrcdaxe1REuHAB2xOoh3aOtHuLAiqj34Cd+iTIA==", + "dev": true, + "dependencies": { + "confusing-browser-globals": "1.0.9" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "eslint": ">=6.8.0" + } + }, + "node_modules/eslint-config-josa-typescript": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/eslint-config-josa-typescript/-/eslint-config-josa-typescript-0.1.2.tgz", + "integrity": "sha512-1EBWpJXR4UAO1X0tr1baulLasjjtYCiDSeFcMJhEw69dUXtzfEx6383hkvegbP9zb37+zNXAZfoNa6NGCjcqNQ==", + "dev": true, + "dependencies": { + "eslint-config-josa": "^0.1.0" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": ">=2.19.0", + "eslint": ">=6.6.0", + "typescript": ">=3.5.3" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", + "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "dependencies": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "node_modules/fastq": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", + "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", + "dev": true + }, + "node_modules/form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "dependencies": { + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", + "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby/node_modules/ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true, + "engines": { + "node": ">=4.x" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/log-symbols": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "dependencies": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mime-db": { + "version": "1.46.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", + "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.29", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", + "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", + "dev": true, + "dependencies": { + "mime-db": "1.46.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.3.1.tgz", + "integrity": "sha512-5SBMxANWqOv5bw3Hx+HVgaWlcWcFEQDUdaUAr1AUU+qwtx6cowhn7gEDT/DwQP7uYxnvShdUOVLbTYAHOEGfDQ==", + "dev": true, + "dependencies": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.1", + "debug": "4.3.1", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.6", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.0.0", + "log-symbols": "4.0.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.20", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.1.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 10.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "node_modules/mocha/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/mocha/node_modules/js-yaml": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/nanoid": { + "version": "3.1.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", + "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.2.tgz", + "integrity": "sha512-dB15eXv3p2jDlbOiNLyMabYg1/sXvppd8DP2J3EOCQ0AkuSXCW2tP7mnVouVLJKgUMY6yP0kcQDVpLCN13h4Xg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/readdirp": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/regexpp": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/table": { + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", + "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", + "dev": true, + "dependencies": { + "ajv": "^7.0.2", + "lodash": "^4.17.20", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/table/node_modules/ajv": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.2.1.tgz", + "integrity": "sha512-+nu0HDv7kNSOua9apAVc979qd932rrZeb3WOvoiD31A/p1mIE5/9bN2027pE2rOPYEdS3UHzsvof4hY+lM9/WQ==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/table/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "node_modules/tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dev": true, + "dependencies": { + "rimraf": "^3.0.0" + }, + "engines": { + "node": ">=8.17.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ts-node": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", + "integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==", + "dev": true, + "dependencies": { + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "typescript": ">=2.7" + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==" + }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/tsutils/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/typescript": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz", + "integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz", + "integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA==" + }, + "node_modules/vscode-uri": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.2.tgz", + "integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==" + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "dependencies": { + "string-width": "^1.0.2 || 2" + } + }, + "node_modules/wide-align/node_modules/ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/wide-align/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/wide-align/node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/wide-align/node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/workerpool": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz", + "integrity": "sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/y18n": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", + "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", + "dev": true + }, + "@babel/highlight": { + "version": "7.13.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", + "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.12.11", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@eslint/eslintrc": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.0.tgz", + "integrity": "sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", + "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.4", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.4", + "fastq": "^1.6.0" + } + }, + "@types/json-schema": { + "version": "7.0.7", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", + "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==", + "dev": true + }, + "@types/mocha": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.1.tgz", + "integrity": "sha512-NysN+bNqj6E0Hv4CTGWSlPzMW6vTKjDpOteycDkV4IWBsO+PU48JonrPzV9ODjiI2XrjmA05KInLgF5ivZ/YGQ==", + "dev": true + }, + "@types/node": { + "version": "14.14.32", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.32.tgz", + "integrity": "sha512-/Ctrftx/zp4m8JOujM5ZhwzlWLx22nbQJiVqz8/zE15gOeEW+uly3FSX4fGFpcfEvFzXcMCJwq9lGVWgyARXhg==", + "dev": true + }, + "@types/node-fetch": { + "version": "2.5.8", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.8.tgz", + "integrity": "sha512-fbjI6ja0N5ZA8TV53RUqzsKNkl9fv8Oj3T7zxW7FGv1GSH7gwJaNF8dzCjrqKaxKeUpTz4yT1DaJFq/omNpGfw==", + "dev": true, + "requires": { + "@types/node": "*", + "form-data": "^3.0.0" + } + }, + "@types/tmp": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.2.0.tgz", + "integrity": "sha512-flgpHJjntpBAdJD43ShRosQvNC0ME97DCfGvZEDlAThQmnerRXrLbX6YgzRBQCZTthET9eAWFAMaYP0m0Y4HzQ==", + "dev": true + }, + "@types/which": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/which/-/which-2.0.0.tgz", + "integrity": "sha512-JHTNOEpZnACQdsTojWggn+SQ8IucfqEhtz7g8Z0G67WdSj4x3F0X5I2c/CVcl8z/QukGrIHeQ/N49v1au74XFQ==", + "dev": true + }, + "@typescript-eslint/eslint-plugin": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.17.0.tgz", + "integrity": "sha512-/fKFDcoHg8oNan39IKFOb5WmV7oWhQe1K6CDaAVfJaNWEhmfqlA24g+u1lqU5bMH7zuNasfMId4LaYWC5ijRLw==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "4.17.0", + "@typescript-eslint/scope-manager": "4.17.0", + "debug": "^4.1.1", + "functional-red-black-tree": "^1.0.1", + "lodash": "^4.17.15", + "regexpp": "^3.0.0", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/experimental-utils": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.17.0.tgz", + "integrity": "sha512-ZR2NIUbnIBj+LGqCFGQ9yk2EBQrpVVFOh9/Kd0Lm6gLpSAcCuLLe5lUCibKGCqyH9HPwYC0GIJce2O1i8VYmWA==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/scope-manager": "4.17.0", + "@typescript-eslint/types": "4.17.0", + "@typescript-eslint/typescript-estree": "4.17.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.17.0.tgz", + "integrity": "sha512-KYdksiZQ0N1t+6qpnl6JeK9ycCFprS9xBAiIrw4gSphqONt8wydBw4BXJi3C11ywZmyHulvMaLjWsxDjUSDwAw==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "4.17.0", + "@typescript-eslint/types": "4.17.0", + "@typescript-eslint/typescript-estree": "4.17.0", + "debug": "^4.1.1" + } + }, + "@typescript-eslint/scope-manager": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.17.0.tgz", + "integrity": "sha512-OJ+CeTliuW+UZ9qgULrnGpPQ1bhrZNFpfT/Bc0pzNeyZwMik7/ykJ0JHnQ7krHanFN9wcnPK89pwn84cRUmYjw==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.17.0", + "@typescript-eslint/visitor-keys": "4.17.0" + } + }, + "@typescript-eslint/types": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.17.0.tgz", + "integrity": "sha512-RN5z8qYpJ+kXwnLlyzZkiJwfW2AY458Bf8WqllkondQIcN2ZxQowAToGSd9BlAUZDB5Ea8I6mqL2quGYCLT+2g==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.17.0.tgz", + "integrity": "sha512-lRhSFIZKUEPPWpWfwuZBH9trYIEJSI0vYsrxbvVvNyIUDoKWaklOAelsSkeh3E2VBSZiNe9BZ4E5tYBZbUczVQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.17.0", + "@typescript-eslint/visitor-keys": "4.17.0", + "debug": "^4.1.1", + "globby": "^11.0.1", + "is-glob": "^4.0.1", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.17.0.tgz", + "integrity": "sha512-WfuMN8mm5SSqXuAr9NM+fItJ0SVVphobWYkWOwQ1odsfC014Vdxk/92t4JwS1Q6fCA/ABfCKpa3AVtpUKTNKGQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.17.0", + "eslint-visitor-keys": "^2.0.0" + } + }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "dev": true + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "chokidar": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.3.1", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "coc-dev-tools": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/coc-dev-tools/-/coc-dev-tools-0.1.0.tgz", + "integrity": "sha512-uZ0LwQX+KBoyrv8/9gsfGqM5sryFm61x27Fzd5kyUDxEZStPfP81fZcys+yOwebCUjIDOIetzF4Z+NKVvFFZsw==", + "dev": true, + "requires": { + "eslint": "^7.10.0", + "prettier": "^2.1.2", + "yargs": "^16.0.3" + } + }, + "coc.nvim": { + "version": "0.0.80", + "resolved": "https://registry.npmjs.org/coc.nvim/-/coc.nvim-0.0.80.tgz", + "integrity": "sha512-/3vTcnofoAYMrdENrlQmADTzfXX4+PZ0fiM10a39UA37dTR2dpIGi9O469kcIksuunLjToqWG8S45AGx/9wV7g==", + "dev": true + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "confusing-browser-globals": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz", + "integrity": "sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw==", + "dev": true + }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.21.0.tgz", + "integrity": "sha512-W2aJbXpMNofUp0ztQaF40fveSsJBjlSCSWpy//gzfTvwC+USs/nceBrKmlJOiM8r1bLwP2EuYkCqArn/6QTIgg==", + "dev": true, + "requires": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash": "^4.17.20", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.4", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + } + }, + "eslint-config-josa": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-josa/-/eslint-config-josa-0.1.0.tgz", + "integrity": "sha512-xsR0V2uPAUVkRRYg8TwuXt+Nw+J5zO0XL03QTkU2RYUKdENLrcdaxe1REuHAB2xOoh3aOtHuLAiqj34Cd+iTIA==", + "dev": true, + "requires": { + "confusing-browser-globals": "1.0.9" + } + }, + "eslint-config-josa-typescript": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/eslint-config-josa-typescript/-/eslint-config-josa-typescript-0.1.2.tgz", + "integrity": "sha512-1EBWpJXR4UAO1X0tr1baulLasjjtYCiDSeFcMJhEw69dUXtzfEx6383hkvegbP9zb37+zNXAZfoNa6NGCjcqNQ==", + "dev": true, + "requires": { + "eslint-config-josa": "^0.1.0" + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", + "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "dev": true + }, + "espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fastq": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", + "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", + "dev": true + }, + "form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "globby": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", + "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + }, + "dependencies": { + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "dev": true + } + } + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "log-symbols": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "dev": true, + "requires": { + "chalk": "^4.0.0" + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "mime-db": { + "version": "1.46.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", + "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==", + "dev": true + }, + "mime-types": { + "version": "2.1.29", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", + "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", + "dev": true, + "requires": { + "mime-db": "1.46.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mocha": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.3.1.tgz", + "integrity": "sha512-5SBMxANWqOv5bw3Hx+HVgaWlcWcFEQDUdaUAr1AUU+qwtx6cowhn7gEDT/DwQP7uYxnvShdUOVLbTYAHOEGfDQ==", + "dev": true, + "requires": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.1", + "debug": "4.3.1", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.6", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.0.0", + "log-symbols": "4.0.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.20", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.1.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "js-yaml": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "nanoid": { + "version": "3.1.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", + "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "queue-microtask": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.2.tgz", + "integrity": "sha512-dB15eXv3p2jDlbOiNLyMabYg1/sXvppd8DP2J3EOCQ0AkuSXCW2tP7mnVouVLJKgUMY6yP0kcQDVpLCN13h4Xg==", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "readdirp": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "regexpp": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "dev": true + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "table": { + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", + "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", + "dev": true, + "requires": { + "ajv": "^7.0.2", + "lodash": "^4.17.20", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0" + }, + "dependencies": { + "ajv": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.2.1.tgz", + "integrity": "sha512-+nu0HDv7kNSOua9apAVc979qd932rrZeb3WOvoiD31A/p1mIE5/9bN2027pE2rOPYEdS3UHzsvof4hY+lM9/WQ==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dev": true, + "requires": { + "rimraf": "^3.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "ts-node": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", + "integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + }, + "dependencies": { + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + } + } + }, + "tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==" + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + } + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + }, + "typescript": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz", + "integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==", + "dev": true + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "vscode-languageserver-textdocument": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz", + "integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA==" + }, + "vscode-uri": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.2.tgz", + "integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==" + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "workerpool": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz", + "integrity": "sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==", + "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "y18n": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", + "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} diff --git a/coc/extensions/node_modules/coc-go/package.json b/coc/extensions/node_modules/coc-go/package.json new file mode 100644 index 0000000..fa6d0b3 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/package.json @@ -0,0 +1,733 @@ +{ + "name": "coc-go", + "version": "0.13.3", + "description": "gopls extension for coc", + "author": "Josa Gesell ", + "license": "MIT", + "main": "lib/extension.js", + "repository": { + "type": "git", + "url": "https://github.com/josa42/coc-go.git" + }, + "engines": { + "coc": "^0.0.80", + "node": ">=10" + }, + "keywords": [ + "coc.nvim", + "languageserver", + "gopls", + "go", + "golang", + "vim", + "neovim" + ], + "scripts": { + "test": "true || mocha --require ts-node/register '**/*.test.ts'", + "test:watch": "mocha --watch --watch-files '**/*.ts' --require ts-node/register '**/*.test.ts'", + "clean": "rimraf lib", + "build": "tsc -p tsconfig.json", + "build:watch": "tsc --watch -p tsconfig.json", + "prepare": "yarn clean && yarn build", + "link:add": "node ./scripts/link.js add", + "link:remove": "node ./scripts/link.js remove", + "update": "yarn run update:snippets && yarn run update:options && yarn run update:readme && yarn run update:readme", + "update:snippets": "./scripts/update-snippets.js", + "update:options": "./scripts/update-options.sh && node ./scripts/update-options-interface.js", + "update:commands": "./scripts/update-commands.js", + "update:readme": "./scripts/update-tables.sh", + "lint": "eslint . --ext .ts,.js", + "link": "coc-dev link", + "unlink": "coc-dev unlink" + }, + "activationEvents": [ + "onLanguage:go", + "onLanguage:gomod", + "onCommand:go.install.gomodifytags", + "onCommand:go.install.goplay", + "onCommand:go.install.gopls", + "onCommand:go.install.gotests", + "onCommand:go.install.impl", + "onCommand:go.install.tools", + "onCommand:go.version" + ], + "contributes": { + "rootPatterns": [ + { + "filetype": "go", + "patterns": [ + "go.mod" + ] + }, + { + "filetype": "gomod", + "patterns": [ + "go.mod" + ] + } + ], + "configuration": { + "type": "object", + "title": "gols", + "properties": { + "go.enable": { + "type": "boolean", + "default": true, + "description": "Enable Go extension" + }, + "go.trace.server": { + "type": "string", + "default": "off", + "enum": [ + "off", + "messages", + "verbose" + ], + "description": "Trace level of gopls" + }, + "go.goplsPath": { + "type": "string", + "description": "Path to `gopls` bin (Change requires `:CocRestart`)" + }, + "go.goplsArgs": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments passed to `gopls` (Change requires `:CocRestart`)" + }, + "go.goplsEnv": { + "type": "object", + "patternProperties": { + "^.+$": { + "type": "string" + } + }, + "description": "ENV passed to `gopls` (Change requires `:CocRestart`)" + }, + "go.goplsUseDaemon": { + "type": "boolean", + "default": true, + "description": "Run gopls as daemon" + }, + "go.disable": { + "type": "object", + "description": "Disable gopls features", + "default": {}, + "properties": { + "workspaceFolders": { + "type": "boolean", + "default": false, + "description": "Disable workspaceFolders feature (Change requires `:CocRestart`)" + }, + "diagnostics": { + "type": "boolean", + "default": false, + "description": "Disable handle diagnostics (Change requires `:CocRestart`)" + }, + "completion": { + "type": "boolean", + "default": false, + "description": "Disable completion feature (Change requires `:CocRestart`)" + } + } + }, + "go.goplsOptions": { + "type": "object", + "description": "See `gopls` documentation: https://github.com/golang/tools/blob/master/gopls/doc/settings.md", + "properties": { + "allowImplicitNetworkAccess": { + "type": "boolean", + "default": false, + "description": "**This setting is experimental and may be deleted.**\n\nallowImplicitNetworkAccess disables GOPROXY=off, allowing implicit module\ndownloads rather than requiring user action. This option will eventually\nbe removed.\n" + }, + "allowModfileModifications": { + "type": "boolean", + "default": false, + "description": "**This setting is experimental and may be deleted.**\n\nallowModfileModifications disables -mod=readonly, allowing imports from\nout-of-scope modules. This option will eventually be removed.\n" + }, + "analyses": { + "type": "object", + "description": "analyses specify analyses that the user would like to enable or disable.\nA map of the names of analysis passes that should be enabled/disabled.\nA full list of analyzers that gopls uses can be found\n[here](https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md).\n\nExample Usage:\n\n```json5\n...\n\"analyses\": {\n \"unreachable\": false, // Disable the unreachable analyzer.\n \"unusedparams\": true // Enable the unusedparams analyzer.\n}\n...\n```\n", + "additionalProperties": false, + "patternProperties": { + "^S[AT]?\\d{4}$": { + "type": "boolean" + } + }, + "properties": { + "asmdecl": { + "type": "boolean", + "description": "report mismatches between assembly files and Go declarations", + "default": true + }, + "assign": { + "type": "boolean", + "description": "check for useless assignments\nThis checker reports assignments of the form x = x or a[i] = a[i].\nThese are almost always useless, and even when they aren't they are\nusually a mistake.", + "default": true + }, + "atomic": { + "type": "boolean", + "description": "check for common mistakes using the sync/atomic package\nThe atomic checker looks for assignment statements of the form:\n\tx = atomic.AddUint64(&x, 1)\nwhich are not atomic.", + "default": true + }, + "atomicalign": { + "type": "boolean", + "description": "check for non-64-bits-aligned arguments to sync/atomic functions", + "default": true + }, + "bools": { + "type": "boolean", + "description": "check for common mistakes involving boolean operators", + "default": true + }, + "buildtag": { + "type": "boolean", + "description": "check that +build tags are well-formed and correctly located", + "default": true + }, + "cgocall": { + "type": "boolean", + "description": "detect some violations of the cgo pointer passing rules\nCheck for invalid cgo pointer passing.\nThis looks for code that uses cgo to call C code passing values\nwhose types are almost always invalid according to the cgo pointer\nsharing rules.\nSpecifically, it warns about attempts to pass a Go chan, map, func,\nor slice to C, either directly, or via a pointer, array, or struct.", + "default": true + }, + "composites": { + "type": "boolean", + "description": "check for unkeyed composite literals\nThis analyzer reports a diagnostic for composite literals of struct\ntypes imported from another package that do not use the field-keyed\nsyntax. Such literals are fragile because the addition of a new field\n(even if unexported) to the struct will cause compilation to fail.\nAs an example,\n\terr = &net.DNSConfigError{err}\nshould be replaced by:\n\terr = &net.DNSConfigError{Err: err}", + "default": true + }, + "copylocks": { + "type": "boolean", + "description": "check for locks erroneously passed by value\nInadvertently copying a value containing a lock, such as sync.Mutex or\nsync.WaitGroup, may cause both copies to malfunction. Generally such\nvalues should be referred to through a pointer.", + "default": true + }, + "deepequalerrors": { + "type": "boolean", + "description": "check for calls of reflect.DeepEqual on error values\nThe deepequalerrors checker looks for calls of the form:\n reflect.DeepEqual(err1, err2)\nwhere err1 and err2 are errors. Using reflect.DeepEqual to compare\nerrors is discouraged.", + "default": true + }, + "errorsas": { + "type": "boolean", + "description": "report passing non-pointer or non-error values to errors.As\nThe errorsas analysis reports calls to errors.As where the type\nof the second argument is not a pointer to a type implementing error.", + "default": true + }, + "fieldalignment": { + "type": "boolean", + "description": "find structs that would take less memory if their fields were sorted\nThis analyzer find structs that can be rearranged to take less memory, and provides\na suggested edit with the optimal order.\n**Disabled by default. Enable it by setting `\"analyses\": {\"fieldalignment\": true}`.**" + }, + "httpresponse": { + "type": "boolean", + "description": "check for mistakes using HTTP responses\nA common mistake when using the net/http package is to defer a function\ncall to close the http.Response Body before checking the error that\ndetermines whether the response is valid:\n\tresp, err := http.Head(url)\n\tdefer resp.Body.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// (defer statement belongs here)\nThis checker helps uncover latent nil dereference bugs by reporting a\ndiagnostic for such mistakes.", + "default": true + }, + "ifaceassert": { + "type": "boolean", + "description": "detect impossible interface-to-interface type assertions\nThis checker flags type assertions v.(T) and corresponding type-switch cases\nin which the static type V of v is an interface that cannot possibly implement\nthe target interface T. This occurs when V and T contain methods with the same\nname but different signatures. Example:\n\tvar v interface {\n\t\tRead()\n\t}\n\t_ = v.(io.Reader)\nThe Read method in v has a different signature than the Read method in\nio.Reader, so this assertion cannot succeed.", + "default": true + }, + "loopclosure": { + "type": "boolean", + "description": "check references to loop variables from within nested functions\nThis analyzer checks for references to loop variables from within a\nfunction literal inside the loop body. It checks only instances where\nthe function literal is called in a defer or go statement that is the\nlast statement in the loop body, as otherwise we would need whole\nprogram analysis.\nFor example:\n\tfor i, v := range s {\n\t\tgo func() {\n\t\t\tprintln(i, v) // not what you might expect\n\t\t}()\n\t}\nSee: https://golang.org/doc/go_faq.html#closures_and_goroutines", + "default": true + }, + "lostcancel": { + "type": "boolean", + "description": "check cancel func returned by context.WithCancel is called\nThe cancellation function returned by context.WithCancel, WithTimeout,\nand WithDeadline must be called or the new context will remain live\nuntil its parent context is cancelled.\n(The background context is never cancelled.)", + "default": true + }, + "nilfunc": { + "type": "boolean", + "description": "check for useless comparisons between functions and nil\nA useless comparison is one like f == nil as opposed to f() == nil.", + "default": true + }, + "printf": { + "type": "boolean", + "description": "check consistency of Printf format strings and arguments\nThe check applies to known functions (for example, those in package fmt)\nas well as any detected wrappers of known functions.\nA function that wants to avail itself of printf checking but is not\nfound by this analyzer's heuristics (for example, due to use of\ndynamic calls) can insert a bogus call:\n\tif false {\n\t\t_ = fmt.Sprintf(format, args...) // enable printf checking\n\t}\nThe -funcs flag specifies a comma-separated list of names of additional\nknown formatting functions or methods. If the name contains a period,\nit must denote a specific function using one of the following forms:\n\tdir/pkg.Function\n\tdir/pkg.Type.Method\n\t(*dir/pkg.Type).Method\nOtherwise the name is interpreted as a case-insensitive unqualified\nidentifier such as \"errorf\". Either way, if a listed name ends in f, the\nfunction is assumed to be Printf-like, taking a format string before the\nargument list. Otherwise it is assumed to be Print-like, taking a list\nof arguments with no format string.", + "default": true + }, + "shadow": { + "type": "boolean", + "description": "check for possible unintended shadowing of variables\nThis analyzer check for shadowed variables.\nA shadowed variable is a variable declared in an inner scope\nwith the same name and type as a variable in an outer scope,\nand where the outer variable is mentioned after the inner one\nis declared.\n(This definition can be refined; the module generates too many\nfalse positives and is not yet enabled by default.)\nFor example:\n\tfunc BadRead(f *os.File, buf []byte) error {\n\t\tvar err error\n\t\tfor {\n\t\t\tn, err := f.Read(buf) // shadows the function variable 'err'\n\t\t\tif err != nil {\n\t\t\t\tbreak // causes return of wrong value\n\t\t\t}\n\t\t\tfoo(buf)\n\t\t}\n\t\treturn err\n\t}\n**Disabled by default. Enable it by setting `\"analyses\": {\"shadow\": true}`.**" + }, + "shift": { + "type": "boolean", + "description": "check for shifts that equal or exceed the width of the integer", + "default": true + }, + "simplifycompositelit": { + "type": "boolean", + "description": "check for composite literal simplifications\nAn array, slice, or map composite literal of the form:\n\t[]T{T{}, T{}}\nwill be simplified to:\n\t[]T{{}, {}}\nThis is one of the simplifications that \"gofmt -s\" applies.", + "default": true + }, + "simplifyrange": { + "type": "boolean", + "description": "check for range statement simplifications\nA range of the form:\n\tfor x, _ = range v {...}\nwill be simplified to:\n\tfor x = range v {...}\nA range of the form:\n\tfor _ = range v {...}\nwill be simplified to:\n\tfor range v {...}\nThis is one of the simplifications that \"gofmt -s\" applies.", + "default": true + }, + "simplifyslice": { + "type": "boolean", + "description": "check for slice simplifications\nA slice expression of the form:\n\ts[a:len(s)]\nwill be simplified to:\n\ts[a:]\nThis is one of the simplifications that \"gofmt -s\" applies.", + "default": true + }, + "sortslice": { + "type": "boolean", + "description": "check the argument type of sort.Slice\nsort.Slice requires an argument of a slice type. Check that\nthe interface{} value passed to sort.Slice is actually a slice.", + "default": true + }, + "stdmethods": { + "type": "boolean", + "description": "check signature of methods of well-known interfaces\nSometimes a type may be intended to satisfy an interface but may fail to\ndo so because of a mistake in its method signature.\nFor example, the result of this WriteTo method should be (int64, error),\nnot error, to satisfy io.WriterTo:\n\ttype myWriterTo struct{...}\n func (myWriterTo) WriteTo(w io.Writer) error { ... }\nThis check ensures that each method whose name matches one of several\nwell-known interface methods from the standard library has the correct\nsignature for that interface.\nChecked method names include:\n\tFormat GobEncode GobDecode MarshalJSON MarshalXML\n\tPeek ReadByte ReadFrom ReadRune Scan Seek\n\tUnmarshalJSON UnreadByte UnreadRune WriteByte\n\tWriteTo", + "default": true + }, + "stringintconv": { + "type": "boolean", + "description": "check for string(int) conversions\nThis checker flags conversions of the form string(x) where x is an integer\n(but not byte or rune) type. Such conversions are discouraged because they\nreturn the UTF-8 representation of the Unicode code point x, and not a decimal\nstring representation of x as one might expect. Furthermore, if x denotes an\ninvalid code point, the conversion cannot be statically rejected.\nFor conversions that intend on using the code point, consider replacing them\nwith string(rune(x)). Otherwise, strconv.Itoa and its equivalents return the\nstring representation of the value in the desired base.", + "default": true + }, + "structtag": { + "type": "boolean", + "description": "check that struct field tags conform to reflect.StructTag.Get\nAlso report certain struct tags (json, xml) used with unexported fields.", + "default": true + }, + "testinggoroutine": { + "type": "boolean", + "description": "report calls to (*testing.T).Fatal from goroutines started by a test.\nFunctions that abruptly terminate a test, such as the Fatal, Fatalf, FailNow, and\nSkip{,f,Now} methods of *testing.T, must be called from the test goroutine itself.\nThis checker detects calls to these functions that occur within a goroutine\nstarted by the test. For example:\nfunc TestFoo(t *testing.T) {\n go func() {\n t.Fatal(\"oops\") // error: (*T).Fatal called from non-test goroutine\n }()\n}", + "default": true + }, + "tests": { + "type": "boolean", + "description": "check for common mistaken usages of tests and examples\nThe tests checker walks Test, Benchmark and Example functions checking\nmalformed names, wrong signatures and examples documenting non-existent\nidentifiers.\nPlease see the documentation for package testing in golang.org/pkg/testing\nfor the conventions that are enforced for Tests, Benchmarks, and Examples.", + "default": true + }, + "unmarshal": { + "type": "boolean", + "description": "report passing non-pointer or non-interface values to unmarshal\nThe unmarshal analysis reports calls to functions such as json.Unmarshal\nin which the argument type is not a pointer or an interface.", + "default": true + }, + "unreachable": { + "type": "boolean", + "description": "check for unreachable code\nThe unreachable analyzer finds statements that execution can never reach\nbecause they are preceded by an return statement, a call to panic, an\ninfinite loop, or similar constructs.", + "default": true + }, + "unsafeptr": { + "type": "boolean", + "description": "check for invalid conversions of uintptr to unsafe.Pointer\nThe unsafeptr analyzer reports likely incorrect uses of unsafe.Pointer\nto convert integers to pointers. A conversion from uintptr to\nunsafe.Pointer is invalid if it implies that there is a uintptr-typed\nword in memory that holds a pointer value, because that word will be\ninvisible to stack copying and to the garbage collector.", + "default": true + }, + "unusedparams": { + "type": "boolean", + "description": "check for unused parameters of functions\nThe unusedparams analyzer checks functions to see if there are\nany parameters that are not being used.\nTo reduce false positives it ignores:\n- methods\n- parameters that do not have a name or are underscored\n- functions in test files\n- functions with empty bodies or those with just a return stmt\n**Disabled by default. Enable it by setting `\"analyses\": {\"unusedparams\": true}`.**" + }, + "unusedresult": { + "type": "boolean", + "description": "check for unused results of calls to some functions\nSome functions like fmt.Errorf return a result and have no side effects,\nso it is always a mistake to discard the result. This analyzer reports\ncalls to certain functions in which the result of the call is ignored.\nThe set of functions may be controlled using flags.", + "default": true + }, + "fillreturns": { + "type": "boolean", + "description": "suggested fixes for \"wrong number of return values (want %d, got %d)\"\nThis checker provides suggested fixes for type errors of the\ntype \"wrong number of return values (want %d, got %d)\". For example:\n\tfunc m() (int, string, *bool, error) {\n\t\treturn\n\t}\nwill turn into\n\tfunc m() (int, string, *bool, error) {\n\t\treturn 0, \"\", nil, nil\n\t}\nThis functionality is similar to https://github.com/sqs/goreturns.", + "default": true + }, + "nonewvars": { + "type": "boolean", + "description": "suggested fixes for \"no new vars on left side of :=\"\nThis checker provides suggested fixes for type errors of the\ntype \"no new vars on left side of :=\". For example:\n\tz := 1\n\tz := 2\nwill turn into\n\tz := 1\n\tz = 2", + "default": true + }, + "noresultvalues": { + "type": "boolean", + "description": "suggested fixes for \"no result values expected\"\nThis checker provides suggested fixes for type errors of the\ntype \"no result values expected\". For example:\n\tfunc z() { return nil }\nwill turn into\n\tfunc z() { return }", + "default": true + }, + "undeclaredname": { + "type": "boolean", + "description": "suggested fixes for \"undeclared name: <>\"\nThis checker provides suggested fixes for type errors of the\ntype \"undeclared name: <>\". It will insert a new statement:\n\"<> := \".", + "default": true + }, + "fillstruct": { + "type": "boolean", + "description": "note incomplete struct initializations\nThis analyzer provides diagnostics for any struct literals that do not have\nany fields initialized. Because the suggested fix for this analysis is\nexpensive to compute, callers should compute it separately, using the\nSuggestedFix function below.", + "default": true + } + } + }, + "annotations": { + "type": "object", + "patternProperties": { + ".+": { + "type": "boolean" + } + }, + "description": "**This setting is experimental and may be deleted.**\n\nannotations specifies the various kinds of optimization diagnostics\nthat should be reported by the gc_details command.\n\nCan contain any of:\n\n* `\"bounds\"` controls bounds checking diagnostics.\n\n* `\"escape\"` controls diagnostics about escape choices.\n\n* `\"inline\"` controls diagnostics about inlining choices.\n\n* `\"nil\"` controls nil checks.\n" + }, + "buildFlags": { + "type": "array", + "items": { + "type": "string" + }, + "description": "buildFlags is the set of flags passed on to the build system when invoked.\nIt is applied to queries like `go list`, which is used when discovering files.\nThe most common use is to set `-tags`.\n" + }, + "codelenses": { + "type": "object", + "description": "codelenses overrides the enabled/disabled state of code lenses. See the\n\"Code Lenses\" section of the\n[Settings page](https://github.com/golang/tools/blob/master/gopls/doc/settings.md)\nfor the list of supported lenses.\n\nExample Usage:\n\n```json5\n\"gopls\": {\n...\n \"codelens\": {\n \"generate\": false, // Don't show the `go generate` lens.\n \"gc_details\": true // Show a code lens toggling the display of gc's choices.\n }\n...\n}\n```\n", + "additionalProperties": false, + "properties": { + "gc_details": { + "type": "boolean", + "default": false + }, + "generate": { + "type": "boolean", + "default": true + }, + "regenerate_cgo": { + "type": "boolean", + "default": true + }, + "tidy": { + "type": "boolean", + "default": true + }, + "upgrade_dependency": { + "type": "boolean", + "default": true + }, + "vendor": { + "type": "boolean", + "default": true + } + } + }, + "completionBudget": { + "type": "string", + "default": "100ms", + "description": "**This setting is for debugging purposes only.**\n\ncompletionBudget is the soft latency goal for completion requests. Most\nrequests finish in a couple milliseconds, but in some cases deep\ncompletions can take much longer. As we use up our budget we\ndynamically reduce the search scope to ensure we return timely\nresults. Zero means unlimited.\n" + }, + "directoryFilters": { + "type": "array", + "items": { + "type": "string" + }, + "description": "directoryFilters can be used to exclude unwanted directories from the\nworkspace. By default, all directories are included. Filters are an\noperator, `+` to include and `-` to exclude, followed by a path prefix\nrelative to the workspace folder. They are evaluated in order, and\nthe last filter that applies to a path controls whether it is included.\nThe path prefix can be empty, so an initial `-` excludes everything.\n\nExamples:\nExclude node_modules: `-node_modules`\nInclude only project_a: `-` (exclude everything), `+project_a`\nInclude only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`\n" + }, + "env": { + "type": "object", + "patternProperties": { + ".+": { + "type": "string" + } + }, + "description": "env adds environment variables to external commands run by `gopls`, most notably `go list`.\n" + }, + "expandWorkspaceToModule": { + "type": "boolean", + "default": true, + "description": "**This setting is experimental and may be deleted.**\n\nexpandWorkspaceToModule instructs `gopls` to adjust the scope of the\nworkspace to find the best available module root. `gopls` first looks for\na go.mod file in any parent directory of the workspace folder, expanding\nthe scope to that directory if it exists. If no viable parent directory is\nfound, gopls will check if there is exactly one child directory containing\na go.mod file, narrowing the scope to that directory if it exists.\n" + }, + "experimentalDiagnosticsDelay": { + "type": "string", + "default": "250ms", + "description": "**This setting is experimental and may be deleted.**\n\nexperimentalDiagnosticsDelay controls the amount of time that gopls waits\nafter the most recent file modification before computing deep diagnostics.\nSimple diagnostics (parsing and type-checking) are always run immediately\non recently modified packages.\n\nThis option must be set to a valid duration string, for example `\"250ms\"`.\n" + }, + "experimentalPackageCacheKey": { + "type": "boolean", + "default": true, + "description": "**This setting is experimental and may be deleted.**\n\nexperimentalPackageCacheKey controls whether to use a coarser cache key\nfor package type information to increase cache hits. This setting removes\nthe user's environment, build flags, and working directory from the cache\nkey, which should be a safe change as all relevant inputs into the type\nchecking pass are already hashed into the key. This is temporarily guarded\nby an experiment because caching behavior is subtle and difficult to\ncomprehensively test.\n" + }, + "experimentalWorkspaceModule": { + "type": "boolean", + "default": false, + "description": "**This setting is experimental and may be deleted.**\n\nexperimentalWorkspaceModule opts a user into the experimental support\nfor multi-module workspaces.\n" + }, + "gofumpt": { + "type": "boolean", + "default": false, + "description": "gofumpt indicates if we should run gofumpt formatting.\n" + }, + "hoverKind": { + "type": "string", + "enum": [ + "FullDocumentation", + "NoDocumentation", + "SingleLine", + "Structured", + "SynopsisDocumentation" + ], + "default": "FullDocumentation", + "description": "hoverKind controls the information that appears in the hover text.\nSingleLine and Structured are intended for use only by authors of editor plugins.\n\nMust be one of:\n\n* `\"FullDocumentation\"`\n* `\"NoDocumentation\"`\n* `\"SingleLine\"`\n* `\"Structured\"` is an experimental setting that returns a structured hover format.\nThis format separates the signature from the documentation, so that the client\ncan do more manipulation of these fields.\\\nThis should only be used by clients that support this behavior.\n\n* `\"SynopsisDocumentation\"`\n" + }, + "importShortcut": { + "type": "string", + "enum": [ + "Both", + "Definition", + "Link" + ], + "default": "Both", + "description": "importShortcut specifies whether import statements should link to\ndocumentation or go to definitions.\n\nMust be one of:\n\n* `\"Both\"`\n* `\"Definition\"`\n* `\"Link\"`\n" + }, + "linksInHover": { + "type": "boolean", + "default": true, + "description": "linksInHover toggles the presence of links to documentation in hover.\n" + }, + "linkTarget": { + "type": "string", + "default": "pkg.go.dev", + "description": "linkTarget controls where documentation links go.\nIt might be one of:\n\n* `\"godoc.org\"`\n* `\"pkg.go.dev\"`\n\nIf company chooses to use its own `godoc.org`, its address can be used as well.\n" + }, + "local": { + "type": "string", + "default": "", + "description": "local is the equivalent of the `goimports -local` flag, which puts\nimports beginning with this string after third-party packages. It should\nbe the prefix of the import path whose imports should be grouped\nseparately.\n" + }, + "matcher": { + "type": "string", + "enum": [ + "CaseInsensitive", + "CaseSensitive", + "Fuzzy" + ], + "default": "Fuzzy", + "description": "**This is an advanced setting and should not be configured by most `gopls` users.**\n\nmatcher sets the algorithm that is used when calculating completion\ncandidates.\n\nMust be one of:\n\n* `\"CaseInsensitive\"`\n* `\"CaseSensitive\"`\n* `\"Fuzzy\"`\n" + }, + "semanticTokens": { + "type": "boolean", + "default": false, + "description": "**This setting is experimental and may be deleted.**\n\nsemanticTokens controls whether the LSP server will send\nsemantic tokens to the client.\n" + }, + "staticcheck": { + "type": "boolean", + "default": false, + "description": "**This setting is experimental and may be deleted.**\n\nstaticcheck enables additional analyses from staticcheck.io.\n" + }, + "symbolMatcher": { + "type": "string", + "enum": [ + "CaseInsensitive", + "CaseSensitive", + "Fuzzy" + ], + "default": "Fuzzy", + "description": "**This is an advanced setting and should not be configured by most `gopls` users.**\n\nsymbolMatcher sets the algorithm that is used when finding workspace symbols.\n\nMust be one of:\n\n* `\"CaseInsensitive\"`\n* `\"CaseSensitive\"`\n* `\"Fuzzy\"`\n" + }, + "symbolStyle": { + "type": "string", + "enum": [ + "Dynamic", + "Full", + "Package" + ], + "default": "Dynamic", + "description": "**This is an advanced setting and should not be configured by most `gopls` users.**\n\nsymbolStyle controls how symbols are qualified in symbol responses.\n\nExample Usage:\n\n```json5\n\"gopls\": {\n...\n \"symbolStyle\": \"dynamic\",\n...\n}\n```\n\nMust be one of:\n\n* `\"Dynamic\"` uses whichever qualifier results in the highest scoring\nmatch for the given symbol query. Here a \"qualifier\" is any \"/\" or \".\"\ndelimited suffix of the fully qualified symbol. i.e. \"to/pkg.Foo.Field\" or\njust \"Foo.Field\".\n\n* `\"Full\"` is fully qualified symbols, i.e.\n\"path/to/pkg.Foo.Field\".\n\n* `\"Package\"` is package qualified symbols i.e.\n\"pkg.Foo.Field\".\n" + }, + "usePlaceholders": { + "type": "boolean", + "default": false, + "description": "placeholders enables placeholders for function parameters or struct\nfields in completion responses.\n" + }, + "verboseOutput": { + "type": "boolean", + "default": false, + "description": "**This setting is for debugging purposes only.**\n\nverboseOutput enables additional debug logging.\n" + } + } + }, + "go.tags": { + "type": "object", + "properties": { + "tags": { + "type": "string", + "default": "json", + "description": "Comma separated tags to be used by `go.tags.add` command" + }, + "options": { + "type": "string", + "default": "json=omitempty", + "description": "Comma separated tag=options pairs to be used by `go.tags.add` command" + }, + "transform": { + "type": "string", + "enum": [ + "snakecase", + "camelcase" + ], + "default": "snakecase", + "description": "Transformation rule used by `go.tags.add` command to add tags" + }, + "skipUnexported": { + "type": "boolean", + "default": false, + "description": "If true, skip unexported fields" + } + } + }, + "go.tests": { + "type": "object", + "properties": { + "generateFlags": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "description": "Additional command line flags to pass to `gotests` for generating tests." + } + } + }, + "go.checkForUpdates": { + "description": "[EXPERIMENTAL] Check for gopls updates on start.", + "type": "string", + "default": "disabled", + "enum": [ + "disabled", + "inform", + "ask", + "install" + ] + } + } + }, + "commands": [ + { + "title": "Generate interface stubs", + "category": "Go", + "command": "go.impl.cursor" + }, + { + "title": "Install / update gomodifytags", + "category": "Go", + "command": "go.install.gomodifytags" + }, + { + "title": "Install / update goplay", + "category": "Go", + "command": "go.install.goplay" + }, + { + "title": "Install / update gopls", + "category": "Go", + "command": "go.install.gopls" + }, + { + "title": "Install / update gotests", + "category": "Go", + "command": "go.install.gotests" + }, + { + "title": "Install / update impl", + "category": "Go", + "command": "go.install.impl" + }, + { + "title": "Install / update all tools", + "category": "Go", + "command": "go.install.tools" + }, + { + "title": "Run on go playground", + "category": "Go", + "command": "go.playground" + }, + { + "title": "Add tags to struct fields", + "category": "Go", + "command": "go.tags.add" + }, + { + "title": "Add tags to struct field in current line", + "category": "Go", + "command": "go.tags.add.line" + }, + { + "title": "Add tags to struct fields (prompt)", + "category": "Go", + "command": "go.tags.add.prompt" + }, + { + "title": "Remove all tags from struct fields", + "category": "Go", + "command": "go.tags.clear" + }, + { + "title": "Remove all tags from struct fields in current line", + "category": "Go", + "command": "go.tags.clear.line" + }, + { + "title": "Remove tags from struct fields", + "category": "Go", + "command": "go.tags.remove" + }, + { + "title": "Remove tags from struct field in current line", + "category": "Go", + "command": "go.tags.remove.line" + }, + { + "title": "Remove tags from struct fields (prompt)", + "category": "Go", + "command": "go.tags.remove.prompt" + }, + { + "title": "Generate unit tests for exported functions in file", + "category": "Go", + "command": "go.test.generate.exported" + }, + { + "title": "Generate unit tests for file", + "category": "Go", + "command": "go.test.generate.file" + }, + { + "title": "Generate unit tests for current function", + "category": "Go", + "command": "go.test.generate.function" + }, + { + "title": "Toggle test file", + "category": "Go", + "command": "go.test.toggle" + }, + { + "title": "Print extension version", + "category": "Go", + "command": "go.version" + } + ], + "snippets": [ + { + "language": "go", + "path": "./snippets/go.json" + }, + { + "language": "gomod", + "path": "./snippets/gomod.json" + } + ] + }, + "devDependencies": { + "@types/mocha": "^8.0.3", + "@types/node": "^14.11.1", + "@types/node-fetch": "^2.5.7", + "@types/tmp": "^0.2.0", + "@types/which": "^2.0.0", + "@typescript-eslint/eslint-plugin": "^4.1.1", + "@typescript-eslint/parser": "^4.1.1", + "coc-dev-tools": "^0.1.0", + "coc.nvim": "0.0.80", + "eslint": "^7.9.0", + "eslint-config-josa-typescript": "^0.1.2", + "mocha": "^8.1.3", + "rimraf": "^3.0.2", + "tmp": "^0.2.1", + "ts-node": "^9.0.0", + "typescript": "~4.1.2" + }, + "dependencies": { + "node-fetch": "^2.6.1", + "tslib": "^2.0.0", + "vscode-languageserver-textdocument": "^1.0.1", + "vscode-uri": "^3.0.1", + "which": "^2.0.2" + } +} diff --git a/coc/extensions/node_modules/coc-go/snippets/go.json b/coc/extensions/node_modules/coc-go/snippets/go.json new file mode 100644 index 0000000..e9cfc58 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/snippets/go.json @@ -0,0 +1,447 @@ +{ + "single import": { + "prefix": "im", + "body": [ + "import \"${1:package}\"" + ], + "description": "import statement" + }, + "multiple imports": { + "prefix": "ims", + "body": [ + "import (", + "\t\"${1:package}\"", + ")" + ], + "description": "a import block" + }, + "single constant": { + "prefix": "co", + "body": [ + "const ${1:name} = ${2:value}" + ], + "description": "a constant" + }, + "multiple constants": { + "prefix": "cos", + "body": [ + "const (", + "\t${1:name} = ${2:value}", + ")" + ], + "description": "a constant block" + }, + "type interface declaration": { + "prefix": "tyi", + "body": [ + "type ${1:name} interface {", + "\t$0", + "}" + ], + "description": "a type interface" + }, + "type struct declaration": { + "prefix": "tys", + "body": [ + "type ${1:name} struct {", + "\t$0", + "}" + ], + "description": "a struct declaration" + }, + "package main and main function": { + "prefix": "pkgm", + "body": [ + "package main", + "", + "func main() {", + "\t$0", + "}" + ], + "description": "main package & function" + }, + "function declaration": { + "prefix": "func", + "body": [ + "func $1($2) $3 {", + "\t$0", + "}" + ], + "description": "function declaration" + }, + "variable declaration": { + "prefix": "var", + "body": [ + "var ${1:name} ${2:type}" + ], + "description": "a variable" + }, + "switch statement": { + "prefix": "switch", + "body": [ + "switch ${1:expression} {", + "case ${2:condition}:", + "\t$0", + "}" + ], + "description": "switch statement" + }, + "select statement": { + "prefix": "sel", + "body": [ + "select {", + "case ${1:condition}:", + "\t$0", + "}" + ], + "description": "select statement" + }, + "case clause": { + "prefix": "cs", + "body": [ + "case ${1:condition}:$0" + ], + "description": "case clause" + }, + "for statement": { + "prefix": "for", + "body": [ + "for ${1:i} := 0; $1 < ${2:count}; $1${3:++} {", + "\t$0", + "}" + ], + "description": "a for loop" + }, + "for range statement": { + "prefix": "forr", + "body": [ + "for ${1:_, }${2:var} := range ${3:var} {", + "\t$0", + "}" + ], + "description": "a for range loop" + }, + "channel declaration": { + "prefix": "ch", + "body": [ + "chan ${1:type}" + ], + "description": "a channel" + }, + "map declaration": { + "prefix": "map", + "body": [ + "map[${1:type}]${2:type}" + ], + "description": "a map" + }, + "empty interface": { + "prefix": "in", + "body": [ + "interface{}" + ], + "description": "empty interface" + }, + "if statement": { + "prefix": "if", + "body": [ + "if ${1:condition} {", + "\t$0", + "}" + ], + "description": "if statement" + }, + "else branch": { + "prefix": "el", + "body": [ + "else {", + "\t$0", + "}" + ], + "description": "else branch" + }, + "if else statement": { + "prefix": "ie", + "body": [ + "if ${1:condition} {", + "\t$2", + "} else {", + "\t$0", + "}" + ], + "description": "if else" + }, + "if err != nil": { + "prefix": "iferr", + "body": [ + "if err != nil {", + "\t${1:return ${2:nil, }${3:err}}", + "}" + ], + "description": "if err != nil" + }, + "fmt.Println": { + "prefix": "fp", + "body": [ + "fmt.Println(\"$1\")" + ], + "description": "fmt.Println()" + }, + "fmt.Printf": { + "prefix": "ff", + "body": [ + "fmt.Printf(\"$1\", ${2:var})" + ], + "description": "fmt.Printf()" + }, + "log.Println": { + "prefix": "lp", + "body": [ + "log.Println(\"$1\")" + ], + "description": "log.Println()" + }, + "log.Printf": { + "prefix": "lf", + "body": [ + "log.Printf(\"$1\", ${2:var})" + ], + "description": "log.Printf()" + }, + "log variable content": { + "prefix": "lv", + "body": [ + "log.Printf(\"${1:var}: %#+v\\\\n\", ${1:var})" + ], + "description": "log.Printf() with variable content" + }, + "t.Log": { + "prefix": "tl", + "body": [ + "t.Log(\"$1\")" + ], + "description": "t.Log()" + }, + "t.Logf": { + "prefix": "tlf", + "body": [ + "t.Logf(\"$1\", ${2:var})" + ], + "description": "t.Logf()" + }, + "t.Logf variable content": { + "prefix": "tlv", + "body": [ + "t.Logf(\"${1:var}: %#+v\\\\n\", ${1:var})" + ], + "description": "t.Logf() with variable content" + }, + "make(...)": { + "prefix": "make", + "body": [ + "make(${1:type}, ${2:0})" + ], + "description": "make statement" + }, + "new(...)": { + "prefix": "new", + "body": [ + "new(${1:type})" + ], + "description": "new statement" + }, + "panic(...)": { + "prefix": "pn", + "body": [ + "panic(\"$0\")" + ], + "description": "panic" + }, + "http ResponseWriter *Request": { + "prefix": "wr", + "body": [ + "${1:w} http.ResponseWriter, ${2:r} *http.Request" + ], + "description": "http Response" + }, + "http.HandleFunc": { + "prefix": "hf", + "body": [ + "${1:http}.HandleFunc(\"${2:/}\", ${3:handler})" + ], + "description": "http.HandleFunc()" + }, + "http handler declaration": { + "prefix": "hand", + "body": [ + "func $1(${2:w} http.ResponseWriter, ${3:r} *http.Request) {", + "\t$0", + "}" + ], + "description": "http handler declaration" + }, + "http.Redirect": { + "prefix": "rd", + "body": [ + "http.Redirect(${1:w}, ${2:r}, \"${3:/}\", ${4:http.StatusFound})" + ], + "description": "http.Redirect()" + }, + "http.Error": { + "prefix": "herr", + "body": [ + "http.Error(${1:w}, ${2:err}.Error(), ${3:http.StatusInternalServerError})" + ], + "description": "http.Error()" + }, + "http.ListenAndServe": { + "prefix": "las", + "body": [ + "http.ListenAndServe(\"${1::8080}\", ${2:nil})" + ], + "description": "http.ListenAndServe" + }, + "http.Serve": { + "prefix": "sv", + "body": [ + "http.Serve(\"${1::8080}\", ${2:nil})" + ], + "description": "http.Serve" + }, + "goroutine anonymous function": { + "prefix": "go", + "body": [ + "go func($1) {", + "\t$0", + "}($2)" + ], + "description": "anonymous goroutine declaration" + }, + "goroutine function": { + "prefix": "gf", + "body": [ + "go ${1:func}($0)" + ], + "description": "goroutine declaration" + }, + "defer statement": { + "prefix": "df", + "body": [ + "defer ${1:func}($0)" + ], + "description": "defer statement" + }, + "test function": { + "prefix": "tf", + "body": [ + "func Test$1(t *testing.T) {", + "\t$0", + "}" + ], + "description": "Test function" + }, + "benchmark function": { + "prefix": "bf", + "body": [ + "func Benchmark$1(b *testing.B) {", + "\tfor ${2:i} := 0; ${2:i} < b.N; ${2:i}++ {", + "\t\t$0", + "\t}", + "}" + ], + "description": "Benchmark function" + }, + "example function": { + "prefix": "ef", + "body": [ + "func Example$1() {", + "\t$2", + "\t//Output:", + "\t$3", + "}" + ], + "description": "Example function" + }, + "table driven test": { + "prefix": "tdt", + "body": [ + "func Test$1(t *testing.T) {", + "\ttestCases := []struct {", + "\t\tdesc\tstring", + "\t\t$2", + "\t}{", + "\t\t{", + "\t\t\tdesc: \"$3\",", + "\t\t\t$4", + "\t\t},", + "\t}", + "\tfor _, tC := range testCases {", + "\t\tt.Run(tC.desc, func(t *testing.T) {", + "\t\t\t$0", + "\t\t})", + "\t}", + "}" + ], + "description": "table driven test" + }, + "init function": { + "prefix": "finit", + "body": [ + "func init() {", + "\t$1", + "}" + ], + "description": "init function" + }, + "main function": { + "prefix": "fmain", + "body": [ + "func main() {", + "\t$1", + "}" + ], + "description": "main function" + }, + "method declaration": { + "prefix": "meth", + "body": [ + "func (${1:receiver} ${2:type}) ${3:method}($4) $5 {", + "\t$0", + "}" + ], + "description": "method declaration" + }, + "hello world web app": { + "prefix": "helloweb", + "body": [ + "package main", + "", + "import (", + "\t\"fmt\"", + "\t\"net/http\"", + "\t\"time\"", + ")", + "", + "func greet(w http.ResponseWriter, r *http.Request) {", + "\tfmt.Fprintf(w, \"Hello World! %s\", time.Now())", + "}", + "", + "func main() {", + "\thttp.HandleFunc(\"/\", greet)", + "\thttp.ListenAndServe(\":8080\", nil)", + "}" + ], + "description": "sample hello world webapp" + }, + "sort implementation": { + "prefix": "sort", + "body": [ + "type ${1:SortBy} []${2:Type}", + "", + "func (a $1) Len() int { return len(a) }", + "func (a $1) Swap(i, j int) { a[i], a[j] = a[j], a[i] }", + "func (a $1) Less(i, j int) bool { ${3:return a[i] < a[j]} }" + ], + "description": "a custom sort.Sort interface implementation, for a given slice type." + } +} \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-go/snippets/gomod.json b/coc/extensions/node_modules/coc-go/snippets/gomod.json new file mode 100644 index 0000000..91153f0 --- /dev/null +++ b/coc/extensions/node_modules/coc-go/snippets/gomod.json @@ -0,0 +1,37 @@ +{ + "module": { + "prefix": "mod", + "body": [ + "module ${1:github.com/org/name}" + ], + "description": "define the module path" + }, + "go": { + "prefix": "go", + "body": [ + "go ${1:1.13}" + ], + "description": "set the expected language version" + }, + "require": { + "prefix": "require", + "body": [ + "require ${1:module} ${2:version}" + ], + "description": "require a particular module at a given version or later" + }, + "exclude": { + "prefix": "exclude", + "body": [ + "exclude ${1:module} $(2:version}" + ], + "description": "exclude a particular module version from use" + }, + "replace": { + "prefix": "replace", + "body": [ + "replace ${1:module} => ${2:replace}" + ], + "description": "replace a module version with a different module version" + } +} diff --git a/coc/extensions/node_modules/coc-json/Readme.md b/coc/extensions/node_modules/coc-json/Readme.md new file mode 100644 index 0000000..9875969 --- /dev/null +++ b/coc/extensions/node_modules/coc-json/Readme.md @@ -0,0 +1,65 @@ +# coc-json + +Json language server extension for [coc.nvim](https://github.com/neoclide/coc.nvim). + +The server code is extracted from VSCode, which uses +[vscode-json-languageservice](https://www.npmjs.com/package/vscode-json-languageservice) + +For highlight of jsonc filetype, you may need [jsonc.vim](https://github.com/neoclide/jsonc.vim) + +## Install + +In your vim/neovim, run the following command: + +``` +:CocInstall coc-json +``` + +## Features + +Same as VSCode. + +All features of [vscode-json-languageservice](https://www.npmjs.com/package/vscode-json-languageservice) are supported. + +- `doCompletion` for JSON properties and values based on the document's JSON schema. +- `doHover` for values based on descriptions in the document's JSON schema. +- Document Symbols for quick navigation to properties in the document. +- Document Colors for showing color decorators on values representing colors. +- Code Formatting supporting ranges and formatting the whole document. +- Diagnostics (Validation) are pushed for all open documents + - syntax errors + - structural validation based on the document's JSON schema. + +## Commands + +- `json.retryResolveSchema`: Retry resolve schema of current buffer. + +## Configuration options + +- `json.enable` set to `false` to disable json language server. +- `json.trace.server` trace LSP traffic in output channel. +- `json.execArgv` add `execArgv` to `child_process.fork` used for start + json language server. +- `json.format.enable` set to `false` to disable format. +- `json.schemas` schema associations for json files. + +## FAQ + +### How to suppress error `[json 521] [e] Comments are not permitted in JSON`? + +You can configure your vim to make that file with jsonc filetype to allow comment. + +### How to add custom schema definitions/properties? + +You have two choices: + +- use `$schema` in your json. +- create json schema file and then configure `json.schemes` in your `coc-settings.json`, check out https://github.com/neoclide/coc-json/blob/master/package.json#L55 + +### Quotes are hidden? + +This is not caused by coc-json, you may checkout the `conceallevel` option. + +## License + +MIT diff --git a/coc/extensions/node_modules/coc-json/esbuild.js b/coc/extensions/node_modules/coc-json/esbuild.js new file mode 100644 index 0000000..d0caa01 --- /dev/null +++ b/coc/extensions/node_modules/coc-json/esbuild.js @@ -0,0 +1,50 @@ +const path = require('path') + +let entryPlugin = { + name: 'entry', + setup(build) { + build.onResolve({filter: /^(index|server)\.ts$/}, args => { + return { + path: args.path, + namespace: 'entry-ns' + } + }) + build.onLoad({filter: /.*/, namespace: 'entry-ns'}, args => { + let contents = '' + if (args.path == 'index.ts') { + contents = ` + import {activate} from './src/index' + export {activate} + ` + } else if (args.path == 'server.ts') { + contents = `require('./server/node/jsonServerMain')` + } else { + throw new Error('Bad path') + } + return { + contents, + resolveDir: __dirname + } + }) + } +} + +async function start() { + await require('esbuild').build({ + entryPoints: ['index.ts', 'server.ts'], + define: {'process.env.NODE_ENV': JSON.stringify("production")}, + bundle: true, + platform: 'node', + target: 'node12.16', + mainFields: ['module', 'main'], + minify: true, + sourcemap: true, + external: ['coc.nvim'], + outdir: path.resolve(__dirname, 'lib'), + plugins: [entryPlugin] + }) +} + +start().catch(e => { + console.error(e) +}) diff --git a/coc/extensions/node_modules/coc-json/lib/index.js b/coc/extensions/node_modules/coc-json/lib/index.js new file mode 100644 index 0000000..89fbd95 --- /dev/null +++ b/coc/extensions/node_modules/coc-json/lib/index.js @@ -0,0 +1,34 @@ +var us=Object.create,At=Object.defineProperty,ls=Object.getPrototypeOf,fs=Object.prototype.hasOwnProperty,ds=Object.getOwnPropertyNames,ps=Object.getOwnPropertyDescriptor;var Ir=e=>At(e,"__esModule",{value:!0});var M=(e,t)=>()=>(t||(t={exports:{}},e(t.exports,t)),t.exports),Lr=(e,t)=>{Ir(e);for(var r in t)At(e,r,{get:t[r],enumerable:!0})},hs=(e,t,r)=>{if(Ir(e),t&&typeof t=="object"||typeof t=="function")for(let n of ds(t))!fs.call(e,n)&&n!=="default"&&At(e,n,{get:()=>t[n],enumerable:!(r=ps(t,n))||r.enumerable});return e},Ve=e=>e&&e.__esModule?e:hs(At(e!=null?us(ls(e)):{},"default",{value:e,enumerable:!0}),e);var Jr=M((Vu,Fr)=>{"use strict";Fr.exports=e=>{if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return e.charCodeAt(0)===65279?e.slice(1):e}});var Re=M(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});var cn;function un(){if(cn===void 0)throw new Error("No runtime abstraction layer installed");return cn}(function(e){function t(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");cn=r}e.install=t})(un||(un={}));an.default=un});var ln=M(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.Disposable=void 0;var ms;(function(e){function t(r){return{dispose:r}}e.create=t})(ms=dt.Disposable||(dt.Disposable={}))});var zr=M(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.AbstractMessageBuffer=void 0;var gs=13,ys=10,js=`\r +`,Wr=class{constructor(t="utf-8"){this._encoding=t,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(t){let r=typeof t=="string"?this.fromString(t,this._encoding):t;this._chunks.push(r),this._totalLength+=r.byteLength}tryReadHeaders(){if(this._chunks.length===0)return;let t=0,r=0,n=0,o=0;e:for(;rthis._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let s=this._chunks[0];return this._chunks.shift(),this._totalLength-=t,this.asNative(s)}if(this._chunks[0].byteLength>t){let s=this._chunks[0],c=this.asNative(s,t);return this._chunks[0]=s.slice(t),this._totalLength-=t,c}let r=this.allocNative(t),n=0,o=0;for(;t>0;){let s=this._chunks[o];if(s.byteLength>t){let c=s.slice(0,t);r.set(c,n),n+=t,this._chunks[o]=s.slice(t),this._totalLength-=t,t-=t}else r.set(s,n),n+=s.byteLength,this._chunks.shift(),this._totalLength-=s.byteLength,t-=s.byteLength}return r}};It.AbstractMessageBuffer=Wr});var Gr=M(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});var bs=Re(),$r=require("util"),Le=ln(),vs=zr(),pt=class extends vs.AbstractMessageBuffer{constructor(t="utf-8"){super(t)}emptyBuffer(){return pt.emptyBuffer}fromString(t,r){return Buffer.from(t,r)}toString(t,r){return t instanceof Buffer?t.toString(r):new $r.TextDecoder(r).decode(t)}asNative(t,r){return r===void 0?t instanceof Buffer?t:Buffer.from(t):t instanceof Buffer?t.slice(0,r):Buffer.from(t,0,r)}allocNative(t){return Buffer.allocUnsafe(t)}};pt.emptyBuffer=Buffer.allocUnsafe(0);var Br=class{constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),Le.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),Le.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),Le.Disposable.create(()=>this.stream.off("end",t))}onData(t){return this.stream.on("data",t),Le.Disposable.create(()=>this.stream.off("data",t))}},Ur=class{constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),Le.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),Le.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),Le.Disposable.create(()=>this.stream.off("end",t))}write(t,r){return new Promise((n,o)=>{let s=c=>{c==null?n():o(c)};typeof t=="string"?this.stream.write(t,r,s):this.stream.write(t,s)})}end(){this.stream.end()}},Hr=Object.freeze({messageBuffer:Object.freeze({create:e=>new pt(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(e,void 0,0),t.charset))}catch(r){return Promise.reject(r)}}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{try{return e instanceof Buffer?Promise.resolve(JSON.parse(e.toString(t.charset))):Promise.resolve(JSON.parse(new $r.TextDecoder(t.charset).decode(e)))}catch(r){return Promise.reject(r)}}})}),stream:Object.freeze({asReadableStream:e=>new Br(e),asWritableStream:e=>new Ur(e)}),console,timer:Object.freeze({setTimeout(e,t,...r){return setTimeout(e,t,...r)},clearTimeout(e){clearTimeout(e)},setImmediate(e,...t){return setImmediate(e,...t)},clearImmediate(e){clearImmediate(e)}})});function dn(){return Hr}(function(e){function t(){bs.default.install(Hr)}e.install=t})(dn||(dn={}));fn.default=dn});var Ye=M(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.stringArray=te.array=te.func=te.error=te.number=te.string=te.boolean=void 0;function Ss(e){return e===!0||e===!1}te.boolean=Ss;function Vr(e){return typeof e=="string"||e instanceof String}te.string=Vr;function Rs(e){return typeof e=="number"||e instanceof Number}te.number=Rs;function ws(e){return e instanceof Error}te.error=ws;function _s(e){return typeof e=="function"}te.func=_s;function Yr(e){return Array.isArray(e)}te.array=Yr;function ks(e){return Yr(e)&&e.every(t=>Vr(t))}te.stringArray=ks});var pn=M(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.isResponseMessage=y.isNotificationMessage=y.isRequestMessage=y.NotificationType9=y.NotificationType8=y.NotificationType7=y.NotificationType6=y.NotificationType5=y.NotificationType4=y.NotificationType3=y.NotificationType2=y.NotificationType1=y.NotificationType0=y.NotificationType=y.RequestType9=y.RequestType8=y.RequestType7=y.RequestType6=y.RequestType5=y.RequestType4=y.RequestType3=y.RequestType2=y.RequestType1=y.RequestType=y.RequestType0=y.AbstractMessageSignature=y.ParameterStructures=y.ResponseError=y.ErrorCodes=void 0;var Fe=Ye(),Qr;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=e.jsonrpcReservedErrorRangeStart,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=e.jsonrpcReservedErrorRangeEnd})(Qr=y.ErrorCodes||(y.ErrorCodes={}));var Lt=class extends Error{constructor(t,r,n){super(r);this.code=Fe.number(t)?t:Qr.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,Lt.prototype)}toJson(){return{code:this.code,message:this.message,data:this.data}}};y.ResponseError=Lt;var K=class{constructor(t){this.kind=t}static is(t){return t===K.auto||t===K.byName||t===K.byPosition}toString(){return this.kind}};y.ParameterStructures=K;K.auto=new K("auto");K.byPosition=new K("byPosition");K.byName=new K("byName");var J=class{constructor(t,r){this.method=t,this.numberOfParams=r}get parameterStructures(){return K.auto}};y.AbstractMessageSignature=J;var Xr=class extends J{constructor(t){super(t,0)}};y.RequestType0=Xr;var Zr=class extends J{constructor(t,r=K.auto){super(t,1);this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};y.RequestType=Zr;var Kr=class extends J{constructor(t,r=K.auto){super(t,1);this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};y.RequestType1=Kr;var eo=class extends J{constructor(t){super(t,2)}};y.RequestType2=eo;var to=class extends J{constructor(t){super(t,3)}};y.RequestType3=to;var no=class extends J{constructor(t){super(t,4)}};y.RequestType4=no;var ro=class extends J{constructor(t){super(t,5)}};y.RequestType5=ro;var oo=class extends J{constructor(t){super(t,6)}};y.RequestType6=oo;var io=class extends J{constructor(t){super(t,7)}};y.RequestType7=io;var so=class extends J{constructor(t){super(t,8)}};y.RequestType8=so;var ao=class extends J{constructor(t){super(t,9)}};y.RequestType9=ao;var co=class extends J{constructor(t,r=K.auto){super(t,1);this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};y.NotificationType=co;var uo=class extends J{constructor(t){super(t,0)}};y.NotificationType0=uo;var lo=class extends J{constructor(t,r=K.auto){super(t,1);this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};y.NotificationType1=lo;var fo=class extends J{constructor(t){super(t,2)}};y.NotificationType2=fo;var po=class extends J{constructor(t){super(t,3)}};y.NotificationType3=po;var ho=class extends J{constructor(t){super(t,4)}};y.NotificationType4=ho;var mo=class extends J{constructor(t){super(t,5)}};y.NotificationType5=mo;var go=class extends J{constructor(t){super(t,6)}};y.NotificationType6=go;var yo=class extends J{constructor(t){super(t,7)}};y.NotificationType7=yo;var jo=class extends J{constructor(t){super(t,8)}};y.NotificationType8=jo;var bo=class extends J{constructor(t){super(t,9)}};y.NotificationType9=bo;function Ms(e){let t=e;return t&&Fe.string(t.method)&&(Fe.string(t.id)||Fe.number(t.id))}y.isRequestMessage=Ms;function Cs(e){let t=e;return t&&Fe.string(t.method)&&e.id===void 0}y.isNotificationMessage=Cs;function Ps(e){let t=e;return t&&(t.result!==void 0||!!t.error)&&(Fe.string(t.id)||Fe.number(t.id)||t.id===null)}y.isResponseMessage=Ps});var Qe=M(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.Emitter=Je.Event=void 0;var Ts=Re(),Ns;(function(e){let t={dispose(){}};e.None=function(){return t}})(Ns=Je.Event||(Je.Event={}));var vo=class{add(t,r=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(t),this._contexts.push(r),Array.isArray(n)&&n.push({dispose:()=>this.remove(t,r)})}remove(t,r=null){if(!this._callbacks)return;let n=!1;for(let o=0,s=this._callbacks.length;o{this._callbacks||(this._callbacks=new vo),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,r);let o={dispose:()=>{!this._callbacks||(this._callbacks.remove(t,r),o.dispose=ht._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(o),o}),this._event}fire(t){this._callbacks&&this._callbacks.invoke.call(this._callbacks,t)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};Je.Emitter=ht;ht._noop=function(){}});var yn=M(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.CancellationTokenSource=We.CancellationToken=void 0;var So=Re(),xs=Ye(),hn=Qe(),mn;(function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:hn.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:hn.Event.None});function t(r){let n=r;return n&&(n===e.None||n===e.Cancelled||xs.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}e.is=t})(mn=We.CancellationToken||(We.CancellationToken={}));var qs=Object.freeze(function(e,t){let r=So.default().timer.setTimeout(e.bind(t),0);return{dispose(){So.default().timer.clearTimeout(r)}}}),gn=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?qs:(this._emitter||(this._emitter=new hn.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Ro=class{get token(){return this._token||(this._token=new gn),this._token}cancel(){this._token?this._token.cancel():this._token=mn.Cancelled}dispose(){this._token?this._token instanceof gn&&this._token.dispose():this._token=mn.None}};We.CancellationTokenSource=Ro});var _o=M(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.ReadableStreamMessageReader=we.AbstractMessageReader=we.MessageReader=void 0;var Ft=Re(),Xe=Ye(),jn=Qe(),Os;(function(e){function t(r){let n=r;return n&&Xe.func(n.listen)&&Xe.func(n.dispose)&&Xe.func(n.onError)&&Xe.func(n.onClose)&&Xe.func(n.onPartialMessage)}e.is=t})(Os=we.MessageReader||(we.MessageReader={}));var bn=class{constructor(){this.errorEmitter=new jn.Emitter,this.closeEmitter=new jn.Emitter,this.partialMessageEmitter=new jn.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t){this.errorEmitter.fire(this.asError(t))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(t){this.partialMessageEmitter.fire(t)}asError(t){return t instanceof Error?t:new Error(`Reader received error. Reason: ${Xe.string(t.message)?t.message:"unknown"}`)}};we.AbstractMessageReader=bn;var vn;(function(e){function t(r){var n;let o,s,c,p=new Map,g,m=new Map;if(r===void 0||typeof r=="string")o=r!=null?r:"utf-8";else{if(o=(n=r.charset)!==null&&n!==void 0?n:"utf-8",r.contentDecoder!==void 0&&(c=r.contentDecoder,p.set(c.name,c)),r.contentDecoders!==void 0)for(let b of r.contentDecoders)p.set(b.name,b);if(r.contentTypeDecoder!==void 0&&(g=r.contentTypeDecoder,m.set(g.name,g)),r.contentTypeDecoders!==void 0)for(let b of r.contentTypeDecoders)m.set(b.name,b)}return g===void 0&&(g=Ft.default().applicationJson.decoder,m.set(g.name,g)),{charset:o,contentDecoder:c,contentDecoders:p,contentTypeDecoder:g,contentTypeDecoders:m}}e.fromOptions=t})(vn||(vn={}));var wo=class extends bn{constructor(t,r){super();this.readable=t,this.options=vn.fromOptions(r),this.buffer=Ft.default().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0}set partialMessageTimeout(t){this._partialMessageTimeout=t}get partialMessageTimeout(){return this._partialMessageTimeout}listen(t){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=t;let r=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),r}onData(t){for(this.buffer.append(t);;){if(this.nextMessageLength===-1){let o=this.buffer.tryReadHeaders();if(!o)return;let s=o.get("Content-Length");if(!s)throw new Error("Header must provide a Content-Length property.");let c=parseInt(s);if(isNaN(c))throw new Error("Content-Length value must be a number.");this.nextMessageLength=c}let r=this.buffer.tryReadBody(this.nextMessageLength);if(r===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1;let n;this.options.contentDecoder!==void 0?n=this.options.contentDecoder.decode(r):n=Promise.resolve(r),n.then(o=>{this.options.contentTypeDecoder.decode(o,this.options).then(s=>{this.callback(s)},s=>{this.fireError(s)})},o=>{this.fireError(o)})}}clearPartialMessageTimer(){this.partialMessageTimer&&(Ft.default().timer.clearTimeout(this.partialMessageTimer),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=Ft.default().timer.setTimeout((t,r)=>{this.partialMessageTimer=void 0,t===this.messageToken&&(this.firePartialMessage({messageToken:t,waitingTime:r}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};we.ReadableStreamMessageReader=wo});var Mo=M(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.Semaphore=void 0;var Ds=Re(),ko=class{constructor(t=1){if(t<=0)throw new Error("Capacity must be greater than 0");this._capacity=t,this._active=0,this._waiting=[]}lock(t){return new Promise((r,n)=>{this._waiting.push({thunk:t,resolve:r,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||Ds.default().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let t=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let r=t.thunk();r instanceof Promise?r.then(n=>{this._active--,t.resolve(n),this.runNext()},n=>{this._active--,t.reject(n),this.runNext()}):(this._active--,t.resolve(r),this.runNext())}catch(r){this._active--,t.reject(r),this.runNext()}}};Jt.Semaphore=ko});var xo=M(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.WriteableStreamMessageWriter=_e.AbstractMessageWriter=_e.MessageWriter=void 0;var Co=Re(),mt=Ye(),Es=Mo(),Po=Qe(),As="Content-Length: ",To=`\r +`,Is;(function(e){function t(r){let n=r;return n&&mt.func(n.dispose)&&mt.func(n.onClose)&&mt.func(n.onError)&&mt.func(n.write)}e.is=t})(Is=_e.MessageWriter||(_e.MessageWriter={}));var Sn=class{constructor(){this.errorEmitter=new Po.Emitter,this.closeEmitter=new Po.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t,r,n){this.errorEmitter.fire([this.asError(t),r,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(t){return t instanceof Error?t:new Error(`Writer received error. Reason: ${mt.string(t.message)?t.message:"unknown"}`)}};_e.AbstractMessageWriter=Sn;var Rn;(function(e){function t(r){var n,o;return r===void 0||typeof r=="string"?{charset:r!=null?r:"utf-8",contentTypeEncoder:Co.default().applicationJson.encoder}:{charset:(n=r.charset)!==null&&n!==void 0?n:"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:(o=r.contentTypeEncoder)!==null&&o!==void 0?o:Co.default().applicationJson.encoder}}e.fromOptions=t})(Rn||(Rn={}));var No=class extends Sn{constructor(t,r){super();this.writable=t,this.options=Rn.fromOptions(r),this.errorCount=0,this.writeSemaphore=new Es.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(t){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(t,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let o=[];return o.push(As,n.byteLength.toString(),To),o.push(To),this.doWrite(t,o,n)},n=>{throw this.fireError(n),n}))}async doWrite(t,r,n){try{return await this.writable.write(r.join(""),"ascii"),this.writable.write(n)}catch(o){return this.handleError(o,t),Promise.reject(o)}}handleError(t,r){this.errorCount++,this.fireError(t,r,this.errorCount)}end(){this.writable.end()}};_e.WriteableStreamMessageWriter=No});var Oo=M(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.LRUCache=ke.LinkedMap=ke.Touch=void 0;var ne;(function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last})(ne=ke.Touch||(ke.Touch={}));var wn=class{constructor(){this[Symbol.toStringTag]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var t;return(t=this._head)===null||t===void 0?void 0:t.value}get last(){var t;return(t=this._tail)===null||t===void 0?void 0:t.value}has(t){return this._map.has(t)}get(t,r=ne.None){let n=this._map.get(t);if(!!n)return r!==ne.None&&this.touch(n,r),n.value}set(t,r,n=ne.None){let o=this._map.get(t);if(o)o.value=r,n!==ne.None&&this.touch(o,n);else{switch(o={key:t,value:r,next:void 0,previous:void 0},n){case ne.None:this.addItemLast(o);break;case ne.First:this.addItemFirst(o);break;case ne.Last:this.addItemLast(o);break;default:this.addItemLast(o);break}this._map.set(t,o),this._size++}return this}delete(t){return!!this.remove(t)}remove(t){let r=this._map.get(t);if(!!r)return this._map.delete(t),this.removeItem(r),this._size--,r.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let t=this._head;return this._map.delete(t.key),this.removeItem(t),this._size--,t.value}forEach(t,r){let n=this._state,o=this._head;for(;o;){if(r?t.bind(r)(o.value,o.key,this):t(o.value,o.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let t=this,r=this._state,n=this._head,o={[Symbol.iterator](){return o},next(){if(t._state!==r)throw new Error("LinkedMap got modified during iteration.");if(n){let s={value:n.key,done:!1};return n=n.next,s}else return{value:void 0,done:!0}}};return o}values(){let t=this,r=this._state,n=this._head,o={[Symbol.iterator](){return o},next(){if(t._state!==r)throw new Error("LinkedMap got modified during iteration.");if(n){let s={value:n.value,done:!1};return n=n.next,s}else return{value:void 0,done:!0}}};return o}entries(){let t=this,r=this._state,n=this._head,o={[Symbol.iterator](){return o},next(){if(t._state!==r)throw new Error("LinkedMap got modified during iteration.");if(n){let s={value:[n.key,n.value],done:!1};return n=n.next,s}else return{value:void 0,done:!0}}};return o}[Symbol.iterator](){return this.entries()}trimOld(t){if(t>=this.size)return;if(t===0){this.clear();return}let r=this._head,n=this.size;for(;r&&n>t;)this._map.delete(r.key),r=r.next,n--;this._head=r,this._size=n,r&&(r.previous=void 0),this._state++}addItemFirst(t){if(!this._head&&!this._tail)this._tail=t;else if(this._head)t.next=this._head,this._head.previous=t;else throw new Error("Invalid list");this._head=t,this._state++}addItemLast(t){if(!this._head&&!this._tail)this._head=t;else if(this._tail)t.previous=this._tail,this._tail.next=t;else throw new Error("Invalid list");this._tail=t,this._state++}removeItem(t){if(t===this._head&&t===this._tail)this._head=void 0,this._tail=void 0;else if(t===this._head){if(!t.next)throw new Error("Invalid list");t.next.previous=void 0,this._head=t.next}else if(t===this._tail){if(!t.previous)throw new Error("Invalid list");t.previous.next=void 0,this._tail=t.previous}else{let r=t.next,n=t.previous;if(!r||!n)throw new Error("Invalid list");r.previous=n,n.next=r}t.next=void 0,t.previous=void 0,this._state++}touch(t,r){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(r!==ne.First&&r!==ne.Last)){if(r===ne.First){if(t===this._head)return;let n=t.next,o=t.previous;t===this._tail?(o.next=void 0,this._tail=o):(n.previous=o,o.next=n),t.previous=void 0,t.next=this._head,this._head.previous=t,this._head=t,this._state++}else if(r===ne.Last){if(t===this._tail)return;let n=t.next,o=t.previous;t===this._head?(n.previous=void 0,this._head=n):(n.previous=o,o.next=n),t.next=void 0,t.previous=this._tail,this._tail.next=t,this._tail=t,this._state++}}}toJSON(){let t=[];return this.forEach((r,n)=>{t.push([n,r])}),t}fromJSON(t){this.clear();for(let[r,n]of t)this.set(r,n)}};ke.LinkedMap=wn;var qo=class extends wn{constructor(t,r=1){super();this._limit=t,this._ratio=Math.min(Math.max(0,r),1)}get limit(){return this._limit}set limit(t){this._limit=t,this.checkTrim()}get ratio(){return this._ratio}set ratio(t){this._ratio=Math.min(Math.max(0,t),1),this.checkTrim()}get(t,r=ne.AsNew){return super.get(t,r)}peek(t){return super.get(t,ne.None)}set(t,r){return super.set(t,r,ne.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};ke.LRUCache=qo});var Fo=M(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.createMessageConnection=w.ConnectionOptions=w.CancellationStrategy=w.CancellationSenderStrategy=w.CancellationReceiverStrategy=w.ConnectionStrategy=w.ConnectionError=w.ConnectionErrors=w.LogTraceNotification=w.SetTraceNotification=w.TraceFormat=w.Trace=w.NullLogger=w.ProgressType=void 0;var Do=Re(),Q=Ye(),v=pn(),Eo=Oo(),gt=Qe(),_n=yn(),yt;(function(e){e.type=new v.NotificationType("$/cancelRequest")})(yt||(yt={}));var Wt;(function(e){e.type=new v.NotificationType("$/progress")})(Wt||(Wt={}));var Ao=class{constructor(){}};w.ProgressType=Ao;var kn;(function(e){function t(r){return Q.func(r)}e.is=t})(kn||(kn={}));w.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var U;(function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Verbose=2]="Verbose"})(U=w.Trace||(w.Trace={}));(function(e){function t(n){if(!Q.string(n))return e.Off;switch(n=n.toLowerCase(),n){case"off":return e.Off;case"messages":return e.Messages;case"verbose":return e.Verbose;default:return e.Off}}e.fromString=t;function r(n){switch(n){case e.Off:return"off";case e.Messages:return"messages";case e.Verbose:return"verbose";default:return"off"}}e.toString=r})(U=w.Trace||(w.Trace={}));var le;(function(e){e.Text="text",e.JSON="json"})(le=w.TraceFormat||(w.TraceFormat={}));(function(e){function t(r){return r=r.toLowerCase(),r==="json"?e.JSON:e.Text}e.fromString=t})(le=w.TraceFormat||(w.TraceFormat={}));var Io;(function(e){e.type=new v.NotificationType("$/setTrace")})(Io=w.SetTraceNotification||(w.SetTraceNotification={}));var Mn;(function(e){e.type=new v.NotificationType("$/logTrace")})(Mn=w.LogTraceNotification||(w.LogTraceNotification={}));var zt;(function(e){e[e.Closed=1]="Closed",e[e.Disposed=2]="Disposed",e[e.AlreadyListening=3]="AlreadyListening"})(zt=w.ConnectionErrors||(w.ConnectionErrors={}));var ze=class extends Error{constructor(t,r){super(r);this.code=t,Object.setPrototypeOf(this,ze.prototype)}};w.ConnectionError=ze;var Lo;(function(e){function t(r){let n=r;return n&&Q.func(n.cancelUndispatched)}e.is=t})(Lo=w.ConnectionStrategy||(w.ConnectionStrategy={}));var Cn;(function(e){e.Message=Object.freeze({createCancellationTokenSource(r){return new _n.CancellationTokenSource}});function t(r){let n=r;return n&&Q.func(n.createCancellationTokenSource)}e.is=t})(Cn=w.CancellationReceiverStrategy||(w.CancellationReceiverStrategy={}));var Pn;(function(e){e.Message=Object.freeze({sendCancellation(r,n){r.sendNotification(yt.type,{id:n})},cleanup(r){}});function t(r){let n=r;return n&&Q.func(n.sendCancellation)&&Q.func(n.cleanup)}e.is=t})(Pn=w.CancellationSenderStrategy||(w.CancellationSenderStrategy={}));var Tn;(function(e){e.Message=Object.freeze({receiver:Cn.Message,sender:Pn.Message});function t(r){let n=r;return n&&Cn.is(n.receiver)&&Pn.is(n.sender)}e.is=t})(Tn=w.CancellationStrategy||(w.CancellationStrategy={}));var Ls;(function(e){function t(r){let n=r;return n&&(Tn.is(n.cancellationStrategy)||Lo.is(n.connectionStrategy))}e.is=t})(Ls=w.ConnectionOptions||(w.ConnectionOptions={}));var fe;(function(e){e[e.New=1]="New",e[e.Listening=2]="Listening",e[e.Closed=3]="Closed",e[e.Disposed=4]="Disposed"})(fe||(fe={}));function Fs(e,t,r,n){let o=r!==void 0?r:w.NullLogger,s=0,c=0,p=0,g="2.0",m,b=Object.create(null),_,S=Object.create(null),h=new Map,A,q=new Eo.LinkedMap,C=Object.create(null),F=Object.create(null),O=U.Off,oe=le.Text,D,ie=fe.New,ce=new gt.Emitter,ye=new gt.Emitter,Ee=new gt.Emitter,Ae=new gt.Emitter,ve=new gt.Emitter,Se=n&&n.cancellationStrategy?n.cancellationStrategy:Tn.Message;function Dt(a){if(a===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+a.toString()}function on(a){return a===null?"res-unknown-"+(++p).toString():"res-"+a.toString()}function Hi(){return"not-"+(++c).toString()}function Gi(a,l){v.isRequestMessage(l)?a.set(Dt(l.id),l):v.isResponseMessage(l)?a.set(on(l.id),l):a.set(Hi(),l)}function Tr(a){}function Nr(){return ie===fe.Listening}function xr(){return ie===fe.Closed}function Ue(){return ie===fe.Disposed}function qr(){(ie===fe.New||ie===fe.Listening)&&(ie=fe.Closed,ye.fire(void 0))}function Vi(a){ce.fire([a,void 0,void 0])}function Yi(a){ce.fire(a)}e.onClose(qr),e.onError(Vi),t.onClose(qr),t.onError(Yi);function Or(){A||q.size===0||(A=Do.default().timer.setImmediate(()=>{A=void 0,Qi()}))}function Qi(){if(q.size===0)return;let a=q.shift();try{v.isRequestMessage(a)?Zi(a):v.isNotificationMessage(a)?es(a):v.isResponseMessage(a)?Ki(a):ts(a)}finally{Or()}}let Xi=a=>{try{if(v.isNotificationMessage(a)&&a.method===yt.type.method){let l=Dt(a.params.id),d=q.get(l);if(v.isRequestMessage(d)){let j=n==null?void 0:n.connectionStrategy,P=j&&j.cancelUndispatched?j.cancelUndispatched(d,Tr):Tr(d);if(P&&(P.error!==void 0||P.result!==void 0)){q.delete(l),P.id=d.id,Et(P,a.method,Date.now()),t.write(P);return}}}Gi(q,a)}finally{Or()}};function Zi(a){if(Ue())return;function l(N,$,x){let V={jsonrpc:g,id:a.id};N instanceof v.ResponseError?V.error=N.toJson():V.result=N===void 0?null:N,Et(V,$,x),t.write(V)}function d(N,$,x){let V={jsonrpc:g,id:a.id,error:N.toJson()};Et(V,$,x),t.write(V)}function j(N,$,x){N===void 0&&(N=null);let V={jsonrpc:g,id:a.id,result:N};Et(V,$,x),t.write(V)}os(a);let P=b[a.method],z,G;P&&(z=P.type,G=P.handler);let Y=Date.now();if(G||m){let N=String(a.id),$=Se.receiver.createCancellationTokenSource(N);F[N]=$;try{let x;if(G)if(a.params===void 0){if(z!==void 0&&z.numberOfParams!==0){d(new v.ResponseError(v.ErrorCodes.InvalidParams,`Request ${a.method} defines ${z.numberOfParams} params but recevied none.`),a.method,Y);return}x=G($.token)}else if(Array.isArray(a.params)){if(z!==void 0&&z.parameterStructures===v.ParameterStructures.byName){d(new v.ResponseError(v.ErrorCodes.InvalidParams,`Request ${a.method} defines parameters by name but received parameters by position`),a.method,Y);return}x=G(...a.params,$.token)}else{if(z!==void 0&&z.parameterStructures===v.ParameterStructures.byPosition){d(new v.ResponseError(v.ErrorCodes.InvalidParams,`Request ${a.method} defines parameters by position but received parameters by name`),a.method,Y);return}x=G(a.params,$.token)}else m&&(x=m(a.method,a.params,$.token));let V=x;x?V.then?V.then(se=>{delete F[N],l(se,a.method,Y)},se=>{delete F[N],se instanceof v.ResponseError?d(se,a.method,Y):se&&Q.string(se.message)?d(new v.ResponseError(v.ErrorCodes.InternalError,`Request ${a.method} failed with message: ${se.message}`),a.method,Y):d(new v.ResponseError(v.ErrorCodes.InternalError,`Request ${a.method} failed unexpectedly without providing any details.`),a.method,Y)}):(delete F[N],l(x,a.method,Y)):(delete F[N],j(x,a.method,Y))}catch(x){delete F[N],x instanceof v.ResponseError?l(x,a.method,Y):x&&Q.string(x.message)?d(new v.ResponseError(v.ErrorCodes.InternalError,`Request ${a.method} failed with message: ${x.message}`),a.method,Y):d(new v.ResponseError(v.ErrorCodes.InternalError,`Request ${a.method} failed unexpectedly without providing any details.`),a.method,Y)}}else d(new v.ResponseError(v.ErrorCodes.MethodNotFound,`Unhandled method ${a.method}`),a.method,Y)}function Ki(a){if(!Ue())if(a.id===null)a.error?o.error(`Received response message without id: Error is: +${JSON.stringify(a.error,void 0,4)}`):o.error("Received response message without id. No further error information provided.");else{let l=String(a.id),d=C[l];if(ss(a,d),d){delete C[l];try{if(a.error){let j=a.error;d.reject(new v.ResponseError(j.code,j.message,j.data))}else if(a.result!==void 0)d.resolve(a.result);else throw new Error("Should never happen.")}catch(j){j.message?o.error(`Response handler '${d.method}' failed with message: ${j.message}`):o.error(`Response handler '${d.method}' failed unexpectedly.`)}}}}function es(a){if(Ue())return;let l,d;if(a.method===yt.type.method)d=j=>{let P=j.id,z=F[String(P)];z&&z.cancel()};else{let j=S[a.method];j&&(d=j.handler,l=j.type)}if(d||_)try{is(a),d?a.params===void 0?(l!==void 0&&l.numberOfParams!==0&&l.parameterStructures!==v.ParameterStructures.byName&&o.error(`Notification ${a.method} defines ${l.numberOfParams} params but recevied none.`),d()):Array.isArray(a.params)?(l!==void 0&&(l.parameterStructures===v.ParameterStructures.byName&&o.error(`Notification ${a.method} defines parameters by name but received parameters by position`),l.numberOfParams!==a.params.length&&o.error(`Notification ${a.method} defines ${l.numberOfParams} params but received ${a.params.length} argumennts`)),d(...a.params)):(l!==void 0&&l.parameterStructures===v.ParameterStructures.byPosition&&o.error(`Notification ${a.method} defines parameters by position but received parameters by name`),d(a.params)):_&&_(a.method,a.params)}catch(j){j.message?o.error(`Notification handler '${a.method}' failed with message: ${j.message}`):o.error(`Notification handler '${a.method}' failed unexpectedly.`)}else Ee.fire(a)}function ts(a){if(!a){o.error("Received empty message.");return}o.error(`Received message which is neither a response nor a notification message: +${JSON.stringify(a,null,4)}`);let l=a;if(Q.string(l.id)||Q.number(l.id)){let d=String(l.id),j=C[d];j&&j.reject(new Error("The received response has neither a result nor an error property."))}}function ns(a){if(!(O===U.Off||!D))if(oe===le.Text){let l;O===U.Verbose&&a.params&&(l=`Params: ${JSON.stringify(a.params,null,4)} + +`),D.log(`Sending request '${a.method} - (${a.id})'.`,l)}else He("send-request",a)}function rs(a){if(!(O===U.Off||!D))if(oe===le.Text){let l;O===U.Verbose&&(a.params?l=`Params: ${JSON.stringify(a.params,null,4)} + +`:l=`No parameters provided. + +`),D.log(`Sending notification '${a.method}'.`,l)}else He("send-notification",a)}function Et(a,l,d){if(!(O===U.Off||!D))if(oe===le.Text){let j;O===U.Verbose&&(a.error&&a.error.data?j=`Error data: ${JSON.stringify(a.error.data,null,4)} + +`:a.result?j=`Result: ${JSON.stringify(a.result,null,4)} + +`:a.error===void 0&&(j=`No result returned. + +`)),D.log(`Sending response '${l} - (${a.id})'. Processing request took ${Date.now()-d}ms`,j)}else He("send-response",a)}function os(a){if(!(O===U.Off||!D))if(oe===le.Text){let l;O===U.Verbose&&a.params&&(l=`Params: ${JSON.stringify(a.params,null,4)} + +`),D.log(`Received request '${a.method} - (${a.id})'.`,l)}else He("receive-request",a)}function is(a){if(!(O===U.Off||!D||a.method===Mn.type.method))if(oe===le.Text){let l;O===U.Verbose&&(a.params?l=`Params: ${JSON.stringify(a.params,null,4)} + +`:l=`No parameters provided. + +`),D.log(`Received notification '${a.method}'.`,l)}else He("receive-notification",a)}function ss(a,l){if(!(O===U.Off||!D))if(oe===le.Text){let d;if(O===U.Verbose&&(a.error&&a.error.data?d=`Error data: ${JSON.stringify(a.error.data,null,4)} + +`:a.result?d=`Result: ${JSON.stringify(a.result,null,4)} + +`:a.error===void 0&&(d=`No result returned. + +`)),l){let j=a.error?` Request failed: ${a.error.message} (${a.error.code}).`:"";D.log(`Received response '${l.method} - (${a.id})' in ${Date.now()-l.timerStart}ms.${j}`,d)}else D.log(`Received response ${a.id} without active response promise.`,d)}else He("receive-response",a)}function He(a,l){if(!D||O===U.Off)return;let d={isLSPMessage:!0,type:a,message:l,timestamp:Date.now()};D.log(d)}function lt(){if(xr())throw new ze(zt.Closed,"Connection is closed.");if(Ue())throw new ze(zt.Disposed,"Connection is disposed.")}function as(){if(Nr())throw new ze(zt.AlreadyListening,"Connection is already listening")}function cs(){if(!Nr())throw new Error("Call listen() first.")}function ft(a){return a===void 0?null:a}function Dr(a){if(a!==null)return a}function Er(a){return a!=null&&!Array.isArray(a)&&typeof a=="object"}function sn(a,l){switch(a){case v.ParameterStructures.auto:if(Er(l))return Dr(l);return[ft(l)];break;case v.ParameterStructures.byName:if(!Er(l))throw new Error("Recevied parameters by name but param is not an object literal.");return Dr(l);case v.ParameterStructures.byPosition:return[ft(l)];default:throw new Error(`Unknown parameter structure ${a.toString()}`)}}function Ar(a,l){let d,j=a.numberOfParams;switch(j){case 0:d=void 0;break;case 1:d=sn(a.parameterStructures,l[0]);break;default:d=[];for(let P=0;P{lt();let d,j;if(Q.string(a)){d=a;let z=l[0],G=0,Y=v.ParameterStructures.auto;v.ParameterStructures.is(z)&&(G=1,Y=z);let N=l.length,$=N-G;switch($){case 0:j=void 0;break;case 1:j=sn(Y,l[G]);break;default:if(Y===v.ParameterStructures.byName)throw new Error(`Recevied ${$} parameters for 'by Name' notification parameter structure.`);j=l.slice(G,N).map(x=>ft(x));break}}else{let z=l;d=a.method,j=Ar(a,z)}let P={jsonrpc:g,method:d,params:j};rs(P),t.write(P)},onNotification:(a,l)=>{lt();let d;return Q.func(a)?_=a:l&&(Q.string(a)?(d=a,S[a]={type:void 0,handler:l}):(d=a.method,S[a.method]={type:a,handler:l})),{dispose:()=>{d!==void 0?delete S[d]:_=void 0}}},onProgress:(a,l,d)=>{if(h.has(l))throw new Error(`Progress handler for token ${l} already registered`);return h.set(l,d),{dispose:()=>{h.delete(l)}}},sendProgress:(a,l,d)=>{Ge.sendNotification(Wt.type,{token:l,value:d})},onUnhandledProgress:Ae.event,sendRequest:(a,...l)=>{lt(),cs();let d,j,P;if(Q.string(a)){d=a;let N=l[0],$=l[l.length-1],x=0,V=v.ParameterStructures.auto;v.ParameterStructures.is(N)&&(x=1,V=N);let se=l.length;_n.CancellationToken.is($)&&(se=se-1,P=$);let Ie=se-x;switch(Ie){case 0:j=void 0;break;case 1:j=sn(V,l[x]);break;default:if(V===v.ParameterStructures.byName)throw new Error(`Recevied ${Ie} parameters for 'by Name' request parameter structure.`);j=l.slice(x,se).map(Ne=>ft(Ne));break}}else{let N=l;d=a.method,j=Ar(a,N);let $=a.numberOfParams;P=_n.CancellationToken.is(N[$])?N[$]:void 0}let z=s++,G;return P&&(G=P.onCancellationRequested(()=>{Se.sender.sendCancellation(Ge,z)})),new Promise((N,$)=>{let x={jsonrpc:g,id:z,method:d,params:j},V=Ne=>{N(Ne),Se.sender.cleanup(z),G==null||G.dispose()},se=Ne=>{$(Ne),Se.sender.cleanup(z),G==null||G.dispose()},Ie={method:d,timerStart:Date.now(),resolve:V,reject:se};ns(x);try{t.write(x)}catch(Ne){Ie.reject(new v.ResponseError(v.ErrorCodes.MessageWriteError,Ne.message?Ne.message:"Unknown reason")),Ie=null}Ie&&(C[String(z)]=Ie)})},onRequest:(a,l)=>{lt();let d=null;return kn.is(a)?(d=void 0,m=a):Q.string(a)?(d=null,l!==void 0&&(d=a,b[a]={handler:l,type:void 0})):l!==void 0&&(d=a.method,b[a.method]={type:a,handler:l}),{dispose:()=>{d!==null&&(d!==void 0?delete b[d]:m=void 0)}}},trace:(a,l,d)=>{let j=!1,P=le.Text;d!==void 0&&(Q.boolean(d)?j=d:(j=d.sendNotification||!1,P=d.traceFormat||le.Text)),O=a,oe=P,O===U.Off?D=void 0:D=l,j&&!xr()&&!Ue()&&Ge.sendNotification(Io.type,{value:U.toString(a)})},onError:ce.event,onClose:ye.event,onUnhandledNotification:Ee.event,onDispose:ve.event,end:()=>{t.end()},dispose:()=>{if(Ue())return;ie=fe.Disposed,ve.fire(void 0);let a=new Error("Connection got disposed.");Object.keys(C).forEach(l=>{C[l].reject(a)}),C=Object.create(null),F=Object.create(null),q=new Eo.LinkedMap,Q.func(t.dispose)&&t.dispose(),Q.func(e.dispose)&&e.dispose()},listen:()=>{lt(),as(),ie=fe.Listening,e.listen(Xi)},inspect:()=>{Do.default().console.log("inspect")}};return Ge.onNotification(Mn.type,a=>{O===U.Off||!D||D.log(a.message,O===U.Verbose?a.verbose:void 0)}),Ge.onNotification(Wt.type,a=>{let l=h.get(a.token);l?l(a.value):Ae.fire(a)}),Ge}w.createMessageConnection=Fs});var qn=M(f=>{"use strict";Object.defineProperty(f,"__esModule",{value:!0});f.CancellationSenderStrategy=f.CancellationReceiverStrategy=f.ConnectionError=f.ConnectionErrors=f.LogTraceNotification=f.SetTraceNotification=f.TraceFormat=f.Trace=f.ProgressType=f.createMessageConnection=f.NullLogger=f.ConnectionOptions=f.ConnectionStrategy=f.WriteableStreamMessageWriter=f.AbstractMessageWriter=f.MessageWriter=f.ReadableStreamMessageReader=f.AbstractMessageReader=f.MessageReader=f.CancellationToken=f.CancellationTokenSource=f.Emitter=f.Event=f.Disposable=f.ParameterStructures=f.NotificationType9=f.NotificationType8=f.NotificationType7=f.NotificationType6=f.NotificationType5=f.NotificationType4=f.NotificationType3=f.NotificationType2=f.NotificationType1=f.NotificationType0=f.NotificationType=f.ErrorCodes=f.ResponseError=f.RequestType9=f.RequestType8=f.RequestType7=f.RequestType6=f.RequestType5=f.RequestType4=f.RequestType3=f.RequestType2=f.RequestType1=f.RequestType0=f.RequestType=f.RAL=void 0;f.CancellationStrategy=void 0;var L=pn();Object.defineProperty(f,"RequestType",{enumerable:!0,get:function(){return L.RequestType}});Object.defineProperty(f,"RequestType0",{enumerable:!0,get:function(){return L.RequestType0}});Object.defineProperty(f,"RequestType1",{enumerable:!0,get:function(){return L.RequestType1}});Object.defineProperty(f,"RequestType2",{enumerable:!0,get:function(){return L.RequestType2}});Object.defineProperty(f,"RequestType3",{enumerable:!0,get:function(){return L.RequestType3}});Object.defineProperty(f,"RequestType4",{enumerable:!0,get:function(){return L.RequestType4}});Object.defineProperty(f,"RequestType5",{enumerable:!0,get:function(){return L.RequestType5}});Object.defineProperty(f,"RequestType6",{enumerable:!0,get:function(){return L.RequestType6}});Object.defineProperty(f,"RequestType7",{enumerable:!0,get:function(){return L.RequestType7}});Object.defineProperty(f,"RequestType8",{enumerable:!0,get:function(){return L.RequestType8}});Object.defineProperty(f,"RequestType9",{enumerable:!0,get:function(){return L.RequestType9}});Object.defineProperty(f,"ResponseError",{enumerable:!0,get:function(){return L.ResponseError}});Object.defineProperty(f,"ErrorCodes",{enumerable:!0,get:function(){return L.ErrorCodes}});Object.defineProperty(f,"NotificationType",{enumerable:!0,get:function(){return L.NotificationType}});Object.defineProperty(f,"NotificationType0",{enumerable:!0,get:function(){return L.NotificationType0}});Object.defineProperty(f,"NotificationType1",{enumerable:!0,get:function(){return L.NotificationType1}});Object.defineProperty(f,"NotificationType2",{enumerable:!0,get:function(){return L.NotificationType2}});Object.defineProperty(f,"NotificationType3",{enumerable:!0,get:function(){return L.NotificationType3}});Object.defineProperty(f,"NotificationType4",{enumerable:!0,get:function(){return L.NotificationType4}});Object.defineProperty(f,"NotificationType5",{enumerable:!0,get:function(){return L.NotificationType5}});Object.defineProperty(f,"NotificationType6",{enumerable:!0,get:function(){return L.NotificationType6}});Object.defineProperty(f,"NotificationType7",{enumerable:!0,get:function(){return L.NotificationType7}});Object.defineProperty(f,"NotificationType8",{enumerable:!0,get:function(){return L.NotificationType8}});Object.defineProperty(f,"NotificationType9",{enumerable:!0,get:function(){return L.NotificationType9}});Object.defineProperty(f,"ParameterStructures",{enumerable:!0,get:function(){return L.ParameterStructures}});var Js=ln();Object.defineProperty(f,"Disposable",{enumerable:!0,get:function(){return Js.Disposable}});var Jo=Qe();Object.defineProperty(f,"Event",{enumerable:!0,get:function(){return Jo.Event}});Object.defineProperty(f,"Emitter",{enumerable:!0,get:function(){return Jo.Emitter}});var Wo=yn();Object.defineProperty(f,"CancellationTokenSource",{enumerable:!0,get:function(){return Wo.CancellationTokenSource}});Object.defineProperty(f,"CancellationToken",{enumerable:!0,get:function(){return Wo.CancellationToken}});var Nn=_o();Object.defineProperty(f,"MessageReader",{enumerable:!0,get:function(){return Nn.MessageReader}});Object.defineProperty(f,"AbstractMessageReader",{enumerable:!0,get:function(){return Nn.AbstractMessageReader}});Object.defineProperty(f,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return Nn.ReadableStreamMessageReader}});var xn=xo();Object.defineProperty(f,"MessageWriter",{enumerable:!0,get:function(){return xn.MessageWriter}});Object.defineProperty(f,"AbstractMessageWriter",{enumerable:!0,get:function(){return xn.AbstractMessageWriter}});Object.defineProperty(f,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return xn.WriteableStreamMessageWriter}});var ae=Fo();Object.defineProperty(f,"ConnectionStrategy",{enumerable:!0,get:function(){return ae.ConnectionStrategy}});Object.defineProperty(f,"ConnectionOptions",{enumerable:!0,get:function(){return ae.ConnectionOptions}});Object.defineProperty(f,"NullLogger",{enumerable:!0,get:function(){return ae.NullLogger}});Object.defineProperty(f,"createMessageConnection",{enumerable:!0,get:function(){return ae.createMessageConnection}});Object.defineProperty(f,"ProgressType",{enumerable:!0,get:function(){return ae.ProgressType}});Object.defineProperty(f,"Trace",{enumerable:!0,get:function(){return ae.Trace}});Object.defineProperty(f,"TraceFormat",{enumerable:!0,get:function(){return ae.TraceFormat}});Object.defineProperty(f,"SetTraceNotification",{enumerable:!0,get:function(){return ae.SetTraceNotification}});Object.defineProperty(f,"LogTraceNotification",{enumerable:!0,get:function(){return ae.LogTraceNotification}});Object.defineProperty(f,"ConnectionErrors",{enumerable:!0,get:function(){return ae.ConnectionErrors}});Object.defineProperty(f,"ConnectionError",{enumerable:!0,get:function(){return ae.ConnectionError}});Object.defineProperty(f,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return ae.CancellationReceiverStrategy}});Object.defineProperty(f,"CancellationSenderStrategy",{enumerable:!0,get:function(){return ae.CancellationSenderStrategy}});Object.defineProperty(f,"CancellationStrategy",{enumerable:!0,get:function(){return ae.CancellationStrategy}});var Ws=Re();f.RAL=Ws.default});var tt=M(T=>{"use strict";var zs=T&&T.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),$s=T&&T.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&zs(t,e,r)};Object.defineProperty(T,"__esModule",{value:!0});T.createMessageConnection=T.createServerSocketTransport=T.createClientSocketTransport=T.createServerPipeTransport=T.createClientPipeTransport=T.generateRandomPipeName=T.StreamMessageWriter=T.StreamMessageReader=T.SocketMessageWriter=T.SocketMessageReader=T.IPCMessageWriter=T.IPCMessageReader=void 0;var Ze=Gr();Ze.default.install();var je=qn(),zo=require("path"),Bs=require("os"),Us=require("crypto"),$t=require("net");$s(qn(),T);var $o=class extends je.AbstractMessageReader{constructor(t){super();this.process=t;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose())}listen(t){return this.process.on("message",t),je.Disposable.create(()=>this.process.off("message",t))}};T.IPCMessageReader=$o;var Bo=class extends je.AbstractMessageWriter{constructor(t){super();this.process=t,this.errorCount=0;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose)}write(t){try{return typeof this.process.send=="function"&&this.process.send(t,void 0,void 0,r=>{r?(this.errorCount++,this.handleError(r,t)):this.errorCount=0}),Promise.resolve()}catch(r){return this.handleError(r,t),Promise.reject(r)}}handleError(t,r){this.errorCount++,this.fireError(t,r,this.errorCount)}end(){}};T.IPCMessageWriter=Bo;var Ke=class extends je.ReadableStreamMessageReader{constructor(t,r="utf-8"){super(Ze.default().stream.asReadableStream(t),r)}};T.SocketMessageReader=Ke;var et=class extends je.WriteableStreamMessageWriter{constructor(t,r){super(Ze.default().stream.asWritableStream(t),r);this.socket=t}dispose(){super.dispose(),this.socket.destroy()}};T.SocketMessageWriter=et;var On=class extends je.ReadableStreamMessageReader{constructor(t,r){super(Ze.default().stream.asReadableStream(t),r)}};T.StreamMessageReader=On;var Dn=class extends je.WriteableStreamMessageWriter{constructor(t,r){super(Ze.default().stream.asWritableStream(t),r)}};T.StreamMessageWriter=Dn;var Uo=process.env.XDG_RUNTIME_DIR,Hs=new Map([["linux",107],["darwin",103]]);function Gs(){let e=Us.randomBytes(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${e}-sock`;let t;Uo?t=zo.join(Uo,`vscode-ipc-${e}.sock`):t=zo.join(Bs.tmpdir(),`vscode-${e}.sock`);let r=Hs.get(process.platform);return r!==void 0&&t.length>=r&&Ze.default().console.warn(`WARNING: IPC handle "${t}" is longer than ${r} characters.`),t}T.generateRandomPipeName=Gs;function Vs(e,t="utf-8"){let r,n=new Promise((o,s)=>{r=o});return new Promise((o,s)=>{let c=$t.createServer(p=>{c.close(),r([new Ke(p,t),new et(p,t)])});c.on("error",s),c.listen(e,()=>{c.removeListener("error",s),o({onConnected:()=>n})})})}T.createClientPipeTransport=Vs;function Ys(e,t="utf-8"){let r=$t.createConnection(e);return[new Ke(r,t),new et(r,t)]}T.createServerPipeTransport=Ys;function Qs(e,t="utf-8"){let r,n=new Promise((o,s)=>{r=o});return new Promise((o,s)=>{let c=$t.createServer(p=>{c.close(),r([new Ke(p,t),new et(p,t)])});c.on("error",s),c.listen(e,"127.0.0.1",()=>{c.removeListener("error",s),o({onConnected:()=>n})})})}T.createClientSocketTransport=Qs;function Xs(e,t="utf-8"){let r=$t.createConnection(e,"127.0.0.1");return[new Ke(r,t),new et(r,t)]}T.createServerSocketTransport=Xs;function Zs(e){let t=e;return t.read!==void 0&&t.addListener!==void 0}function Ks(e){let t=e;return t.write!==void 0&&t.addListener!==void 0}function ea(e,t,r,n){r||(r=je.NullLogger);let o=Zs(e)?new On(e):e,s=Ks(t)?new Dn(t):t;return je.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),je.createMessageConnection(o,s,r,n)}T.createMessageConnection=ea});var En=M((ll,Ho)=>{"use strict";Ho.exports=tt()});var Vo=M(ta=>{Lr(ta,{AnnotatedTextEdit:()=>Ce,ChangeAnnotation:()=>$e,ChangeAnnotationIdentifier:()=>ee,CodeAction:()=>dr,CodeActionContext:()=>fr,CodeActionKind:()=>lr,CodeDescription:()=>Bn,CodeLens:()=>pr,Color:()=>Ut,ColorInformation:()=>Ln,ColorPresentation:()=>Fn,Command:()=>nt,CompletionItem:()=>Kn,CompletionItemKind:()=>Vn,CompletionItemTag:()=>Qn,CompletionList:()=>er,CreateFile:()=>rt,DeleteFile:()=>it,Diagnostic:()=>bt,DiagnosticRelatedInformation:()=>Ht,DiagnosticSeverity:()=>zn,DiagnosticTag:()=>$n,DocumentHighlight:()=>ir,DocumentHighlightKind:()=>or,DocumentLink:()=>mr,DocumentSymbol:()=>ur,EOL:()=>ra,FoldingRange:()=>Wn,FoldingRangeKind:()=>Jn,FormattingOptions:()=>hr,Hover:()=>tr,InsertReplaceEdit:()=>Xn,InsertTextFormat:()=>Yn,InsertTextMode:()=>Zn,Location:()=>Bt,LocationLink:()=>In,MarkedString:()=>Rt,MarkupContent:()=>Yt,MarkupKind:()=>st,OptionalVersionedTextDocumentIdentifier:()=>St,ParameterInformation:()=>nr,Position:()=>de,Range:()=>X,RenameFile:()=>ot,SelectionRange:()=>gr,SignatureInformation:()=>rr,SymbolInformation:()=>cr,SymbolKind:()=>sr,SymbolTag:()=>ar,TextDocument:()=>yr,TextDocumentEdit:()=>vt,TextDocumentIdentifier:()=>Un,TextDocumentItem:()=>Gn,TextEdit:()=>Me,VersionedTextDocumentIdentifier:()=>Hn,WorkspaceChange:()=>na,WorkspaceEdit:()=>Gt,integer:()=>An,uinteger:()=>jt});"use strict";var An;(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647})(An||(An={}));var jt;(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647})(jt||(jt={}));var de;(function(e){function t(n,o){return n===Number.MAX_VALUE&&(n=jt.MAX_VALUE),o===Number.MAX_VALUE&&(o=jt.MAX_VALUE),{line:n,character:o}}e.create=t;function r(n){var o=n;return u.objectLiteral(o)&&u.uinteger(o.line)&&u.uinteger(o.character)}e.is=r})(de||(de={}));var X;(function(e){function t(n,o,s,c){if(u.uinteger(n)&&u.uinteger(o)&&u.uinteger(s)&&u.uinteger(c))return{start:de.create(n,o),end:de.create(s,c)};if(de.is(n)&&de.is(o))return{start:n,end:o};throw new Error("Range#create called with invalid arguments["+n+", "+o+", "+s+", "+c+"]")}e.create=t;function r(n){var o=n;return u.objectLiteral(o)&&de.is(o.start)&&de.is(o.end)}e.is=r})(X||(X={}));var Bt;(function(e){function t(n,o){return{uri:n,range:o}}e.create=t;function r(n){var o=n;return u.defined(o)&&X.is(o.range)&&(u.string(o.uri)||u.undefined(o.uri))}e.is=r})(Bt||(Bt={}));var In;(function(e){function t(n,o,s,c){return{targetUri:n,targetRange:o,targetSelectionRange:s,originSelectionRange:c}}e.create=t;function r(n){var o=n;return u.defined(o)&&X.is(o.targetRange)&&u.string(o.targetUri)&&(X.is(o.targetSelectionRange)||u.undefined(o.targetSelectionRange))&&(X.is(o.originSelectionRange)||u.undefined(o.originSelectionRange))}e.is=r})(In||(In={}));var Ut;(function(e){function t(n,o,s,c){return{red:n,green:o,blue:s,alpha:c}}e.create=t;function r(n){var o=n;return u.numberRange(o.red,0,1)&&u.numberRange(o.green,0,1)&&u.numberRange(o.blue,0,1)&&u.numberRange(o.alpha,0,1)}e.is=r})(Ut||(Ut={}));var Ln;(function(e){function t(n,o){return{range:n,color:o}}e.create=t;function r(n){var o=n;return X.is(o.range)&&Ut.is(o.color)}e.is=r})(Ln||(Ln={}));var Fn;(function(e){function t(n,o,s){return{label:n,textEdit:o,additionalTextEdits:s}}e.create=t;function r(n){var o=n;return u.string(o.label)&&(u.undefined(o.textEdit)||Me.is(o))&&(u.undefined(o.additionalTextEdits)||u.typedArray(o.additionalTextEdits,Me.is))}e.is=r})(Fn||(Fn={}));var Jn;(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(Jn||(Jn={}));var Wn;(function(e){function t(n,o,s,c,p){var g={startLine:n,endLine:o};return u.defined(s)&&(g.startCharacter=s),u.defined(c)&&(g.endCharacter=c),u.defined(p)&&(g.kind=p),g}e.create=t;function r(n){var o=n;return u.uinteger(o.startLine)&&u.uinteger(o.startLine)&&(u.undefined(o.startCharacter)||u.uinteger(o.startCharacter))&&(u.undefined(o.endCharacter)||u.uinteger(o.endCharacter))&&(u.undefined(o.kind)||u.string(o.kind))}e.is=r})(Wn||(Wn={}));var Ht;(function(e){function t(n,o){return{location:n,message:o}}e.create=t;function r(n){var o=n;return u.defined(o)&&Bt.is(o.location)&&u.string(o.message)}e.is=r})(Ht||(Ht={}));var zn;(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(zn||(zn={}));var $n;(function(e){e.Unnecessary=1,e.Deprecated=2})($n||($n={}));var Bn;(function(e){function t(r){var n=r;return n!=null&&u.string(n.href)}e.is=t})(Bn||(Bn={}));var bt;(function(e){function t(n,o,s,c,p,g){var m={range:n,message:o};return u.defined(s)&&(m.severity=s),u.defined(c)&&(m.code=c),u.defined(p)&&(m.source=p),u.defined(g)&&(m.relatedInformation=g),m}e.create=t;function r(n){var o,s=n;return u.defined(s)&&X.is(s.range)&&u.string(s.message)&&(u.number(s.severity)||u.undefined(s.severity))&&(u.integer(s.code)||u.string(s.code)||u.undefined(s.code))&&(u.undefined(s.codeDescription)||u.string((o=s.codeDescription)===null||o===void 0?void 0:o.href))&&(u.string(s.source)||u.undefined(s.source))&&(u.undefined(s.relatedInformation)||u.typedArray(s.relatedInformation,Ht.is))}e.is=r})(bt||(bt={}));var nt;(function(e){function t(n,o){for(var s=[],c=2;c0&&(p.arguments=s),p}e.create=t;function r(n){var o=n;return u.defined(o)&&u.string(o.title)&&u.string(o.command)}e.is=r})(nt||(nt={}));var Me;(function(e){function t(s,c){return{range:s,newText:c}}e.replace=t;function r(s,c){return{range:{start:s,end:s},newText:c}}e.insert=r;function n(s){return{range:s,newText:""}}e.del=n;function o(s){var c=s;return u.objectLiteral(c)&&u.string(c.newText)&&X.is(c.range)}e.is=o})(Me||(Me={}));var $e;(function(e){function t(n,o,s){var c={label:n};return o!==void 0&&(c.needsConfirmation=o),s!==void 0&&(c.description=s),c}e.create=t;function r(n){var o=n;return o!==void 0&&u.objectLiteral(o)&&u.string(o.label)&&(u.boolean(o.needsConfirmation)||o.needsConfirmation===void 0)&&(u.string(o.description)||o.description===void 0)}e.is=r})($e||($e={}));var ee;(function(e){function t(r){var n=r;return typeof n=="string"}e.is=t})(ee||(ee={}));var Ce;(function(e){function t(s,c,p){return{range:s,newText:c,annotationId:p}}e.replace=t;function r(s,c,p){return{range:{start:s,end:s},newText:c,annotationId:p}}e.insert=r;function n(s,c){return{range:s,newText:"",annotationId:c}}e.del=n;function o(s){var c=s;return Me.is(c)&&($e.is(c.annotationId)||ee.is(c.annotationId))}e.is=o})(Ce||(Ce={}));var vt;(function(e){function t(n,o){return{textDocument:n,edits:o}}e.create=t;function r(n){var o=n;return u.defined(o)&&St.is(o.textDocument)&&Array.isArray(o.edits)}e.is=r})(vt||(vt={}));var rt;(function(e){function t(n,o,s){var c={kind:"create",uri:n};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(c.options=o),s!==void 0&&(c.annotationId=s),c}e.create=t;function r(n){var o=n;return o&&o.kind==="create"&&u.string(o.uri)&&(o.options===void 0||(o.options.overwrite===void 0||u.boolean(o.options.overwrite))&&(o.options.ignoreIfExists===void 0||u.boolean(o.options.ignoreIfExists)))&&(o.annotationId===void 0||ee.is(o.annotationId))}e.is=r})(rt||(rt={}));var ot;(function(e){function t(n,o,s,c){var p={kind:"rename",oldUri:n,newUri:o};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(p.options=s),c!==void 0&&(p.annotationId=c),p}e.create=t;function r(n){var o=n;return o&&o.kind==="rename"&&u.string(o.oldUri)&&u.string(o.newUri)&&(o.options===void 0||(o.options.overwrite===void 0||u.boolean(o.options.overwrite))&&(o.options.ignoreIfExists===void 0||u.boolean(o.options.ignoreIfExists)))&&(o.annotationId===void 0||ee.is(o.annotationId))}e.is=r})(ot||(ot={}));var it;(function(e){function t(n,o,s){var c={kind:"delete",uri:n};return o!==void 0&&(o.recursive!==void 0||o.ignoreIfNotExists!==void 0)&&(c.options=o),s!==void 0&&(c.annotationId=s),c}e.create=t;function r(n){var o=n;return o&&o.kind==="delete"&&u.string(o.uri)&&(o.options===void 0||(o.options.recursive===void 0||u.boolean(o.options.recursive))&&(o.options.ignoreIfNotExists===void 0||u.boolean(o.options.ignoreIfNotExists)))&&(o.annotationId===void 0||ee.is(o.annotationId))}e.is=r})(it||(it={}));var Gt;(function(e){function t(r){var n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(function(o){return u.string(o.kind)?rt.is(o)||ot.is(o)||it.is(o):vt.is(o)}))}e.is=t})(Gt||(Gt={}));var Vt=function(){function e(t,r){this.edits=t,this.changeAnnotations=r}return e.prototype.insert=function(t,r,n){var o,s;if(n===void 0?o=Me.insert(t,r):ee.is(n)?(s=n,o=Ce.insert(t,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),o=Ce.insert(t,r,s)),this.edits.push(o),s!==void 0)return s},e.prototype.replace=function(t,r,n){var o,s;if(n===void 0?o=Me.replace(t,r):ee.is(n)?(s=n,o=Ce.replace(t,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),o=Ce.replace(t,r,s)),this.edits.push(o),s!==void 0)return s},e.prototype.delete=function(t,r){var n,o;if(r===void 0?n=Me.del(t):ee.is(r)?(o=r,n=Ce.del(t,r)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(r),n=Ce.del(t,o)),this.edits.push(n),o!==void 0)return o},e.prototype.add=function(t){this.edits.push(t)},e.prototype.all=function(){return this.edits},e.prototype.clear=function(){this.edits.splice(0,this.edits.length)},e.prototype.assertChangeAnnotations=function(t){if(t===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},e}(),Go=function(){function e(t){this._annotations=t===void 0?Object.create(null):t,this._counter=0,this._size=0}return e.prototype.all=function(){return this._annotations},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),e.prototype.manage=function(t,r){var n;if(ee.is(t)?n=t:(n=this.nextId(),r=t),this._annotations[n]!==void 0)throw new Error("Id "+n+" is already in use.");if(r===void 0)throw new Error("No annotation provided for id "+n);return this._annotations[n]=r,this._size++,n},e.prototype.nextId=function(){return this._counter++,this._counter.toString()},e}(),na=function(){function e(t){var r=this;this._textEditChanges=Object.create(null),t!==void 0?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new Go(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach(function(n){if(vt.is(n)){var o=new Vt(n.edits,r._changeAnnotations);r._textEditChanges[n.textDocument.uri]=o}})):t.changes&&Object.keys(t.changes).forEach(function(n){var o=new Vt(t.changes[n]);r._textEditChanges[n]=o})):this._workspaceEdit={}}return Object.defineProperty(e.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),e.prototype.getTextEditChange=function(t){if(St.is(t)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var r={uri:t.uri,version:t.version},n=this._textEditChanges[r.uri];if(!n){var o=[],s={textDocument:r,edits:o};this._workspaceEdit.documentChanges.push(s),n=new Vt(o,this._changeAnnotations),this._textEditChanges[r.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var n=this._textEditChanges[t];if(!n){var o=[];this._workspaceEdit.changes[t]=o,n=new Vt(o),this._textEditChanges[t]=n}return n}},e.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Go,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},e.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},e.prototype.createFile=function(t,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var o;$e.is(r)||ee.is(r)?o=r:n=r;var s,c;if(o===void 0?s=rt.create(t,n):(c=ee.is(o)?o:this._changeAnnotations.manage(o),s=rt.create(t,n,c)),this._workspaceEdit.documentChanges.push(s),c!==void 0)return c},e.prototype.renameFile=function(t,r,n,o){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var s;$e.is(n)||ee.is(n)?s=n:o=n;var c,p;if(s===void 0?c=ot.create(t,r,o):(p=ee.is(s)?s:this._changeAnnotations.manage(s),c=ot.create(t,r,o,p)),this._workspaceEdit.documentChanges.push(c),p!==void 0)return p},e.prototype.deleteFile=function(t,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var o;$e.is(r)||ee.is(r)?o=r:n=r;var s,c;if(o===void 0?s=it.create(t,n):(c=ee.is(o)?o:this._changeAnnotations.manage(o),s=it.create(t,n,c)),this._workspaceEdit.documentChanges.push(s),c!==void 0)return c},e}(),Un;(function(e){function t(n){return{uri:n}}e.create=t;function r(n){var o=n;return u.defined(o)&&u.string(o.uri)}e.is=r})(Un||(Un={}));var Hn;(function(e){function t(n,o){return{uri:n,version:o}}e.create=t;function r(n){var o=n;return u.defined(o)&&u.string(o.uri)&&u.integer(o.version)}e.is=r})(Hn||(Hn={}));var St;(function(e){function t(n,o){return{uri:n,version:o}}e.create=t;function r(n){var o=n;return u.defined(o)&&u.string(o.uri)&&(o.version===null||u.integer(o.version))}e.is=r})(St||(St={}));var Gn;(function(e){function t(n,o,s,c){return{uri:n,languageId:o,version:s,text:c}}e.create=t;function r(n){var o=n;return u.defined(o)&&u.string(o.uri)&&u.string(o.languageId)&&u.integer(o.version)&&u.string(o.text)}e.is=r})(Gn||(Gn={}));var st;(function(e){e.PlainText="plaintext",e.Markdown="markdown"})(st||(st={}));(function(e){function t(r){var n=r;return n===e.PlainText||n===e.Markdown}e.is=t})(st||(st={}));var Yt;(function(e){function t(r){var n=r;return u.objectLiteral(r)&&st.is(n.kind)&&u.string(n.value)}e.is=t})(Yt||(Yt={}));var Vn;(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(Vn||(Vn={}));var Yn;(function(e){e.PlainText=1,e.Snippet=2})(Yn||(Yn={}));var Qn;(function(e){e.Deprecated=1})(Qn||(Qn={}));var Xn;(function(e){function t(n,o,s){return{newText:n,insert:o,replace:s}}e.create=t;function r(n){var o=n;return o&&u.string(o.newText)&&X.is(o.insert)&&X.is(o.replace)}e.is=r})(Xn||(Xn={}));var Zn;(function(e){e.asIs=1,e.adjustIndentation=2})(Zn||(Zn={}));var Kn;(function(e){function t(r){return{label:r}}e.create=t})(Kn||(Kn={}));var er;(function(e){function t(r,n){return{items:r||[],isIncomplete:!!n}}e.create=t})(er||(er={}));var Rt;(function(e){function t(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}e.fromPlainText=t;function r(n){var o=n;return u.string(o)||u.objectLiteral(o)&&u.string(o.language)&&u.string(o.value)}e.is=r})(Rt||(Rt={}));var tr;(function(e){function t(r){var n=r;return!!n&&u.objectLiteral(n)&&(Yt.is(n.contents)||Rt.is(n.contents)||u.typedArray(n.contents,Rt.is))&&(r.range===void 0||X.is(r.range))}e.is=t})(tr||(tr={}));var nr;(function(e){function t(r,n){return n?{label:r,documentation:n}:{label:r}}e.create=t})(nr||(nr={}));var rr;(function(e){function t(r,n){for(var o=[],s=2;s=0;b--){var _=g[b],S=s.offsetAt(_.range.start),h=s.offsetAt(_.range.end);if(h<=m)p=p.substring(0,S)+_.newText+p.substring(h,p.length);else throw new Error("Overlapping edit");m=S}return p}e.applyEdits=n;function o(s,c){if(s.length<=1)return s;var p=s.length/2|0,g=s.slice(0,p),m=s.slice(p);o(g,c),o(m,c);for(var b=0,_=0,S=0;b0&&t.push(r.length),this._lineOffsets=t}return this._lineOffsets},e.prototype.positionAt=function(t){t=Math.max(Math.min(t,this._content.length),0);var r=this.getLineOffsets(),n=0,o=r.length;if(o===0)return de.create(0,t);for(;nt?o=s:n=s+1}var c=n-1;return de.create(c,t-r[c])},e.prototype.offsetAt=function(t){var r=this.getLineOffsets();if(t.line>=r.length)return this._content.length;if(t.line<0)return 0;var n=r[t.line],o=t.line+1{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.ProtocolNotificationType=ue.ProtocolNotificationType0=ue.ProtocolRequestType=ue.ProtocolRequestType0=ue.RegistrationType=void 0;var at=tt(),Yo=class{constructor(t){this.method=t}};ue.RegistrationType=Yo;var Qo=class extends at.RequestType0{constructor(t){super(t)}};ue.ProtocolRequestType0=Qo;var Xo=class extends at.RequestType{constructor(t){super(t,at.ParameterStructures.byName)}};ue.ProtocolRequestType=Xo;var Zo=class extends at.NotificationType0{constructor(t){super(t)}};ue.ProtocolNotificationType0=Zo;var Ko=class extends at.NotificationType{constructor(t){super(t,at.ParameterStructures.byName)}};ue.ProtocolNotificationType=Ko});var ni=M(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.objectLiteral=H.typedArray=H.stringArray=H.array=H.func=H.error=H.number=H.string=H.boolean=void 0;function ia(e){return e===!0||e===!1}H.boolean=ia;function ei(e){return typeof e=="string"||e instanceof String}H.string=ei;function sa(e){return typeof e=="number"||e instanceof Number}H.number=sa;function aa(e){return e instanceof Error}H.error=aa;function ca(e){return typeof e=="function"}H.func=ca;function ti(e){return Array.isArray(e)}H.array=ti;function ua(e){return ti(e)&&e.every(t=>ei(t))}H.stringArray=ua;function la(e,t){return Array.isArray(e)&&e.every(t)}H.typedArray=la;function fa(e){return e!==null&&typeof e=="object"}H.objectLiteral=fa});var ri=M(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.ImplementationRequest=void 0;var da=Z(),pa;(function(e){e.method="textDocument/implementation",e.type=new da.ProtocolRequestType(e.method)})(pa=wt.ImplementationRequest||(wt.ImplementationRequest={}))});var oi=M(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.TypeDefinitionRequest=void 0;var ha=Z(),ma;(function(e){e.method="textDocument/typeDefinition",e.type=new ha.ProtocolRequestType(e.method)})(ma=_t.TypeDefinitionRequest||(_t.TypeDefinitionRequest={}))});var si=M(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.DidChangeWorkspaceFoldersNotification=xe.WorkspaceFoldersRequest=void 0;var ii=Z(),ga;(function(e){e.type=new ii.ProtocolRequestType0("workspace/workspaceFolders")})(ga=xe.WorkspaceFoldersRequest||(xe.WorkspaceFoldersRequest={}));var ya;(function(e){e.type=new ii.ProtocolNotificationType("workspace/didChangeWorkspaceFolders")})(ya=xe.DidChangeWorkspaceFoldersNotification||(xe.DidChangeWorkspaceFoldersNotification={}))});var ai=M(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.ConfigurationRequest=void 0;var ja=Z(),ba;(function(e){e.type=new ja.ProtocolRequestType("workspace/configuration")})(ba=kt.ConfigurationRequest||(kt.ConfigurationRequest={}))});var ui=M(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.ColorPresentationRequest=qe.DocumentColorRequest=void 0;var ci=Z(),va;(function(e){e.method="textDocument/documentColor",e.type=new ci.ProtocolRequestType(e.method)})(va=qe.DocumentColorRequest||(qe.DocumentColorRequest={}));var Sa;(function(e){e.type=new ci.ProtocolRequestType("textDocument/colorPresentation")})(Sa=qe.ColorPresentationRequest||(qe.ColorPresentationRequest={}))});var li=M(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.FoldingRangeRequest=Oe.FoldingRangeKind=void 0;var Ra=Z(),wa;(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(wa=Oe.FoldingRangeKind||(Oe.FoldingRangeKind={}));var _a;(function(e){e.method="textDocument/foldingRange",e.type=new Ra.ProtocolRequestType(e.method)})(_a=Oe.FoldingRangeRequest||(Oe.FoldingRangeRequest={}))});var fi=M(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.DeclarationRequest=void 0;var ka=Z(),Ma;(function(e){e.method="textDocument/declaration",e.type=new ka.ProtocolRequestType(e.method)})(Ma=Mt.DeclarationRequest||(Mt.DeclarationRequest={}))});var di=M(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.SelectionRangeRequest=void 0;var Ca=Z(),Pa;(function(e){e.method="textDocument/selectionRange",e.type=new Ca.ProtocolRequestType(e.method)})(Pa=Ct.SelectionRangeRequest||(Ct.SelectionRangeRequest={}))});var hi=M(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.WorkDoneProgressCancelNotification=pe.WorkDoneProgressCreateRequest=pe.WorkDoneProgress=void 0;var Ta=tt(),pi=Z(),Na;(function(e){e.type=new Ta.ProgressType;function t(r){return r===e.type}e.is=t})(Na=pe.WorkDoneProgress||(pe.WorkDoneProgress={}));var xa;(function(e){e.type=new pi.ProtocolRequestType("window/workDoneProgress/create")})(xa=pe.WorkDoneProgressCreateRequest||(pe.WorkDoneProgressCreateRequest={}));var qa;(function(e){e.type=new pi.ProtocolNotificationType("window/workDoneProgress/cancel")})(qa=pe.WorkDoneProgressCancelNotification||(pe.WorkDoneProgressCancelNotification={}))});var mi=M(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.CallHierarchyOutgoingCallsRequest=he.CallHierarchyIncomingCallsRequest=he.CallHierarchyPrepareRequest=void 0;var jr=Z(),Oa;(function(e){e.method="textDocument/prepareCallHierarchy",e.type=new jr.ProtocolRequestType(e.method)})(Oa=he.CallHierarchyPrepareRequest||(he.CallHierarchyPrepareRequest={}));var Da;(function(e){e.method="callHierarchy/incomingCalls",e.type=new jr.ProtocolRequestType(e.method)})(Da=he.CallHierarchyIncomingCallsRequest||(he.CallHierarchyIncomingCallsRequest={}));var Ea;(function(e){e.method="callHierarchy/outgoingCalls",e.type=new jr.ProtocolRequestType(e.method)})(Ea=he.CallHierarchyOutgoingCallsRequest||(he.CallHierarchyOutgoingCallsRequest={}))});var gi=M(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.SemanticTokensRefreshRequest=E.SemanticTokensRangeRequest=E.SemanticTokensDeltaRequest=E.SemanticTokensRequest=E.SemanticTokensRegistrationType=E.TokenFormat=E.SemanticTokens=E.SemanticTokenModifiers=E.SemanticTokenTypes=void 0;var Pt=Z(),Aa;(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator"})(Aa=E.SemanticTokenTypes||(E.SemanticTokenTypes={}));var Ia;(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(Ia=E.SemanticTokenModifiers||(E.SemanticTokenModifiers={}));var La;(function(e){function t(r){let n=r;return n!==void 0&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}e.is=t})(La=E.SemanticTokens||(E.SemanticTokens={}));var Fa;(function(e){e.Relative="relative"})(Fa=E.TokenFormat||(E.TokenFormat={}));var Ja;(function(e){e.method="textDocument/semanticTokens",e.type=new Pt.RegistrationType(e.method)})(Ja=E.SemanticTokensRegistrationType||(E.SemanticTokensRegistrationType={}));var Wa;(function(e){e.method="textDocument/semanticTokens/full",e.type=new Pt.ProtocolRequestType(e.method)})(Wa=E.SemanticTokensRequest||(E.SemanticTokensRequest={}));var za;(function(e){e.method="textDocument/semanticTokens/full/delta",e.type=new Pt.ProtocolRequestType(e.method)})(za=E.SemanticTokensDeltaRequest||(E.SemanticTokensDeltaRequest={}));var $a;(function(e){e.method="textDocument/semanticTokens/range",e.type=new Pt.ProtocolRequestType(e.method)})($a=E.SemanticTokensRangeRequest||(E.SemanticTokensRangeRequest={}));var Ba;(function(e){e.method="workspace/semanticTokens/refresh",e.type=new Pt.ProtocolRequestType0(e.method)})(Ba=E.SemanticTokensRefreshRequest||(E.SemanticTokensRefreshRequest={}))});var yi=M(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.ShowDocumentRequest=void 0;var Ua=Z(),Ha;(function(e){e.method="window/showDocument",e.type=new Ua.ProtocolRequestType(e.method)})(Ha=Tt.ShowDocumentRequest||(Tt.ShowDocumentRequest={}))});var ji=M(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.LinkedEditingRangeRequest=void 0;var Ga=Z(),Va;(function(e){e.method="textDocument/linkedEditingRange",e.type=new Ga.ProtocolRequestType(e.method)})(Va=Nt.LinkedEditingRangeRequest||(Nt.LinkedEditingRangeRequest={}))});var bi=M(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});W.WillDeleteFilesRequest=W.DidDeleteFilesNotification=W.DidRenameFilesNotification=W.WillRenameFilesRequest=W.DidCreateFilesNotification=W.WillCreateFilesRequest=W.FileOperationPatternKind=void 0;var ct=Z(),Ya;(function(e){e.file="file",e.folder="folder"})(Ya=W.FileOperationPatternKind||(W.FileOperationPatternKind={}));var Qa;(function(e){e.method="workspace/willCreateFiles",e.type=new ct.ProtocolRequestType(e.method)})(Qa=W.WillCreateFilesRequest||(W.WillCreateFilesRequest={}));var Xa;(function(e){e.method="workspace/didCreateFiles",e.type=new ct.ProtocolNotificationType(e.method)})(Xa=W.DidCreateFilesNotification||(W.DidCreateFilesNotification={}));var Za;(function(e){e.method="workspace/willRenameFiles",e.type=new ct.ProtocolRequestType(e.method)})(Za=W.WillRenameFilesRequest||(W.WillRenameFilesRequest={}));var Ka;(function(e){e.method="workspace/didRenameFiles",e.type=new ct.ProtocolNotificationType(e.method)})(Ka=W.DidRenameFilesNotification||(W.DidRenameFilesNotification={}));var ec;(function(e){e.method="workspace/didDeleteFiles",e.type=new ct.ProtocolNotificationType(e.method)})(ec=W.DidDeleteFilesNotification||(W.DidDeleteFilesNotification={}));var tc;(function(e){e.method="workspace/willDeleteFiles",e.type=new ct.ProtocolRequestType(e.method)})(tc=W.WillDeleteFilesRequest||(W.WillDeleteFilesRequest={}))});var vi=M(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.MonikerRequest=me.MonikerKind=me.UniquenessLevel=void 0;var nc=Z(),rc;(function(e){e.document="document",e.project="project",e.group="group",e.scheme="scheme",e.global="global"})(rc=me.UniquenessLevel||(me.UniquenessLevel={}));var oc;(function(e){e.import="import",e.export="export",e.local="local"})(oc=me.MonikerKind||(me.MonikerKind={}));var ic;(function(e){e.method="textDocument/moniker",e.type=new nc.ProtocolRequestType(e.method)})(ic=me.MonikerRequest||(me.MonikerRequest={}))});var ki=M(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.DocumentLinkRequest=i.CodeLensRefreshRequest=i.CodeLensResolveRequest=i.CodeLensRequest=i.WorkspaceSymbolRequest=i.CodeActionResolveRequest=i.CodeActionRequest=i.DocumentSymbolRequest=i.DocumentHighlightRequest=i.ReferencesRequest=i.DefinitionRequest=i.SignatureHelpRequest=i.SignatureHelpTriggerKind=i.HoverRequest=i.CompletionResolveRequest=i.CompletionRequest=i.CompletionTriggerKind=i.PublishDiagnosticsNotification=i.WatchKind=i.FileChangeType=i.DidChangeWatchedFilesNotification=i.WillSaveTextDocumentWaitUntilRequest=i.WillSaveTextDocumentNotification=i.TextDocumentSaveReason=i.DidSaveTextDocumentNotification=i.DidCloseTextDocumentNotification=i.DidChangeTextDocumentNotification=i.TextDocumentContentChangeEvent=i.DidOpenTextDocumentNotification=i.TextDocumentSyncKind=i.TelemetryEventNotification=i.LogMessageNotification=i.ShowMessageRequest=i.ShowMessageNotification=i.MessageType=i.DidChangeConfigurationNotification=i.ExitNotification=i.ShutdownRequest=i.InitializedNotification=i.InitializeError=i.InitializeRequest=i.WorkDoneProgressOptions=i.TextDocumentRegistrationOptions=i.StaticRegistrationOptions=i.FailureHandlingKind=i.ResourceOperationKind=i.UnregistrationRequest=i.RegistrationRequest=i.DocumentSelector=i.DocumentFilter=void 0;i.MonikerRequest=i.MonikerKind=i.UniquenessLevel=i.WillDeleteFilesRequest=i.DidDeleteFilesNotification=i.WillRenameFilesRequest=i.DidRenameFilesNotification=i.WillCreateFilesRequest=i.DidCreateFilesNotification=i.FileOperationPatternKind=i.LinkedEditingRangeRequest=i.ShowDocumentRequest=i.SemanticTokensRegistrationType=i.SemanticTokensRefreshRequest=i.SemanticTokensRangeRequest=i.SemanticTokensDeltaRequest=i.SemanticTokensRequest=i.TokenFormat=i.SemanticTokens=i.SemanticTokenModifiers=i.SemanticTokenTypes=i.CallHierarchyPrepareRequest=i.CallHierarchyOutgoingCallsRequest=i.CallHierarchyIncomingCallsRequest=i.WorkDoneProgressCancelNotification=i.WorkDoneProgressCreateRequest=i.WorkDoneProgress=i.SelectionRangeRequest=i.DeclarationRequest=i.FoldingRangeRequest=i.ColorPresentationRequest=i.DocumentColorRequest=i.ConfigurationRequest=i.DidChangeWorkspaceFoldersNotification=i.WorkspaceFoldersRequest=i.TypeDefinitionRequest=i.ImplementationRequest=i.ApplyWorkspaceEditRequest=i.ExecuteCommandRequest=i.PrepareRenameRequest=i.RenameRequest=i.PrepareSupportDefaultBehavior=i.DocumentOnTypeFormattingRequest=i.DocumentRangeFormattingRequest=i.DocumentFormattingRequest=i.DocumentLinkResolveRequest=void 0;var De=ni(),k=Z(),sc=ri();Object.defineProperty(i,"ImplementationRequest",{enumerable:!0,get:function(){return sc.ImplementationRequest}});var ac=oi();Object.defineProperty(i,"TypeDefinitionRequest",{enumerable:!0,get:function(){return ac.TypeDefinitionRequest}});var Si=si();Object.defineProperty(i,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return Si.WorkspaceFoldersRequest}});Object.defineProperty(i,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return Si.DidChangeWorkspaceFoldersNotification}});var cc=ai();Object.defineProperty(i,"ConfigurationRequest",{enumerable:!0,get:function(){return cc.ConfigurationRequest}});var Ri=ui();Object.defineProperty(i,"DocumentColorRequest",{enumerable:!0,get:function(){return Ri.DocumentColorRequest}});Object.defineProperty(i,"ColorPresentationRequest",{enumerable:!0,get:function(){return Ri.ColorPresentationRequest}});var uc=li();Object.defineProperty(i,"FoldingRangeRequest",{enumerable:!0,get:function(){return uc.FoldingRangeRequest}});var lc=fi();Object.defineProperty(i,"DeclarationRequest",{enumerable:!0,get:function(){return lc.DeclarationRequest}});var fc=di();Object.defineProperty(i,"SelectionRangeRequest",{enumerable:!0,get:function(){return fc.SelectionRangeRequest}});var br=hi();Object.defineProperty(i,"WorkDoneProgress",{enumerable:!0,get:function(){return br.WorkDoneProgress}});Object.defineProperty(i,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return br.WorkDoneProgressCreateRequest}});Object.defineProperty(i,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return br.WorkDoneProgressCancelNotification}});var vr=mi();Object.defineProperty(i,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return vr.CallHierarchyIncomingCallsRequest}});Object.defineProperty(i,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return vr.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(i,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return vr.CallHierarchyPrepareRequest}});var Pe=gi();Object.defineProperty(i,"SemanticTokenTypes",{enumerable:!0,get:function(){return Pe.SemanticTokenTypes}});Object.defineProperty(i,"SemanticTokenModifiers",{enumerable:!0,get:function(){return Pe.SemanticTokenModifiers}});Object.defineProperty(i,"SemanticTokens",{enumerable:!0,get:function(){return Pe.SemanticTokens}});Object.defineProperty(i,"TokenFormat",{enumerable:!0,get:function(){return Pe.TokenFormat}});Object.defineProperty(i,"SemanticTokensRequest",{enumerable:!0,get:function(){return Pe.SemanticTokensRequest}});Object.defineProperty(i,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return Pe.SemanticTokensDeltaRequest}});Object.defineProperty(i,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return Pe.SemanticTokensRangeRequest}});Object.defineProperty(i,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return Pe.SemanticTokensRefreshRequest}});Object.defineProperty(i,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return Pe.SemanticTokensRegistrationType}});var dc=yi();Object.defineProperty(i,"ShowDocumentRequest",{enumerable:!0,get:function(){return dc.ShowDocumentRequest}});var pc=ji();Object.defineProperty(i,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return pc.LinkedEditingRangeRequest}});var Be=bi();Object.defineProperty(i,"FileOperationPatternKind",{enumerable:!0,get:function(){return Be.FileOperationPatternKind}});Object.defineProperty(i,"DidCreateFilesNotification",{enumerable:!0,get:function(){return Be.DidCreateFilesNotification}});Object.defineProperty(i,"WillCreateFilesRequest",{enumerable:!0,get:function(){return Be.WillCreateFilesRequest}});Object.defineProperty(i,"DidRenameFilesNotification",{enumerable:!0,get:function(){return Be.DidRenameFilesNotification}});Object.defineProperty(i,"WillRenameFilesRequest",{enumerable:!0,get:function(){return Be.WillRenameFilesRequest}});Object.defineProperty(i,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return Be.DidDeleteFilesNotification}});Object.defineProperty(i,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return Be.WillDeleteFilesRequest}});var Sr=vi();Object.defineProperty(i,"UniquenessLevel",{enumerable:!0,get:function(){return Sr.UniquenessLevel}});Object.defineProperty(i,"MonikerKind",{enumerable:!0,get:function(){return Sr.MonikerKind}});Object.defineProperty(i,"MonikerRequest",{enumerable:!0,get:function(){return Sr.MonikerRequest}});var wi;(function(e){function t(r){let n=r;return De.string(n.language)||De.string(n.scheme)||De.string(n.pattern)}e.is=t})(wi=i.DocumentFilter||(i.DocumentFilter={}));var _i;(function(e){function t(r){if(!Array.isArray(r))return!1;for(let n of r)if(!De.string(n)&&!wi.is(n))return!1;return!0}e.is=t})(_i=i.DocumentSelector||(i.DocumentSelector={}));var hc;(function(e){e.type=new k.ProtocolRequestType("client/registerCapability")})(hc=i.RegistrationRequest||(i.RegistrationRequest={}));var mc;(function(e){e.type=new k.ProtocolRequestType("client/unregisterCapability")})(mc=i.UnregistrationRequest||(i.UnregistrationRequest={}));var gc;(function(e){e.Create="create",e.Rename="rename",e.Delete="delete"})(gc=i.ResourceOperationKind||(i.ResourceOperationKind={}));var yc;(function(e){e.Abort="abort",e.Transactional="transactional",e.TextOnlyTransactional="textOnlyTransactional",e.Undo="undo"})(yc=i.FailureHandlingKind||(i.FailureHandlingKind={}));var jc;(function(e){function t(r){let n=r;return n&&De.string(n.id)&&n.id.length>0}e.hasId=t})(jc=i.StaticRegistrationOptions||(i.StaticRegistrationOptions={}));var bc;(function(e){function t(r){let n=r;return n&&(n.documentSelector===null||_i.is(n.documentSelector))}e.is=t})(bc=i.TextDocumentRegistrationOptions||(i.TextDocumentRegistrationOptions={}));var vc;(function(e){function t(n){let o=n;return De.objectLiteral(o)&&(o.workDoneProgress===void 0||De.boolean(o.workDoneProgress))}e.is=t;function r(n){let o=n;return o&&De.boolean(o.workDoneProgress)}e.hasWorkDoneProgress=r})(vc=i.WorkDoneProgressOptions||(i.WorkDoneProgressOptions={}));var Sc;(function(e){e.type=new k.ProtocolRequestType("initialize")})(Sc=i.InitializeRequest||(i.InitializeRequest={}));var Rc;(function(e){e.unknownProtocolVersion=1})(Rc=i.InitializeError||(i.InitializeError={}));var wc;(function(e){e.type=new k.ProtocolNotificationType("initialized")})(wc=i.InitializedNotification||(i.InitializedNotification={}));var _c;(function(e){e.type=new k.ProtocolRequestType0("shutdown")})(_c=i.ShutdownRequest||(i.ShutdownRequest={}));var kc;(function(e){e.type=new k.ProtocolNotificationType0("exit")})(kc=i.ExitNotification||(i.ExitNotification={}));var Mc;(function(e){e.type=new k.ProtocolNotificationType("workspace/didChangeConfiguration")})(Mc=i.DidChangeConfigurationNotification||(i.DidChangeConfigurationNotification={}));var Cc;(function(e){e.Error=1,e.Warning=2,e.Info=3,e.Log=4})(Cc=i.MessageType||(i.MessageType={}));var Pc;(function(e){e.type=new k.ProtocolNotificationType("window/showMessage")})(Pc=i.ShowMessageNotification||(i.ShowMessageNotification={}));var Tc;(function(e){e.type=new k.ProtocolRequestType("window/showMessageRequest")})(Tc=i.ShowMessageRequest||(i.ShowMessageRequest={}));var Nc;(function(e){e.type=new k.ProtocolNotificationType("window/logMessage")})(Nc=i.LogMessageNotification||(i.LogMessageNotification={}));var xc;(function(e){e.type=new k.ProtocolNotificationType("telemetry/event")})(xc=i.TelemetryEventNotification||(i.TelemetryEventNotification={}));var qc;(function(e){e.None=0,e.Full=1,e.Incremental=2})(qc=i.TextDocumentSyncKind||(i.TextDocumentSyncKind={}));var Oc;(function(e){e.method="textDocument/didOpen",e.type=new k.ProtocolNotificationType(e.method)})(Oc=i.DidOpenTextDocumentNotification||(i.DidOpenTextDocumentNotification={}));var Dc;(function(e){function t(n){let o=n;return o!=null&&typeof o.text=="string"&&o.range!==void 0&&(o.rangeLength===void 0||typeof o.rangeLength=="number")}e.isIncremental=t;function r(n){let o=n;return o!=null&&typeof o.text=="string"&&o.range===void 0&&o.rangeLength===void 0}e.isFull=r})(Dc=i.TextDocumentContentChangeEvent||(i.TextDocumentContentChangeEvent={}));var Ec;(function(e){e.method="textDocument/didChange",e.type=new k.ProtocolNotificationType(e.method)})(Ec=i.DidChangeTextDocumentNotification||(i.DidChangeTextDocumentNotification={}));var Ac;(function(e){e.method="textDocument/didClose",e.type=new k.ProtocolNotificationType(e.method)})(Ac=i.DidCloseTextDocumentNotification||(i.DidCloseTextDocumentNotification={}));var Ic;(function(e){e.method="textDocument/didSave",e.type=new k.ProtocolNotificationType(e.method)})(Ic=i.DidSaveTextDocumentNotification||(i.DidSaveTextDocumentNotification={}));var Lc;(function(e){e.Manual=1,e.AfterDelay=2,e.FocusOut=3})(Lc=i.TextDocumentSaveReason||(i.TextDocumentSaveReason={}));var Fc;(function(e){e.method="textDocument/willSave",e.type=new k.ProtocolNotificationType(e.method)})(Fc=i.WillSaveTextDocumentNotification||(i.WillSaveTextDocumentNotification={}));var Jc;(function(e){e.method="textDocument/willSaveWaitUntil",e.type=new k.ProtocolRequestType(e.method)})(Jc=i.WillSaveTextDocumentWaitUntilRequest||(i.WillSaveTextDocumentWaitUntilRequest={}));var Wc;(function(e){e.type=new k.ProtocolNotificationType("workspace/didChangeWatchedFiles")})(Wc=i.DidChangeWatchedFilesNotification||(i.DidChangeWatchedFilesNotification={}));var zc;(function(e){e.Created=1,e.Changed=2,e.Deleted=3})(zc=i.FileChangeType||(i.FileChangeType={}));var $c;(function(e){e.Create=1,e.Change=2,e.Delete=4})($c=i.WatchKind||(i.WatchKind={}));var Bc;(function(e){e.type=new k.ProtocolNotificationType("textDocument/publishDiagnostics")})(Bc=i.PublishDiagnosticsNotification||(i.PublishDiagnosticsNotification={}));var Uc;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.TriggerForIncompleteCompletions=3})(Uc=i.CompletionTriggerKind||(i.CompletionTriggerKind={}));var Hc;(function(e){e.method="textDocument/completion",e.type=new k.ProtocolRequestType(e.method)})(Hc=i.CompletionRequest||(i.CompletionRequest={}));var Gc;(function(e){e.method="completionItem/resolve",e.type=new k.ProtocolRequestType(e.method)})(Gc=i.CompletionResolveRequest||(i.CompletionResolveRequest={}));var Vc;(function(e){e.method="textDocument/hover",e.type=new k.ProtocolRequestType(e.method)})(Vc=i.HoverRequest||(i.HoverRequest={}));var Yc;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.ContentChange=3})(Yc=i.SignatureHelpTriggerKind||(i.SignatureHelpTriggerKind={}));var Qc;(function(e){e.method="textDocument/signatureHelp",e.type=new k.ProtocolRequestType(e.method)})(Qc=i.SignatureHelpRequest||(i.SignatureHelpRequest={}));var Xc;(function(e){e.method="textDocument/definition",e.type=new k.ProtocolRequestType(e.method)})(Xc=i.DefinitionRequest||(i.DefinitionRequest={}));var Zc;(function(e){e.method="textDocument/references",e.type=new k.ProtocolRequestType(e.method)})(Zc=i.ReferencesRequest||(i.ReferencesRequest={}));var Kc;(function(e){e.method="textDocument/documentHighlight",e.type=new k.ProtocolRequestType(e.method)})(Kc=i.DocumentHighlightRequest||(i.DocumentHighlightRequest={}));var eu;(function(e){e.method="textDocument/documentSymbol",e.type=new k.ProtocolRequestType(e.method)})(eu=i.DocumentSymbolRequest||(i.DocumentSymbolRequest={}));var tu;(function(e){e.method="textDocument/codeAction",e.type=new k.ProtocolRequestType(e.method)})(tu=i.CodeActionRequest||(i.CodeActionRequest={}));var nu;(function(e){e.method="codeAction/resolve",e.type=new k.ProtocolRequestType(e.method)})(nu=i.CodeActionResolveRequest||(i.CodeActionResolveRequest={}));var ru;(function(e){e.method="workspace/symbol",e.type=new k.ProtocolRequestType(e.method)})(ru=i.WorkspaceSymbolRequest||(i.WorkspaceSymbolRequest={}));var ou;(function(e){e.method="textDocument/codeLens",e.type=new k.ProtocolRequestType(e.method)})(ou=i.CodeLensRequest||(i.CodeLensRequest={}));var iu;(function(e){e.method="codeLens/resolve",e.type=new k.ProtocolRequestType(e.method)})(iu=i.CodeLensResolveRequest||(i.CodeLensResolveRequest={}));var su;(function(e){e.method="workspace/codeLens/refresh",e.type=new k.ProtocolRequestType0(e.method)})(su=i.CodeLensRefreshRequest||(i.CodeLensRefreshRequest={}));var au;(function(e){e.method="textDocument/documentLink",e.type=new k.ProtocolRequestType(e.method)})(au=i.DocumentLinkRequest||(i.DocumentLinkRequest={}));var cu;(function(e){e.method="documentLink/resolve",e.type=new k.ProtocolRequestType(e.method)})(cu=i.DocumentLinkResolveRequest||(i.DocumentLinkResolveRequest={}));var uu;(function(e){e.method="textDocument/formatting",e.type=new k.ProtocolRequestType(e.method)})(uu=i.DocumentFormattingRequest||(i.DocumentFormattingRequest={}));var lu;(function(e){e.method="textDocument/rangeFormatting",e.type=new k.ProtocolRequestType(e.method)})(lu=i.DocumentRangeFormattingRequest||(i.DocumentRangeFormattingRequest={}));var fu;(function(e){e.method="textDocument/onTypeFormatting",e.type=new k.ProtocolRequestType(e.method)})(fu=i.DocumentOnTypeFormattingRequest||(i.DocumentOnTypeFormattingRequest={}));var du;(function(e){e.Identifier=1})(du=i.PrepareSupportDefaultBehavior||(i.PrepareSupportDefaultBehavior={}));var pu;(function(e){e.method="textDocument/rename",e.type=new k.ProtocolRequestType(e.method)})(pu=i.RenameRequest||(i.RenameRequest={}));var hu;(function(e){e.method="textDocument/prepareRename",e.type=new k.ProtocolRequestType(e.method)})(hu=i.PrepareRenameRequest||(i.PrepareRenameRequest={}));var mu;(function(e){e.type=new k.ProtocolRequestType("workspace/executeCommand")})(mu=i.ExecuteCommandRequest||(i.ExecuteCommandRequest={}));var gu;(function(e){e.type=new k.ProtocolRequestType("workspace/applyEdit")})(gu=i.ApplyWorkspaceEditRequest||(i.ApplyWorkspaceEditRequest={}))});var Ci=M(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.createProtocolConnection=void 0;var Mi=tt();function yu(e,t,r,n){return Mi.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),Mi.createMessageConnection(e,t,r,n)}Qt.createProtocolConnection=yu});var Pi=M(re=>{"use strict";var ju=re&&re.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Xt=re&&re.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ju(t,e,r)};Object.defineProperty(re,"__esModule",{value:!0});re.LSPErrorCodes=re.createProtocolConnection=void 0;Xt(tt(),re);Xt(Vo(),re);Xt(Z(),re);Xt(ki(),re);var bu=Ci();Object.defineProperty(re,"createProtocolConnection",{enumerable:!0,get:function(){return bu.createProtocolConnection}});var vu;(function(e){e.lspReservedErrorRangeStart=-32899,e.ContentModified=-32801,e.RequestCancelled=-32800,e.lspReservedErrorRangeEnd=-32800})(vu=re.LSPErrorCodes||(re.LSPErrorCodes={}))});var Ni=M(be=>{"use strict";var Su=be&&be.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Ti=be&&be.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Su(t,e,r)};Object.defineProperty(be,"__esModule",{value:!0});be.createProtocolConnection=void 0;var Ru=En();Ti(En(),be);Ti(Pi(),be);function wu(e,t,r,n){return Ru.createMessageConnection(e,t,r,n)}be.createProtocolConnection=wu});Lr(exports,{activate:()=>Ui});var R=Ve(require("coc.nvim")),zi=Ve(require("fs")),tn=Ve(require("path")),$i=Ve(Jr()),Bi=Ve(require("util")),nn=Ve(Ni());"use strict";var _u=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[s])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),B,xt;typeof process=="object"?xt=process.platform==="win32":typeof navigator=="object"&&(xi=navigator.userAgent,xt=xi.indexOf("Windows")>=0);var xi;var ku=/^\w[\w\d+.-]*$/,Mu=/^\//,Cu=/^\/\//;function Pu(e,t){if(!e.scheme&&t)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'+e.authority+'", path: "'+e.path+'", query: "'+e.query+'", fragment: "'+e.fragment+'"}');if(e.scheme&&!ku.test(e.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(e.path){if(e.authority){if(!Mu.test(e.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(Cu.test(e.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function Tu(e,t){return!e&&!t?"file":e}function Nu(e,t){switch(e){case"https":case"http":case"file":t?t[0]!==ge&&(t=ge+t):t=ge;break}return t}var I="",ge="/",xu=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,qt=function(){function e(t,r,n,o,s,c){c===void 0&&(c=!1),typeof t=="object"?(this.scheme=t.scheme||I,this.authority=t.authority||I,this.path=t.path||I,this.query=t.query||I,this.fragment=t.fragment||I):(this.scheme=Tu(t,c),this.authority=r||I,this.path=Nu(this.scheme,n||I),this.query=o||I,this.fragment=s||I,Pu(this,c))}return e.isUri=function(t){return t instanceof e?!0:t?typeof t.authority=="string"&&typeof t.fragment=="string"&&typeof t.path=="string"&&typeof t.query=="string"&&typeof t.scheme=="string"&&typeof t.fsPath=="function"&&typeof t.with=="function"&&typeof t.toString=="function":!1},Object.defineProperty(e.prototype,"fsPath",{get:function(){return Oi(this,!1)},enumerable:!0,configurable:!0}),e.prototype.with=function(t){if(!t)return this;var r=t.scheme,n=t.authority,o=t.path,s=t.query,c=t.fragment;return r===void 0?r=this.scheme:r===null&&(r=I),n===void 0?n=this.authority:n===null&&(n=I),o===void 0?o=this.path:o===null&&(o=I),s===void 0?s=this.query:s===null&&(s=I),c===void 0?c=this.fragment:c===null&&(c=I),r===this.scheme&&n===this.authority&&o===this.path&&s===this.query&&c===this.fragment?this:new ut(r,n,o,s,c)},e.parse=function(t,r){r===void 0&&(r=!1);var n=xu.exec(t);return n?new ut(n[2]||I,Zt(n[4]||I),Zt(n[5]||I),Zt(n[7]||I),Zt(n[9]||I),r):new ut(I,I,I,I,I)},e.file=function(t){var r=I;if(xt&&(t=t.replace(/\\/g,ge)),t[0]===ge&&t[1]===ge){var n=t.indexOf(ge,2);n===-1?(r=t.substring(2),t=ge):(r=t.substring(2,n),t=t.substring(n)||ge)}return new ut("file",r,t,I,I)},e.from=function(t){return new ut(t.scheme,t.authority,t.path,t.query,t.fragment)},e.prototype.toString=function(t){return t===void 0&&(t=!1),Rr(this,t)},e.prototype.toJSON=function(){return this},e.revive=function(t){if(t){if(t instanceof e)return t;var r=new ut(t);return r._formatted=t.external,r._fsPath=t._sep===qi?t.fsPath:null,r}else return t},e}();var qi=xt?1:void 0,ut=function(e){_u(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r._formatted=null,r._fsPath=null,r}return Object.defineProperty(t.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=Oi(this,!1)),this._fsPath},enumerable:!0,configurable:!0}),t.prototype.toString=function(r){return r===void 0&&(r=!1),r?Rr(this,!0):(this._formatted||(this._formatted=Rr(this,!1)),this._formatted)},t.prototype.toJSON=function(){var r={$mid:1};return this._fsPath&&(r.fsPath=this._fsPath,r._sep=qi),this._formatted&&(r.external=this._formatted),this.path&&(r.path=this.path),this.scheme&&(r.scheme=this.scheme),this.authority&&(r.authority=this.authority),this.query&&(r.query=this.query),this.fragment&&(r.fragment=this.fragment),r},t}(qt),Di=(B={},B[58]="%3A",B[47]="%2F",B[63]="%3F",B[35]="%23",B[91]="%5B",B[93]="%5D",B[64]="%40",B[33]="%21",B[36]="%24",B[38]="%26",B[39]="%27",B[40]="%28",B[41]="%29",B[42]="%2A",B[43]="%2B",B[44]="%2C",B[59]="%3B",B[61]="%3D",B[32]="%20",B);function Ei(e,t){for(var r=void 0,n=-1,o=0;o=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||s===45||s===46||s===95||s===126||t&&s===47)n!==-1&&(r+=encodeURIComponent(e.substring(n,o)),n=-1),r!==void 0&&(r+=e.charAt(o));else{r===void 0&&(r=e.substr(0,o));var c=Di[s];c!==void 0?(n!==-1&&(r+=encodeURIComponent(e.substring(n,o)),n=-1),r+=c):n===-1&&(n=o)}}return n!==-1&&(r+=encodeURIComponent(e.substring(n))),r!==void 0?r:e}function qu(e){for(var t=void 0,r=0;r1&&e.scheme==="file"?r="//"+e.authority+e.path:e.path.charCodeAt(0)===47&&(e.path.charCodeAt(1)>=65&&e.path.charCodeAt(1)<=90||e.path.charCodeAt(1)>=97&&e.path.charCodeAt(1)<=122)&&e.path.charCodeAt(2)===58?t?r=e.path.substr(1):r=e.path[1].toLowerCase()+e.path.substr(2):r=e.path,xt&&(r=r.replace(/\//g,"\\")),r}function Rr(e,t){var r=t?qu:Ei,n="",o=e.scheme,s=e.authority,c=e.path,p=e.query,g=e.fragment;if(o&&(n+=o,n+=":"),(s||o==="file")&&(n+=ge,n+=ge),s){var m=s.indexOf("@");if(m!==-1){var b=s.substr(0,m);s=s.substr(m+1),m=b.indexOf(":"),m===-1?n+=r(b,!1):(n+=r(b.substr(0,m),!1),n+=":",n+=r(b.substr(m+1),!1)),n+="@"}s=s.toLowerCase(),m=s.indexOf(":"),m===-1?n+=r(s,!1):(n+=r(s.substr(0,m),!1),n+=s.substr(m))}if(c){if(c.length>=3&&c.charCodeAt(0)===47&&c.charCodeAt(2)===58){var _=c.charCodeAt(1);_>=65&&_<=90&&(c="/"+String.fromCharCode(_+32)+":"+c.substr(3))}else if(c.length>=2&&c.charCodeAt(1)===58){var _=c.charCodeAt(0);_>=65&&_<=90&&(c=String.fromCharCode(_+32)+":"+c.substr(2))}n+=r(c,!0)}return p&&(n+="?",n+=r(p,!1)),g&&(n+="#",n+=t?g:Ei(g,!1)),n}function Ai(e){try{return decodeURIComponent(e)}catch(t){return e.length>3?e.substr(0,3)+Ai(e.substr(3)):e}}var Ii=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Zt(e){return e.match(Ii)?e.replace(Ii,function(t){return Ai(t)}):e}var Ou="https://json.schemastore.org/schema-catalog",Du=1,Eu=[{name:".angular-cli.json",description:"Angular CLI configuration file",fileMatch:[".angular-cli.json","angular-cli.json"],url:"https://raw.githubusercontent.com/angular/angular-cli/master/packages/angular/cli/lib/config/schema.json"},{name:"Ansible Role",description:"Ansible role task files",url:"https://json.schemastore.org/ansible-role-2.9",fileMatch:["**/tasks/*.yml","**/tasks/*.yaml"],versions:{"2.0":"https://json.schemastore.org/ansible-role-2.0","2.1":"https://json.schemastore.org/ansible-role-2.1","2.2":"https://json.schemastore.org/ansible-role-2.2","2.3":"https://json.schemastore.org/ansible-role-2.3","2.4":"https://json.schemastore.org/ansible-role-2.4","2.5":"https://json.schemastore.org/ansible-role-2.5","2.6":"https://json.schemastore.org/ansible-role-2.6","2.7":"https://json.schemastore.org/ansible-role-2.7","2.9":"https://json.schemastore.org/ansible-role-2.9"}},{name:"Ansible Playbook",description:"Ansible playbook files",url:"https://json.schemastore.org/ansible-playbook",fileMatch:["playbook.yml","playbook.yaml"]},{name:"Ansible Inventory",description:"Ansible inventory files",url:"https://json.schemastore.org/ansible-inventory",fileMatch:["inventory.yml","inventory.yaml"]},{name:"Ansible Collection Galaxy",description:"Ansible Collection Galaxy metadata",url:"https://json.schemastore.org/ansible-collection-galaxy",fileMatch:["galaxy.yml","galaxy.yaml"]},{name:"apple-app-site-association",description:"Apple Universal Link, App Site Association",fileMatch:["apple-app-site-association"],url:"https://json.schemastore.org/apple-app-site-association"},{name:"appsscript.json",description:"Google Apps Script manifest file",fileMatch:["appsscript.json"],url:"https://json.schemastore.org/appsscript"},{name:"appsettings.json",description:"ASP.NET Core's configuration file",fileMatch:["appsettings.json","appsettings.*.json"],url:"https://json.schemastore.org/appsettings"},{name:"appveyor.yml",description:"AppVeyor CI configuration file",fileMatch:["appveyor.yml"],url:"https://json.schemastore.org/appveyor"},{name:"arc.json",description:"A JSON schema for OpenJS Architect",fileMatch:["arc.json","arc.yml","arc.yaml"],url:"https://raw.githubusercontent.com/architect/parser/master/schema.json"},{name:"Avro Avsc",description:"Avro Schema Avsc file",fileMatch:[".avsc"],url:"https://json.schemastore.org/avro-avsc"},{name:"Azure IoT Edge deployment",description:"Azure IoT Edge deployment schema",url:"https://json.schemastore.org/azure-iot-edge-deployment-2.0",versions:{"1.0":"https://json.schemastore.org/azure-iot-edge-deployment-1.0","1.1":"https://json.schemastore.org/azure-iot-edge-deployment-2.0"}},{name:"Azure IoT Edge deployment template",description:"Azure IoT Edge deployment template schema",fileMatch:["deployment.template.json","deployment.*.template.json"],url:"https://json.schemastore.org/azure-iot-edge-deployment-template-2.0",versions:{"1.0":"https://json.schemastore.org/azure-iot-edge-deployment-template-1.0","1.1":"https://json.schemastore.org/azure-iot-edge-deployment-template-2.0"}},{name:"Azure Pipelines",description:"Azure Pipelines YAML pipelines definition",fileMatch:["azure-pipelines.yml","azure-pipelines.yaml"],url:"https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json"},{name:"Foxx Manifest",description:"ArangoDB Foxx service manifest file",fileMatch:["manifest.json"],url:"https://json.schemastore.org/foxx-manifest"},{name:".asmdef",description:"Unity 3D assembly definition file",fileMatch:["*.asmdef"],url:"https://json.schemastore.org/asmdef"},{name:"babelrc.json",description:"Babel configuration file",fileMatch:[".babelrc","babel.config.json"],url:"https://json.schemastore.org/babelrc"},{name:".backportrc.json",description:"Backport configuration file",fileMatch:[".backportrc.json"],url:"https://json.schemastore.org/backportrc"},{name:"batect.yml",description:"batect configuration file",fileMatch:["batect.yml","batect-bundle.yml"],url:"https://batect.dev/configSchema.json"},{name:"bamboo-spec",description:"The Bamboo Specs allows you to define Bamboo configuration as code, and have corresponding plans/deployments created or updated automatically in Bamboo",url:"https://json.schemastore.org/bamboo-spec",fileMatch:["bamboo.yaml","bamboo.yml"]},{name:"bitbucket-pipelines",description:"Bitbucket Pipelines CI/CD manifest schema",url:"https://bitbucket.org/atlassianlabs/atlascode/raw/main/resources/schemas/pipelines-schema.json",fileMatch:["bitbucket-pipelines.yml","bitbucket-pipelines.yaml"]},{name:".bootstraprc",description:"Webpack bootstrap-loader configuration file",fileMatch:[".bootstraprc"],url:"https://json.schemastore.org/bootstraprc"},{name:"bower.json",description:"Bower package description file",fileMatch:["bower.json",".bower.json"],url:"https://json.schemastore.org/bower"},{name:".bowerrc",description:"Bower configuration file",fileMatch:[".bowerrc"],url:"https://json.schemastore.org/bowerrc"},{name:"behat.yml",description:"Behat configuration file",fileMatch:["behat.yml","*.behat.yml"],url:"https://json.schemastore.org/behat"},{name:"bozr.suite.json",description:"Bozr test suite file",fileMatch:[".suite.json",".xsuite.json"],url:"https://json.schemastore.org/bozr"},{name:"bucklescript",description:"BuckleScript configuration file",fileMatch:["bsconfig.json"],url:"https://bucklescript.github.io/bucklescript/docson/build-schema.json"},{name:"Bukkit plugin.yml",description:"Schema for Minecraft Bukkit plugin description files",fileMatch:["plugin.yml"],url:"https://json.schemastore.org/bukkit-plugin"},{name:"Buildkite",description:"Schema for Buildkite pipeline.yml files",fileMatch:["buildkite.yml","buildkite.yaml","buildkite.json","buildkite.*.yml","buildkite.*.yaml","buildkite.*.json",".buildkite/pipeline.yml",".buildkite/pipeline.yaml",".buildkite/pipeline.json",".buildkite/pipeline.*.yml",".buildkite/pipeline.*.yaml",".buildkite/pipeline.*.json"],url:"https://raw.githubusercontent.com/buildkite/pipeline-schema/master/schema.json"},{name:".build.yml",description:"Sourcehut Build Manifest",fileMatch:[".build.yml"],url:"https://json.schemastore.org/sourcehut-build"},{name:"bundleconfig.json",description:"Schema for bundleconfig.json files",fileMatch:["bundleconfig.json"],url:"https://json.schemastore.org/bundleconfig"},{name:"BungeeCord plugin.yml",description:"Schema for BungeeCord plugin description files",fileMatch:["plugin.yml","bungee.yml"],url:"https://json.schemastore.org/bungee-plugin"},{name:"Camel K YAML DSL",description:"Schema for Camel K YAML DSL",fileMatch:["*.camelk.yaml"],url:"https://raw.githubusercontent.com/apache/camel-k-runtime/master/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json"},{name:"Carafe",description:"Schema for Carafe compatible JavaScript Bundles",url:"https://carafe.fm/schema/draft-02/bundle.schema.json",versions:{"draft-02":"https://carafe.fm/schema/draft-02/bundle.schema.json","draft-01":"https://carafe.fm/schema/draft-01/bundle.schema.json"}},{name:"CityJSON",description:"Schema for the representation of 3D city models",url:"https://raw.githubusercontent.com/cityjson/specs/master/schemas/cityjson.min.schema.json"},{name:"CircleCI config.yml",description:"Schema for CircleCI 2.0 config files",fileMatch:[".circleci/config.yml"],url:"https://json.schemastore.org/circleciconfig"},{name:".cirrus.yml",description:"Cirrus CI configuration files",fileMatch:[".cirrus.yml"],url:"https://json.schemastore.org/cirrus"},{name:".clasp.json",description:"Google Apps Script CLI project file",fileMatch:[".clasp.json"],url:"https://json.schemastore.org/clasp"},{name:"cloudify",description:"Cloudify Blueprint",fileMatch:["*.cfy.yaml"],url:"https://json.schemastore.org/cloudify"},{name:"JSON schema for Codecov configuration files",description:"Schema for codecov.yml files.",fileMatch:[".codecov.yml","codecov.yml"],url:"https://json.schemastore.org/codecov"},{name:"compilerconfig.json",description:"Schema for compilerconfig.json files",fileMatch:["compilerconfig.json"],url:"https://json.schemastore.org/compilerconfig"},{name:"compile_commands.json",description:"LLVM compilation database",fileMatch:["compile_commands.json"],url:"https://json.schemastore.org/compile-commands"},{name:"cosmos.config.json",description:"React Cosmos configuration file",fileMatch:["cosmos.config.json"],url:"https://json.schemastore.org/cosmos-config"},{name:"Chrome Extension",description:"Google Chrome extension manifest file",url:"https://json.schemastore.org/chrome-manifest"},{name:"chutzpah.json",description:"Chutzpah configuration file",fileMatch:["chutzpah.json"],url:"https://json.schemastore.org/chutzpah"},{name:"contentmanifest.json",description:"Visual Studio manifest injection file",fileMatch:["contentmanifest.json"],url:"https://json.schemastore.org/vsix-manifestinjection"},{name:"cloud-sdk-pipeline-config-schema",description:"SAP Cloud SDK Pipeline configuration",fileMatch:["pipeline_config.yml"],url:"https://json.schemastore.org/cloud-sdk-pipeline-config-schema.json"},{name:"cloudbuild.json",description:"Google Cloud Build configuration file",fileMatch:["cloudbuild.json","cloudbuild.yaml","cloudbuild.yml","*.cloudbuild.json","*.cloudbuild.yaml","*.cloudbuild.yml"],url:"https://json.schemastore.org/cloudbuild"},{name:"AWS CloudFormation",description:"AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.",fileMatch:["*.cf.json","*.cf.yml","*.cf.yaml","cloudformation.json","cloudformation.yml","cloudformation.yaml"],url:"https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json"},{name:"AWS CloudFormation Serverless Application Model (SAM)",description:"The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.",fileMatch:["*.sam.json","*.sam.yml","*.sam.yaml","sam.json","sam.yml","sam.yaml"],url:"https://raw.githubusercontent.com/awslabs/goformation/master/schema/sam.schema.json"},{name:"coffeelint.json",description:"CoffeeLint configuration file",fileMatch:["coffeelint.json"],url:"https://json.schemastore.org/coffeelint"},{name:"composer.json",description:"PHP Composer configuration file",fileMatch:["composer.json"],url:"https://json.schemastore.org/composer"},{name:"component.json",description:"Web component file",fileMatch:["component.json"],url:"https://json.schemastore.org/component"},{name:"config.json",description:"ASP.NET project config file",fileMatch:["config.json"],url:"https://json.schemastore.org/config"},{name:"contribute.json",description:"A JSON schema for open-source project contribution data by Mozilla",fileMatch:["contribute.json"],url:"https://json.schemastore.org/contribute"},{name:"cypress.json",description:"Cypress.io test runner configuration file",fileMatch:["cypress.json"],url:"https://raw.githubusercontent.com/cypress-io/cypress/develop/cli/schema/cypress.schema.json"},{name:".creatomic",description:"A config for Atomic Design 4 React generator",fileMatch:[".creatomic"],url:"https://json.schemastore.org/creatomic"},{name:"cspell",description:"JSON schema for cspell configuration file",fileMatch:[".cspell.json","cspell.json","cSpell.json"],url:"https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json"},{name:".csscomb.json",description:"A JSON schema CSS Comb's configuration file",fileMatch:[".csscomb.json"],url:"https://json.schemastore.org/csscomb"},{name:".csslintrc",description:"A JSON schema CSS Lint's configuration file",fileMatch:[".csslintrc"],url:"https://json.schemastore.org/csslintrc"},{name:"Dart build configuration",description:"Configuration for Dart's build system",url:"https://json.schemastore.org/dart-build"},{name:"datalogic-scan2deploy-android",description:"Datalogic Scan2Deploy Android file",fileMatch:[".dla.json"],url:"https://json.schemastore.org/datalogic-scan2deploy-android"},{name:"datalogic-scan2deploy-ce",description:"Datalogic Scan2Deploy CE file",fileMatch:[".dlc.json"],url:"https://json.schemastore.org/datalogic-scan2deploy-ce"},{name:"debugsettings.json",description:"A JSON schema for the ASP.NET DebugSettings.json files",fileMatch:["debugsettings.json"],url:"https://json.schemastore.org/debugsettings"},{name:"dependabot.json",description:"A JSON schema for the Dependabot config.yml files",fileMatch:[".dependabot/config.yml"],url:"https://json.schemastore.org/dependabot"},{name:"dependabot-v2.json",description:"A JSON schema for the Github Action's dependabot.yml files",fileMatch:[".github/dependabot.yml"],url:"https://json.schemastore.org/dependabot-2.0"},{name:"docfx.json",description:"A JSON schema for DocFx configuraton files",fileMatch:["docfx.json"],url:"https://json.schemastore.org/docfx",versions:{"2.8.0":"https://json.schemastore.org/docfx-2.8.0"}},{name:"Dolittle Artifacts",description:"A JSON schema for a Dolittle bounded context's artifacts",fileMatch:[".dolittle/artifacts.json"],url:"https://raw.githubusercontent.com/dolittle/DotNET.SDK/master/Schemas/Artifacts.Configuration/artifacts.json"},{name:"Dolittle Bounded Context Configuration",description:"A JSON schema for Dolittle application's bounded context configuration",fileMatch:["bounded-context.json"],url:"https://raw.githubusercontent.com/dolittle/Runtime/master/Schemas/Applications.Configuration/bounded-context.json"},{name:"Dolittle Event Horizons Configuration",description:"A JSON schema for a Dolittle bounded context's event horizon configurations",fileMatch:[".dolittle/event-horizons.json"],url:"https://raw.githubusercontent.com/dolittle/Runtime/master/Schemas/Events/event-horizons.json"},{name:"Dolittle Resources Configuration",description:"A JSON schema for a Dolittle bounded context's resource configurations",fileMatch:[".dolittle/resources.json"],url:"https://raw.githubusercontent.com/dolittle/DotNET.Fundamentals/master/Schemas/ResourceTypes.Configuration/resources.json"},{name:"Dolittle Server Configuration",description:"A JSON schema for a Dolittle bounded context's event horizon's interaction server configuration",fileMatch:[".dolittle/server.json"],url:"https://raw.githubusercontent.com/dolittle/Runtime/master/Schemas/Server/server.json"},{name:"Dolittle Tenants Configuration",description:"A JSON schema for a Dolittle bounded context's tenant configuration",fileMatch:[".dolittle/tenants.json"],url:"https://raw.githubusercontent.com/dolittle/Runtime/master/Schemas/Tenancy/tenants.json"},{name:"Dolittle Tenant Map Configuration",description:"A JSON schema for a Dolittle bounded context's tenant mapping configurations",fileMatch:[".dolittle/tenant-map.json"],url:"https://raw.githubusercontent.com/dolittle/DotNET.Fundamentals/master/Schemas/Tenancy.Configuration/tenant-map.json"},{name:"Dolittle Topology",description:"A JSON schema for a Dolittle bounded context's topology",fileMatch:[".dolittle/topology.json"],url:"https://raw.githubusercontent.com/dolittle/DotNET.SDK/master/Schemas/Applications.Configuration/topology.json"},{name:"dotnetcli.host.json",description:"JSON schema for .NET CLI template host files",fileMatch:["dotnetcli.host.json"],url:"https://json.schemastore.org/dotnetcli.host"},{name:"drone.json",description:"Drone CI configuration file",fileMatch:[".drone.yml"],url:"https://json.schemastore.org/drone"},{name:"Drush site aliases",description:"JSON Schema for Drush 9 site aliases file",fileMatch:["sites/*.site.yml"],url:"https://json.schemastore.org/drush.site.yml"},{name:"dss-2.0.0.json",description:"Digital Signature Service Core Protocols, Elements, and Bindings Version 2.0",url:"https://json.schemastore.org/dss-2.0.0.json"},{name:"dvc.yaml",description:"JSON Schema for dvc.yaml file",fileMatch:["dvc.yaml"],url:"https://raw.githubusercontent.com/iterative/dvcyaml-schema/master/schema.json"},{name:"Eclipse Che Devfile",description:"JSON schema for Eclipse Che Devfiles",url:"https://raw.githubusercontent.com/eclipse/che/master/wsmaster/che-core-api-workspace/src/main/resources/schema/1.0.0/devfile.json",fileMatch:["devfile.yaml",".devfile.yaml"]},{name:"Esquio",description:"JSON schema for Esquio configuration files",url:"https://json.schemastore.org/esquio"},{name:"epr-manifest.json",description:"Entry Point Regulation manifest file",fileMatch:["epr-manifest.json"],url:"https://json.schemastore.org/epr-manifest"},{name:"electron-builder configuration file.",description:"JSON schema for electron-build configuration file.",fileMatch:["electron-builder.json"],url:"https://json.schemastore.org/electron-builder"},{name:"Expo SDK",description:"JSON schema for Expo SDK app manifest",fileMatch:["app.json"],url:"https://json.schemastore.org/expo-37.0.0.json"},{name:".eslintrc",description:"JSON schema for ESLint configuration files",fileMatch:[".eslintrc",".eslintrc.json",".eslintrc.yml",".eslintrc.yaml"],url:"https://json.schemastore.org/eslintrc"},{name:"fabric.mod.json",description:"Metadata file used by the Fabric mod loader",fileMatch:["fabric.mod.json"],url:"https://json.schemastore.org/fabric.mod.json"},{name:"function.json",description:"JSON schema for Azure Functions function.json files",fileMatch:["function.json"],url:"https://json.schemastore.org/function"},{name:"geojson.json",description:"GeoJSON format for representing geographic data.",url:"https://json.schemastore.org/geojson"},{name:"GitVersion",description:"The output from the GitVersion tool",fileMatch:["gitversion.json"],url:"https://json.schemastore.org/gitversion"},{name:"GitHub Action",description:"YAML schema for GitHub Actions",fileMatch:["action.yml","action.yaml"],url:"https://json.schemastore.org/github-action"},{name:"GitHub Workflow",description:"YAML schema for GitHub Workflow",fileMatch:[".github/workflows/**.yml",".github/workflows/**.yaml"],url:"https://json.schemastore.org/github-workflow"},{name:"gitlab-ci",description:"JSON schema for configuring Gitlab CI",fileMatch:[".gitlab-ci.yml"],url:"https://json.schemastore.org/gitlab-ci"},{name:"Gitpod Configuration",description:"JSON schema for configuring Gitpod.io",fileMatch:[".gitpod.yml"],url:"https://gitpod.io/schemas/gitpod-schema.json"},{name:"global.json",description:"ASP.NET global configuration file",fileMatch:["global.json"],url:"https://json.schemastore.org/global"},{name:"Grafana 5.x Dashboard",description:"JSON Schema for Grafana 5.x Dashboards",url:"https://json.schemastore.org/grafana-dashboard-5.x"},{name:"GraphQL Mesh",description:"JSON Schema for GraphQL Mesh config file",url:"https://raw.githubusercontent.com/Urigo/graphql-mesh/master/packages/types/src/config-schema.json",fileMatch:[".meshrc.yml",".meshrc.yaml",".meshrc.json",".meshrc.js",".graphql-mesh.yaml",".graphql-mesh.yml"]},{name:"GraphQL Config",description:"JSON Schema for GraphQL Config config file",url:"https://raw.githubusercontent.com/kamilkisiela/graphql-config/master/config-schema.json",fileMatch:["graphql.config.json","graphql.config.js","graphql.config.yaml","graphql.config.yml",".graphqlrc",".graphqlrc.json",".graphqlrc.yaml",".graphqlrc.yml",".graphqlrc.js"]},{name:"GraphQL Code Generator",description:"JSON Schema for GraphQL Code Generator config file",url:"https://raw.githubusercontent.com/dotansimha/graphql-code-generator/master/website/static/config.schema.json",fileMatch:["codegen.yml","codegen.yaml","codegen.json","codegen.js",".codegen.yml",".codegen.yaml",".codegen.json",".codegen.js"]},{name:"Grunt copy task",description:"Grunt copy task configuration file",fileMatch:["copy.json"],url:"https://json.schemastore.org/grunt-copy-task"},{name:"Grunt clean task",description:"Grunt clean task configuration file",fileMatch:["clean.json"],url:"https://json.schemastore.org/grunt-clean-task"},{name:"Grunt cssmin task",description:"Grunt cssmin task configuration file",fileMatch:["cssmin.json"],url:"https://json.schemastore.org/grunt-cssmin-task"},{name:"Grunt JSHint task",description:"Grunt JSHint task configuration file",fileMatch:["jshint.json"],url:"https://json.schemastore.org/grunt-jshint-task"},{name:"Grunt Watch task",description:"Grunt Watch task configuration file",fileMatch:["watch.json"],url:"https://json.schemastore.org/grunt-watch-task"},{name:"Grunt base task",description:"Schema for standard Grunt tasks",fileMatch:["grunt/*.json","*-tasks.json"],url:"https://json.schemastore.org/grunt-task"},{name:"haxelib.json",description:"Haxelib manifest",fileMatch:["haxelib.json"],url:"https://json.schemastore.org/haxelib"},{name:"host.json",description:"JSON schema for Azure Functions host.json files",fileMatch:["host.json"],url:"https://json.schemastore.org/host"},{name:"host-meta.json",description:"Schema for host-meta JDR files",fileMatch:["host-meta.json"],url:"https://json.schemastore.org/host-meta"},{name:".htmlhintrc",description:"HTML Hint configuration file",fileMatch:[".htmlhintrc"],url:"https://json.schemastore.org/htmlhint"},{name:"hydra.yml",description:"ORY Hydra configuration file",fileMatch:["hydra.json","hydra.yml","hydra.yaml","hydra.toml"],url:"https://raw.githubusercontent.com/ory/hydra/master/.schema/version.schema.json"},{name:"imageoptimizer.json",description:"Schema for imageoptimizer.json files",fileMatch:["imageoptimizer.json"],url:"https://json.schemastore.org/imageoptimizer"},{name:"Jekyll configuration",description:"Schema for Jekyll _config.yml",fileMatch:["_config.yml"],url:"https://json.schemastore.org/jekyll"},{name:"Jenkins X Pipelines",description:"Jenkins X Pipeline YAML configuration files",fileMatch:["jenkins-x*.yml"],url:"https://jenkins-x.io/schemas/jx-schema.json"},{name:"Jenkins X Requirements",description:"Jenkins X Requirements YAML configuration file",fileMatch:["jx-requirements.yml"],url:"https://jenkins-x.io/schemas/jx-requirements.json"},{name:"Jovo Language Models",description:"JSON Schema for Jovo language Models (https://www.jovo.tech/docs/model)",url:"http://json.schemastore.org/jovo-language-model"},{name:".jsbeautifyrc",description:"js-beautify configuration file",fileMatch:[".jsbeautifyrc"],url:"https://json.schemastore.org/jsbeautifyrc"},{name:".jsbeautifyrc-nested",description:"js-beautify configuration file allowing nested `js`, `css`, and `html` attributes",fileMatch:[".jsbeautifyrc"],url:"https://json.schemastore.org/jsbeautifyrc-nested"},{name:".jscsrc",description:"JSCS configuration file",fileMatch:[".jscsrc","jscsrc.json"],url:"https://json.schemastore.org/jscsrc"},{name:".jshintrc",description:"JSHint configuration file",fileMatch:[".jshintrc"],url:"https://json.schemastore.org/jshintrc"},{name:".jsinspectrc",description:"JSInspect configuration file",fileMatch:[".jsinspectrc"],url:"https://json.schemastore.org/jsinspectrc"},{name:"JSON-API",description:"JSON API document",fileMatch:["*.schema.json"],url:"https://jsonapi.org/schema"},{name:"JSON Document Transform",description:"JSON Document Transofrm",url:"https://json.schemastore.org/jdt"},{name:"JSON Feed",description:"JSON schema for the JSON Feed format",fileMatch:["feed.json"],url:"https://json.schemastore.org/feed",versions:{"1":"http://json.schemastore.org/feed-1","1.1":"http://json.schemastore.org/feed"}},{name:"*.jsonld",description:"JSON Linked Data files",fileMatch:["*.jsonld"],url:"https://json.schemastore.org/jsonld"},{name:"JSONPatch",description:"JSONPatch files",fileMatch:["*.patch"],url:"https://json.schemastore.org/json-patch"},{name:"jsconfig.json",description:"JavaScript project configuration file",fileMatch:["jsconfig.json"],url:"https://json.schemastore.org/jsconfig"},{name:"keto.yml",description:"ORY Keto configuration file",fileMatch:["keto.json","keto.yml","keto.yaml","keto.toml"],url:"https://raw.githubusercontent.com/ory/keto/master/.schema/version.schema.json"},{name:"kustomization.yaml",description:"Kubernetes native configuration management",fileMatch:["kustomization.yaml","kustomization.yml"],url:"https://json.schemastore.org/kustomization"},{name:"launchsettings.json",description:"A JSON schema for the ASP.NET LaunchSettings.json files",fileMatch:["launchsettings.json"],url:"https://json.schemastore.org/launchsettings"},{name:"lerna.json",description:"A JSON schema for lerna.json files",fileMatch:["lerna.json"],url:"https://json.schemastore.org/lerna"},{name:"libman.json",description:"JSON schema for client-side library config files",fileMatch:["libman.json"],url:"https://json.schemastore.org/libman"},{name:"localazy.json",description:"JSON schema for Localazy CLI configuration file. More info at https://localazy.com/docs/cli",fileMatch:["localazy.json"],url:"https://raw.githubusercontent.com/localazy/cli-schema/master/localazy.json"},{name:"lsdlschema.json",description:"JSON schema for Linguistic Schema Definition Language files",fileMatch:["*.lsdl.yaml","*.lsdl.json"],url:"https://json.schemastore.org/lsdlschema"},{name:"Microsoft Band Web Tile",description:"Microsoft Band Web Tile manifest file",url:"https://json.schemastore.org/band-manifest"},{name:"mimetypes.json",description:"JSON Schema for mime type collections",fileMatch:["mimetypes.json"],url:"https://json.schemastore.org/mimetypes"},{name:".mocharc",description:"JSON schema for MochaJS configuration files",fileMatch:[".mocharc.json",".mocharc.jsonc",".mocharc.yml",".mocharc.yaml"],url:"https://json.schemastore.org/mocharc"},{name:".modernizrrc",description:"Webpack modernizr-loader configuration file",fileMatch:[".modernizrrc"],url:"https://json.schemastore.org/modernizrrc"},{name:"mycode.json",description:"JSON schema for mycode.js files",fileMatch:["mycode.json"],url:"https://json.schemastore.org/mycode"},{name:"Netlify config schema",description:"This schema describes the YAML config that Netlify uses",fileMatch:["admin/config*.yml"],url:"http://json.schemastore.org/netlify.json"},{name:"ninjs (News in JSON)",description:"A JSON Schema for ninjs by the IPTC. News and publishing information. See https://iptc.org/standards/ninjs/",url:"https://json.schemastore.org/ninjs-1.3.json",versions:{"1.3":"https://json.schemastore.org/ninjs-1.3.json","1.2":"https://json.schemastore.org/ninjs-1.2.json","1.1":"https://json.schemastore.org/ninjs-1.1.json","1.0":"https://json.schemastore.org/ninjs-1.0.json"}},{name:"nest-cli",description:"A progressive Node.js framework for building efficient and scalable server-side applications \u{1F680}.",url:"https://json.schemastore.org/nest-cli",fileMatch:[".nestcli.json",".nest-cli.json","nest-cli.json","nest.json"]},{name:".nodehawkrc",description:"JSON schema for .nodehawkrc configuration files.",url:"https://json.schemastore.org/nodehawkrc",fileMatch:[".nodehawkrc"]},{name:"nodemon.json",description:"JSON schema for nodemon.json configuration files.",url:"https://json.schemastore.org/nodemon",fileMatch:["nodemon.json"]},{name:".npmpackagejsonlintrc",description:"Configuration file for npm-package-json-lint",fileMatch:[".npmpackagejsonlintrc","npmpackagejsonlintrc.json",".npmpackagejsonlintrc.json"],url:"https://json.schemastore.org/npmpackagejsonlintrc"},{name:"nuget-project.json",description:"JSON schema for NuGet project.json files.",url:"https://json.schemastore.org/nuget-project",versions:{"3.3.0":"https://json.schemastore.org/nuget-project-3.3.0"}},{name:"nswag.json",description:"JSON schema for nswag configuration",url:"https://json.schemastore.org/nswag",fileMatch:["nswag.json"]},{name:"oathkeeper.yml",description:"ORY Oathkeeper configuration file",fileMatch:["oathkeeper.json","oathkeeper.yml","oathkeeper.yaml","oathkeeper.toml"],url:"https://raw.githubusercontent.com/ory/oathkeeper/master/.schema/version.schema.json"},{name:"ocelot.json",description:"JSON schema for the Ocelot Api Gateway.",fileMatch:["ocelot.json"],url:"https://json.schemastore.org/ocelot"},{name:"omnisharp.json",description:"Omnisharp Configuration file",fileMatch:["omnisharp.json"],url:"https://json.schemastore.org/omnisharp"},{name:"openapi.json",description:"A JSON schema for Open API documentation files",fileMatch:["openapi.json","openapi.yml","openapi.yaml"],url:"https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v3.0/schema.json"},{name:"openfin.json",description:"OpenFin application configuration file",url:"https://json.schemastore.org/openfin"},{name:"kratos.yml",description:"ORY Kratos configuration file",fileMatch:["kratos.json","kratos.yml","kratos.yaml"],url:"https://raw.githubusercontent.com/ory/kratos/master/.schema/version.schema.json"},{name:"package.json",description:"NPM configuration file",fileMatch:["package.json"],url:"https://json.schemastore.org/package"},{name:"coc extension package.json",description:"coc extension contributes",fileMatch:["package.json"],url:"vscode://schemas/vscode-extensions"},{name:"package.manifest",description:"Umbraco package configuration file",fileMatch:["package.manifest"],url:"https://json.schemastore.org/package.manifest",versions:{"8.0.0":"https://json.schemastore.org/package.manifest-8.0.0","7.0.0":"https://json.schemastore.org/package.manifest-7.0.0"}},{name:"Packer",description:"Packer template JSON configuration",fileMatch:["packer.json"],url:"https://json.schemastore.org/packer"},{name:"pattern.json",description:"Patternplate pattern manifest file",fileMatch:["pattern.json"],url:"https://json.schemastore.org/pattern"},{name:".pmbot.yml",description:"Pmbot configuration file",fileMatch:[".pmbot.yml"],url:"https://raw.githubusercontent.com/pmbot-io/config/master/pmbot.yml.schema.json"},{name:"PocketMine plugin.yml",description:"PocketMine plugin manifest file",fileMatch:["plugin.yml"],url:"https://json.schemastore.org/pocketmine-plugin"},{name:".pre-commit-config.yml",description:"pre-commit configuration file",fileMatch:[".pre-commit-config.yml",".pre-commit-config.yaml"],url:"https://json.schemastore.org/pre-commit-config"},{name:".phraseapp.yml",description:"PhraseApp configuration file",fileMatch:[".phraseapp.yml"],url:"https://json.schemastore.org/phraseapp"},{name:"prettierrc.json",description:".prettierrc configuration file",fileMatch:[".prettierrc",".prettierrc.json",".prettierrc.yml",".prettierrc.yaml"],url:"https://json.schemastore.org/prettierrc",versions:{"1.8.2":"https://json.schemastore.org/prettierrc-1.8.2"}},{name:"prisma.yml",description:"prisma.yml service definition file",fileMatch:["prisma.yml"],url:"https://json.schemastore.org/prisma"},{name:"project.json",description:"ASP.NET vNext project configuration file",fileMatch:["project.json"],url:"https://json.schemastore.org/project",versions:{"1.0.0-beta3":"https://json.schemastore.org/project-1.0.0-beta3","1.0.0-beta4":"https://json.schemastore.org/project-1.0.0-beta4","1.0.0-beta5":"https://json.schemastore.org/project-1.0.0-beta5","1.0.0-beta6":"https://json.schemastore.org/project-1.0.0-beta6","1.0.0-beta8":"https://json.schemastore.org/project-1.0.0-beta8","1.0.0-rc1":"https://json.schemastore.org/project-1.0.0-rc1","1.0.0-rc1-update1":"https://json.schemastore.org/project-1.0.0-rc1","1.0.0-rc2":"https://json.schemastore.org/project-1.0.0-rc2"}},{name:"project-1.0.0-beta3.json",description:"ASP.NET vNext project configuration file",url:"https://json.schemastore.org/project-1.0.0-beta3"},{name:"project-1.0.0-beta4.json",description:"ASP.NET vNext project configuration file",url:"https://json.schemastore.org/project-1.0.0-beta4"},{name:"project-1.0.0-beta5.json",description:"ASP.NET vNext project configuration file",url:"https://json.schemastore.org/project-1.0.0-beta5"},{name:"project-1.0.0-beta6.json",description:"ASP.NET vNext project configuration file",url:"https://json.schemastore.org/project-1.0.0-beta6"},{name:"project-1.0.0-beta8.json",description:"ASP.NET vNext project configuration file",url:"https://json.schemastore.org/project-1.0.0-beta8"},{name:"project-1.0.0-rc1.json",description:"ASP.NET vNext project configuration file",url:"https://json.schemastore.org/project-1.0.0-rc1"},{name:"project-1.0.0-rc2.json",description:".NET Core project configuration file",url:"https://json.schemastore.org/project-1.0.0-rc2"},{name:"prometheus.json",description:"Prometheus configuration file",fileMatch:["prometheus.yml"],url:"https://json.schemastore.org/prometheus"},{name:"prometheus.rules.json",description:"Prometheus rules file",fileMatch:["*.rules"],url:"https://json.schemastore.org/prometheus.rules"},{name:"proxies.json",description:"JSON schema for Azure Function Proxies proxies.json files",fileMatch:["proxies.json"],url:"https://json.schemastore.org/proxies"},{name:"pubspec.yaml",description:"Schema for pubspecs, the format used by Dart's dependency manager",fileMatch:["pubspec.yaml"],url:"https://json.schemastore.org/pubspec"},{name:"pyrseas-0.8.json",description:"Pyrseas database schema versioning for Postgres databases, v0.8",fileMatch:["pyrseas-0.8.json"],url:"https://json.schemastore.org/pyrseas-0.8"},{name:"Red-DiscordBot \u0421og",description:"Red-DiscordBot \u0421og metadata file",fileMatch:["info.json"],url:"https://raw.githubusercontent.com/Cog-Creators/Red-DiscordBot/V3/develop/schema/red_cog.schema.json"},{name:"Red-DiscordBot \u0421og Repo",description:"Red-DiscordBot \u0421og Repo metadata file",fileMatch:["info.json"],url:"https://raw.githubusercontent.com/Cog-Creators/Red-DiscordBot/V3/develop/schema/red_cog_repo.schema.json"},{name:"*.resjson",description:"Windows App localization file",fileMatch:["*.resjson"],url:"https://json.schemastore.org/resjson"},{name:"JSON Resume",description:"A JSON format to describe resumes",fileMatch:["resume.json"],url:"https://json.schemastore.org/resume"},{name:"Renovate",description:"Renovate config file (https://github.com/renovatebot/renovate)",fileMatch:["renovate.json","renovate.json5",".github/renovate.json",".github/renovate.json5",".renovaterc",".renovaterc.json"],url:"https://docs.renovatebot.com/renovate-schema.json"},{name:"RoadRunner",description:"Spiral Roadrunner config schema",fileMatch:[".rr.yml",".rr.yaml"],url:"https://json.schemastore.org/roadrunner"},{name:"sarif-1.0.0.json",description:"Static Analysis Results Interchange Format (SARIF) version 1",url:"https://json.schemastore.org/sarif-1.0.0.json"},{name:"sarif-2.0.0.json",description:"Static Analysis Results Interchange Format (SARIF) version 2",url:"https://json.schemastore.org/sarif-2.0.0.json"},{name:"2.0.0-csd.2.beta.2018-10-10",description:"Static Analysis Results Format (SARIF) Version 2.0.0-csd.2.beta-2018-10-10",url:"https://json.schemastore.org/2.0.0-csd.2.beta.2018-10-10.json"},{name:"sarif-2.1.0-rtm.2",description:"Static Analysis Results Format (SARIF), Version 2.1.0-rtm.2",url:"https://json.schemastore.org/sarif-2.1.0-rtm.2.json"},{name:"sarif-external-property-file-2.1.0-rtm.2",description:"Static Analysis Results Format (SARIF) External Property File Format, Version 2.1.0-rtm.2",url:"https://json.schemastore.org/sarif-external-property-file-2.1.0-rtm.2.json"},{name:"sarif-2.1.0-rtm.3",description:"Static Analysis Results Format (SARIF), Version 2.1.0-rtm.3",url:"https://json.schemastore.org/sarif-2.1.0-rtm.3.json"},{name:"sarif-external-property-file-2.1.0-rtm.3",description:"Static Analysis Results Format (SARIF) External Property File Format, Version 2.1.0-rtm.3",url:"https://json.schemastore.org/sarif-external-property-file-2.1.0-rtm.3.json"},{name:"sarif-2.1.0-rtm.4",description:"Static Analysis Results Format (SARIF), Version 2.1.0-rtm.4",url:"https://json.schemastore.org/sarif-2.1.0-rtm.4.json"},{name:"sarif-external-property-file-2.1.0-rtm.4",description:"Static Analysis Results Format (SARIF) External Property File Format, Version 2.1.0-rtm.4",url:"https://json.schemastore.org/sarif-external-property-file-2.1.0-rtm.4.json"},{name:"sarif-2.1.0-rtm.5",description:"Static Analysis Results Format (SARIF), Version 2.1.0-rtm.5",url:"https://json.schemastore.org/sarif-2.1.0-rtm.5.json"},{name:"sarif-external-property-file-2.1.0-rtm.5",description:"Static Analysis Results Format (SARIF) External Property File Format, Version 2.1.0-rtm.5",url:"https://json.schemastore.org/sarif-external-property-file-2.1.0-rtm.5.json"},{name:"Schema Catalog",description:"JSON Schema catalog files compatible with SchemaStore.org",url:"https://json.schemastore.org/schema-catalog"},{name:"schema.org - Action",description:"JSON Schema for Action as defined by schema.org",url:"https://json.schemastore.org/schema-org-action"},{name:"schema.org - ContactPoint",description:"JSON Schema for ContactPoint as defined by schema.org",url:"https://json.schemastore.org/schema-org-contact-point"},{name:"schema.org - Place",description:"JSON Schema for Place as defined by schema.org",url:"https://json.schemastore.org/schema-org-place"},{name:"schema.org - Thing",description:"JSON Schema for Thing as defined by schema.org",url:"https://json.schemastore.org/schema-org-thing"},{name:"settings.job",description:"Azure Webjob settings file",fileMatch:["settings.job"],url:"https://json.schemastore.org/settings.job"},{name:"skyuxconfig.json",description:"SKY UX CLI configuration file",fileMatch:["skyuxconfig.json","skyuxconfig.*.json"],url:"https://raw.githubusercontent.com/blackbaud/skyux-builder/master/skyuxconfig-schema.json"},{name:"snapcraft",description:"snapcraft project (https://snapcraft.io)",fileMatch:[".snapcraft.yaml","snapcraft.yaml"],url:"https://raw.githubusercontent.com/snapcore/snapcraft/master/schema/snapcraft.json"},{name:"Solidarity",description:"CLI config for enforcing environment settings",fileMatch:[".solidarity",".solidarity.json"],url:"https://json.schemastore.org/solidaritySchema"},{name:"Source Maps v3",description:"Source Map files version 3",fileMatch:["*.map"],url:"https://json.schemastore.org/sourcemap-v3"},{name:"Sponge Mixin configuration",description:"Configuration file for SpongePowered's Mixin library",fileMatch:["*.mixins.json"],url:"https://json.schemastore.org/sponge-mixins"},{name:".sprite files",description:"Schema for image sprite generation files",fileMatch:["*.sprite"],url:"https://json.schemastore.org/sprite"},{name:"Stryker Mutator",description:"Configuration file for Stryker Mutator, the mutation testing framework for JavaScript and friends. See https://stryker-mutator.io.",fileMatch:["stryker.conf.json","stryker-*.conf.json"],url:"https://raw.githubusercontent.com/stryker-mutator/stryker/master/packages/api/schema/stryker-core.json"},{name:"StyleCop Analyzers Configuration",description:"Configuration file for StyleCop Analyzers",fileMatch:["stylecop.json"],url:"https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json"},{name:".stylelintrc",description:"Configuration file for stylelint",fileMatch:[".stylelintrc","stylelintrc.json",".stylelintrc.json"],url:"https://json.schemastore.org/stylelintrc"},{name:"Swagger API 2.0",description:"Swagger API 2.0 schema",fileMatch:["swagger.json"],url:"https://json.schemastore.org/swagger-2.0"},{name:"Taurus",description:"Taurus bzt cli framework config",fileMatch:["bzt.yml","bzt.yaml","taurus.yml","taurus.yaml"],url:"https://json.schemastore.org/taurus"},{name:"template.json",description:"JSON schema .NET template files",fileMatch:[".template.config/template.json"],url:"https://json.schemastore.org/template"},{name:"templatsources.json",description:"SideWaffle template source schema",fileMatch:["templatesources.json"],url:"https://json.schemastore.org/templatesources"},{name:"tmLanguage",description:"Language grammar description files in Textmate and compatible editors",fileMatch:["*.tmLanguage.json"],url:"https://raw.githubusercontent.com/Septh/tmlanguage/master/tmLanguage.schema.json"},{name:".travis.yml",description:"Travis CI configuration file",fileMatch:[".travis.yml"],url:"https://json.schemastore.org/travis"},{name:"Traefik v2",description:"Traefik v2 YAML configuration file",fileMatch:["traefik.yml","traefik.yaml"],url:"https://json.schemastore.org/traefik-v2"},{name:"tsconfig.json",description:"TypeScript compiler configuration file",fileMatch:["tsconfig.json"],url:"https://json.schemastore.org/tsconfig"},{name:"tsd.json",description:"JSON schema for DefinatelyTyped description manager (TSD)",fileMatch:["tsd.json"],url:"https://json.schemastore.org/tsd"},{name:"tsdrc.json",description:"TypeScript Definition manager (tsd) global settings file",fileMatch:[".tsdrc"],url:"https://json.schemastore.org/tsdrc"},{name:"ts-force-config.json",description:"Generated Typescript classes for Salesforce",fileMatch:["ts-force-config.json"],url:"https://json.schemastore.org/ts-force-config"},{name:"tslint.json",description:"TypeScript Lint configuration file",fileMatch:["tslint.json","tslint.yaml","tslint.yml"],url:"https://json.schemastore.org/tslint"},{name:"typewiz.json",description:"Typewiz configuration file",fileMatch:["typewiz.json"],url:"https://json.schemastore.org/typewiz"},{name:"typings.json",description:"Typings TypeScript definitions manager definition file",fileMatch:["typings.json"],url:"https://json.schemastore.org/typings"},{name:"typingsrc.json",description:"Typings TypeScript definitions manager configuration file",fileMatch:[".typingsrc"],url:"https://json.schemastore.org/typingsrc"},{name:"up.json",description:"Up configuration file",fileMatch:["up.json"],url:"https://json.schemastore.org/up.json"},{name:"ui5-manifest",description:"UI5/OPENUI5 descriptor file",fileMatch:[".manifest"],url:"https://json.schemastore.org/ui5-manifest"},{name:"UI5 Manifest",description:"UI5 Manifest (manifest.json)",fileMatch:["webapp/manifest.json","src/main/webapp/manifest.json"],url:"https://raw.githubusercontent.com/SAP/ui5-manifest/master/schema.json"},{name:"ui5.yaml",description:"UI5 Tooling Configuration File (ui5.yaml)",fileMatch:["ui5.yaml","*-ui5.yaml","*.ui5.yaml"],url:"https://sap.github.io/ui5-tooling/schema/ui5.yaml.json"},{name:"vega.json",description:"Vega visualization specification file",fileMatch:["*.vg","*.vg.json"],url:"https://json.schemastore.org/vega"},{name:"vega-lite.json",description:"Vega-Lite visualization specification file",fileMatch:["*.vl","*.vl.json"],url:"https://json.schemastore.org/vega-lite"},{name:"Vela Pipeline Configuration",description:"Vela Pipeline Configuration File",fileMatch:[".vela.yml",".vela.yaml"],url:"https://github.com/go-vela/types/releases/latest/download/schema.json"},{name:"version.json",description:"A project version descriptor file used by Nerdbank.GitVersioning",fileMatch:["version.json"],url:"https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json"},{name:"vim-addon-info",description:"JSON schema for vim plugin addon-info.json metadata files",fileMatch:["*vim*/addon-info.json"],url:"https://json.schemastore.org/vim-addon-info"},{name:"vsls.json",description:"Visual Studio Live Share configuration file",fileMatch:[".vsls.json"],url:"https://json.schemastore.org/vsls"},{name:"vs-2017.3.host.json",description:"JSON schema for Visual Studio template host file",fileMatch:["vs-2017.3.host.json"],url:"https://json.schemastore.org/vs-2017.3.host"},{name:"vs-nesting.json",description:"JSON schema for Visual Studio's file nesting feature",fileMatch:["*.filenesting.json",".filenesting.json"],url:"https://json.schemastore.org/vs-nesting"},{name:".vsconfig",description:"JSON schema for Visual Studio component configuration files",fileMatch:["*.vsconfig"],url:"https://json.schemastore.org/vsconfig"},{name:".vsext",description:"JSON schema for Visual Studio extension pack manifests",fileMatch:["*.vsext"],url:"https://json.schemastore.org/vsext"},{name:"VSIX CLI publishing",description:"JSON schema for Visual Studio extension publishing",fileMatch:["vs-publish.json"],url:"https://json.schemastore.org/vsix-publish"},{name:"vss-extension.json",description:"JSON Schema for Azure DevOps Extensions",fileMatch:["vss-extension.json"],url:"https://json.schemastore.org/vss-extension"},{name:"WebExtensions",description:"JSON schema for WebExtension manifest files",fileMatch:["manifest.json"],url:"https://json.schemastore.org/webextension"},{name:"Web App Manifest",description:"Web Application manifest file",fileMatch:["manifest.json","*.webmanifest"],url:"https://json.schemastore.org/web-manifest-combined"},{name:"webjobs-list.json",description:"Azure Webjob list file",fileMatch:["webjobs-list.json"],url:"https://json.schemastore.org/webjobs-list"},{name:"webjobpublishsettings.json",description:"Azure Webjobs publish settings file",fileMatch:["webjobpublishsettings.json"],url:"https://json.schemastore.org/webjob-publish-settings"},{name:"Web types",description:"JSON standard for web component libraries metadata",fileMatch:["web-types.json","*.web-types.json"],url:"https://json.schemastore.org/web-types"},{name:"JSON-stat 2.0",description:"JSON-stat 2.0 Schema",url:"https://json-stat.org/format/schema/2.0/"},{name:"KSP-AVC",description:"The .version file format for KSP-AVC",fileMatch:["*.version"],url:"https://raw.githubusercontent.com/linuxgurugamer/KSPAddonVersionChecker/master/KSP-AVC.schema.json"},{name:"KSP-CKAN",description:"Metadata spec for KSP-CKAN",fileMatch:["*.ckan"],url:"https://raw.githubusercontent.com/KSP-CKAN/CKAN/master/CKAN.schema"},{name:"JSON Schema Draft 4",description:"Meta-validation schema for JSON Schema Draft 4",url:"https://json-schema.org/draft-04/schema"},{name:"JSON Schema Draft 7",description:"Meta-validation schema for JSON Schema Draft 7",url:"https://json-schema.org/draft-07/schema"},{name:"JSON Schema Draft 8",description:"Meta-validation schema for JSON Schema Draft 8",url:"https://json-schema.org/draft/2019-09/schema"},{name:"xunit.runner.json",description:"xUnit.net runner configuration file",fileMatch:["xunit.runner.json"],url:"https://json.schemastore.org/xunit.runner.schema"},{name:"servicehub.service.json",description:"Microsoft ServiceHub Service",fileMatch:["*.servicehub.service.json"],url:"https://json.schemastore.org/servicehub.service.schema"},{name:"servicehub.config.json",description:"Microsoft ServiceHub Configuration",fileMatch:["servicehub.config.json"],url:"https://json.schemastore.org/servicehub.config.schema"},{name:".cryproj engine-5.2",description:"A JSON schema for CRYENGINE projects (.cryproj files)",fileMatch:["*.cryproj"],url:"https://json.schemastore.org/cryproj.52.schema"},{name:".cryproj engine-5.3",description:"A JSON schema for CRYENGINE projects (.cryproj files)",fileMatch:["*.cryproj"],url:"https://json.schemastore.org/cryproj.53.schema"},{name:".cryproj engine-5.4",description:"A JSON schema for CRYENGINE projects (.cryproj files)",fileMatch:["*.cryproj"],url:"https://json.schemastore.org/cryproj.54.schema"},{name:".cryproj engine-5.5",description:"A JSON schema for CRYENGINE projects (.cryproj files)",fileMatch:["*.cryproj"],url:"https://json.schemastore.org/cryproj.55.schema"},{name:".cryproj engine-dev",description:"A JSON schema for CRYENGINE projects (.cryproj files)",fileMatch:["*.cryproj"],url:"https://json.schemastore.org/cryproj.dev.schema"},{name:".cryproj (generic)",description:"A JSON schema for CRYENGINE projects (.cryproj files)",fileMatch:["*.cryproj"],url:"https://json.schemastore.org/cryproj"},{name:"typedoc.json",description:"A JSON schema for the Typedoc configuration file",fileMatch:["typedoc.json"],url:"https://json.schemastore.org/typedoc"},{name:"huskyrc",description:"Husky can prevent bad `git commit`, `git push` and more \u{1F436} woof!",fileMatch:[".huskyrc",".huskyrc.json"],url:"https://json.schemastore.org/huskyrc"},{name:".lintstagedrc",description:"JSON schema for lint-staged config",fileMatch:[".lintstagedrc",".lintstagedrc.json"],url:"https://json.schemastore.org/lintstagedrc.schema"},{name:"mta.yaml",description:"A JSON schema for MTA projects v3.3",fileMatch:["mta.yaml","mta.yml"],url:"https://json.schemastore.org/mta"},{name:"mtad.yaml",description:"A JSON schema for MTA deployment descriptors v3.3",fileMatch:["mtad.yaml","mtad.yml"],url:"https://json.schemastore.org/mtad"},{name:".mtaext",description:"A JSON schema for MTA extension descriptors v3.3",fileMatch:["*.mtaext"],url:"https://json.schemastore.org/mtaext"},{name:"xs-app.json",description:"JSON schema for the SAP Application Router v8.2.2",fileMatch:["xs-app.json"],url:"https://json.schemastore.org/xs-app.json"},{name:"Opctl",description:"Opctl schema for describing an op",url:"https://json.schemastore.org/opspec-io-0.1.7",fileMatch:[".opspec/*/*.yml",".opspec/*/*.yaml"]},{name:"HEMTT",description:"HEMTT Project File",url:"https://json.schemastore.org/hemtt-0.6.2",fileMatch:["hemtt.json","hemtt.toml"],versions:{"0.6.2":"https://json.schemastore.org/hemtt-0.6.2"}},{name:"now",description:"ZEIT Now project configuration file",fileMatch:["now.json"],url:"https://json.schemastore.org/now"},{name:"taskcat",description:"taskcat",fileMatch:[".taskcat.yml"],url:"https://raw.githubusercontent.com/aws-quickstart/taskcat/master/taskcat/cfg/config_schema.json"},{name:"BizTalkServerApplicationSchema",description:"BizTalk server application inventory json file.",fileMatch:["BizTalkServerInventory.json"],url:"https://json.schemastore.org/BizTalkServerApplicationSchema"},{name:"httpmockrc",description:"Http-mocker is a tool for mock local requests or proxy remote requests.",fileMatch:[".httpmockrc",".httpmock.json"],url:"https://json.schemastore.org/httpmockrc"},{name:"neoload",description:"Neotys as-code load test specification, more at: https://github.com/Neotys-Labs/neoload-cli",fileMatch:[".nl.yaml",".nl.yml",".nl.json",".neoload.yaml",".neoload.yml",".neoload.json"],url:"https://raw.githubusercontent.com/Neotys-Labs/neoload-cli/master/resources/as-code.latest.schema.json"},{name:"release drafter",description:"Release Drafter configuration file",fileMatch:[".github/release-drafter.yml"],url:"https://raw.githubusercontent.com/release-drafter/release-drafter/master/schema.json"},{name:"zuul",description:"Zuul CI configuration file",fileMatch:["*zuul.d/*.yaml","*/.zuul.yaml"],url:"https://raw.githubusercontent.com/pycontribs/zuul-lint/master/zuul_lint/zuul-schema.json"},{name:"Briefcase",description:"Microsoft Briefcase configuration file",fileMatch:["briefcase.yaml"],url:"https://raw.githubusercontent.com/microsoft/Briefcase/master/mlbriefcase/briefcase-schema.json"},{name:"httparchive",description:"HTTP Archive",fileMatch:["*.har"],url:"https://raw.githubusercontent.com/ahmadnassri/har-schema/master/lib/har.json"},{name:"jsdoc",description:"JSDoc configuration file",fileMatch:["conf.js*","jsdoc.js*"],url:"https://json.schemastore.org/jsdoc-1.0.0"},{name:"Ray",description:"Ray autocluster configuration file",fileMatch:["ray-*-cluster.yaml"],url:"https://raw.githubusercontent.com/ray-project/ray/master/python/ray/autoscaler/ray-schema.json"},{name:"Hadolint",description:"A smarter Dockerfile linter that helps you build best practice Docker images.",fileMatch:[".hadolint.yaml","hadolint.yaml"],url:"https://json.schemastore.org/hadolint"},{name:"helmfile",description:"Helmfile is a declarative spec for deploying helm charts",fileMatch:["helmfile.yaml","helmfile.d/**/*.yaml"],url:"https://json.schemastore.org/helmfile"},{name:"Container Structure Test",description:"The Container Structure Tests provide a powerful framework to validate the structure of a container image.",fileMatch:["container-structure-test.yaml","structure-test.yaml"],url:"https://json.schemastore.org/container-structure-test"},{name:"\u017Dinoma",description:"\u017Dinoma incremental build configuration",fileMatch:["zinoma.yml"],url:"https://github.com/fbecart/zinoma/releases/latest/download/zinoma-schema.json"},{name:"Windows Package Manager",description:"Windows Package Manager Manifest file",url:"http://json.schemastore.org/winget-pkgs",fileMatch:["manifests/*/*/*.yaml"]},{name:".commitlintrc",description:"JSON schema for commitlint configuration files",fileMatch:[".commitlintrc",".commitlintrc.json"],url:"https://json.schemastore.org/commitlintrc"},{name:"Uniswap Token List",description:"A list of tokens compatible with the Uniswap Interface",fileMatch:["*.tokenlist.json"],url:"https://uniswap.org/tokenlist.schema.json"},{name:"Yippee-Ki-JSON configuration YML",description:"Action and rule configuration descriptor for Yippee-Ki-JSON transformations.",fileMatch:["**/yippee-*.yml","**/*.yippee.yml"],url:"https://raw.githubusercontent.com/nagyesta/yippee-ki-json/main/schema/yippee-ki-json_config_schema.json",versions:{"1.1.2":"https://raw.githubusercontent.com/nagyesta/yippee-ki-json/v1.1.2/schema/yippee-ki-json_config_schema.json",latest:"https://raw.githubusercontent.com/nagyesta/yippee-ki-json/main/schema/yippee-ki-json_config_schema.json"}},{name:"docker-compose.yml",description:"The Compose specification establishes a standard for the definition of multi-container platform-agnostic applications. ",fileMatch:["**/docker-compose.yml","**/docker-compose.yaml","**/docker-compose.*.yml","**/docker-compose.*.yaml","**/compose.yml","**/compose.yaml","**/compose.*.yml","**/compose.*.yaml"],url:"https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"},{name:"devinit",description:"Devinit configuration file schema.",url:"https://json.schemastore.org/devinit.schema-2.0",fileMatch:["**/*devinit*.json"],versions:{"1.0":"https://json.schemastore.org/devinit.schema-1.0","2.0":"https://json.schemastore.org/devinit.schema-2.0"}},{name:"tsoa",description:"JSON Schema for the tsoa configuration file",url:"https://json.schemastore.org/tsoa",fileMatch:["**/tsoa.json"]},{name:"API Builder",description:"apibuilder.io schema",fileMatch:["**/api.json"],url:"http://json.schemastore.org/apibuilder.json"}],Li={$schema:Ou,version:Du,schemas:Eu};var Al="/".charCodeAt(0),_r=".".charCodeAt(0);function Au(e){let t=[];for(let n of e)n.length===0||n.length===1&&n.charCodeAt(0)===_r||(n.length===2&&n.charCodeAt(0)===_r&&n.charCodeAt(1)===_r?t.pop():t.push(n));e.length>1&&e[e.length-1].length===0&&t.push("");let r=t.join("/");return e[0].length===0&&(r="/"+r),r}function Fi(e,...t){let r=e.path.split("/");for(let n of t)r.push(...n.split("/"));return e.with({path:Au(r)})}var Iu="http://json-schema.org/draft-07/schema#",Lu="object",Fu={configurationEntry:{defaultSnippets:[{body:{title:"${1}",properties:{}}}],properties:{title:{type:"string",description:"A summary of the settings."},properties:{description:"Description of the configuration properties.",type:"object",propertyNames:{pattern:"\\S+",patternErrorMessage:"Property should not be empty."},additionalProperties:{anyOf:[{$ref:"http://json-schema.org/draft-07/schema#"},{type:"object",properties:{scope:{type:"string",enum:["application","machine","window","resource","language-overridable","machine-overridable"],default:"window",enumDescriptions:["Configuration that can be configured only in the user settings.","Configuration that can be configured only in the user settings or only in the remote settings.","Configuration that can be configured in the user, remote or workspace settings.","Configuration that can be configured in the user, remote, workspace or folder settings.","Resource configuration that can be configured in language specific settings.","Machine configuration that can be configured also in workspace or folder settings."],description:"Scope in which the configuration is applicable. Available scopes are `application`, `machine`, `window`, `resource`, and `machine-overridable`."},enumDescriptions:{type:"array",items:{type:"string"},description:"Descriptions for enum values"},markdownEnumDescriptions:{type:"array",items:{type:"string"},description:"Descriptions for enum values in the markdown format."},markdownDescription:{type:"string",description:"The description in the markdown format."},deprecationMessage:{type:"string",description:"If set, the property is marked as deprecated and the given message is shown as an explanation."},markdownDeprecationMessage:{type:"string",description:"If set, the property is marked as deprecated and the given message is shown as an explanation in the markdown format."}}}]}}}}},Ju={engines:{type:"object",properties:{coc:{type:"string",defaultSnippets:[{body:"^${1:version}"},{body:">=${1:version}"}]}}},activationEvents:{type:"array",items:{type:"string",defaultSnippets:[{body:"onLanguage:${1:language}"},{body:"onCommand:${1:command}"},{body:"workspaceContains${1:filepath}"},{body:"onFileSystem${1:scheme}"},{body:"*"}]}},contributes:{type:"object",description:"Extension contributes definitions, including commands, configuration and jsonValidation.",properties:{rootPatterns:{type:"array",items:{type:"object",defaultSnippets:[{body:{filetype:"${1:filetype}",patterns:[]}}],properties:{filetype:{type:"string"},patterns:{type:"array",items:{type:"string"}}},required:["filetype","patterns"]}},commands:{type:"array",description:"Contributes extension commands.",items:{type:"object",defaultSnippets:[{body:{title:"${1:Title}",command:"${2:command}"}}],properties:{title:{type:"string",description:"Command title."},command:{type:"string",description:"Command id."}}}},configuration:{type:"object",description:"Contributes configuration settings.",oneOf:[{$ref:"#/definitions/configurationEntry"},{type:"array",items:{$ref:"#/definitions/configurationEntry"}}]},jsonValidation:{type:"array",description:"Contributes json schema configuration.",items:{type:"object",defaultSnippets:[{body:{fileMatch:"${1:file.json}",url:"${2:url}"}}],properties:{fileMatch:{type:["string","array"],description:"The file pattern (or an array of patterns) to match, for example 'package.json' or '*.launch'. Exclusion patterns start with '!'",items:{type:["string"]}},url:{description:"A schema URL ('http:', 'https:') or relative path to the extension folder ('./').",type:"string"}}}}}}},Ji={$schema:Iu,type:Lu,definitions:Fu,properties:Ju};"use strict";function en(e,t=0){switch(typeof e){case"object":return e===null?Te(349,t):Array.isArray(e)?zu(e,t):$u(e,t);case"string":return Wi(e,t);case"boolean":return Wu(e,t);case"number":return Te(e,t);case"undefined":return Te(e,937);default:return Te(e,617)}}function Te(e,t){return(t<<5)-t+e|0}function Wu(e,t){return Te(e?433:863,t)}function Wi(e,t){t=Te(149417,t);for(let r=0,n=e.length;ren(n,r),t)}function $u(e,t){return t=Te(181387,t),Object.keys(e).sort().reduce((r,n)=>(r=Wi(n,r),en(e[n],r)),t)}var kr;(function(t){t.type=new R.RequestType("json/validate")})(kr||(kr={}));var Mr;(function(t){t.type=new R.RequestType("vscode/content")})(Mr||(Mr={}));var Cr;(function(t){t.type=new R.NotificationType("json/schemaContent")})(Cr||(Cr={}));var Ot;(function(t){t.type=new R.NotificationType("json/schemaAssociations")})(Ot||(Ot={}));var rn;(function(n){n.enableFormatter="json.format.enable",n.enableSchemaDownload="json.schemaDownload.enable",n.maxItemsComputed="json.maxItemsComputed"})(rn||(rn={}));async function Ui(e){let{subscriptions:t,logger:r}=e,n=Uu(),o=R.workspace.getConfiguration().get("json",{});if(!o.enable)return;let s=e.asAbsolutePath("lib/server.js"),c=["json","jsonc"],p=new Map;R.events.on("BufEnter",S=>{let h=R.workspace.getDocument(S);if(!h)return;let A=p.get(h.uri);A&&b.outputChannel.appendLine(`Schema error: ${A}`)},null,t);let g={module:s,transport:R.TransportKind.ipc,options:{cwd:R.workspace.root,execArgv:o.execArgv}},m={documentSelector:c,synchronize:{configurationSection:["json","http"],fileEvents:R.workspace.createFileSystemWatcher("**/*.json")},initializationOptions:{handledSchemaProtocols:["file"],customCapabilities:{rangeFormatting:{editLimit:1e3}}},outputChannelName:"json",diagnosticCollectionName:"json",middleware:{workspace:{didChangeConfiguration:()=>b.sendNotification(nn.DidChangeConfigurationNotification.type,{settings:Bu()})},handleDiagnostics:(S,h,A)=>{let q=h.findIndex(O=>O.code===768);if(S.endsWith("coc-settings.json")&&(h=h.filter(O=>O.code!=521)),q===-1)return p.delete(S.toString()),A(S,h);let C=h[q];p.set(S.toString(),C.message);let F=R.workspace.getDocument(S);F&&F.uri==S&&b.outputChannel.appendLine(`Schema error: ${C.message}`),A(S,h)},resolveCompletionItem:(S,h,A)=>Promise.resolve(A(S,h)).then(q=>(q.data.detail&&(q.detail=q.data.detail),q)),provideCompletionItem:(S,h,A,q,C)=>Promise.resolve(C(S,h,A,q)).then(F=>{let O=R.workspace.getDocument(S.uri);if(!O)return[];let oe=F.hasOwnProperty("isIncomplete")?F.items:F,D=O.getline(h.line);for(let ce of oe){let{textEdit:ye,insertText:Ee,label:Ae,filterText:ve}=ce;if(ce.insertText=null,ye&&ye.newText){let Se=Ee||ye.newText;ye.newText=Se;let{start:Dt,end:on}=ye.range;D[Dt.character]&&D[on.character-1]&&/^".*"$/.test(Ae)&&(ce.label=ce.label.slice(1,-1))}ve&&/^".*"$/.test(ve)&&(ce.filterText=ve.slice(1,-1))}let ie={isIncomplete:!1,items:oe};return oe.length&&oe.every(ce=>ce.kind==R.CompletionItemKind.Property)&&(ie.startcol=O.fixStartcol(h,["."])),ie})}},b=new R.LanguageClient("json","Json language server",g,m);t.push(R.services.registLanguageClient(b)),b.onReady().then(()=>{b.sendNotification(Ot.type,Pr(e)),R.extensions.onDidUnloadExtension(()=>{b.sendNotification(Ot.type,Pr(e))},null,t),R.extensions.onDidLoadExtension(()=>{b.sendNotification(Ot.type,Pr(e))},null,t);let S=!0;function h(){S=R.workspace.getConfiguration().get(rn.enableSchemaDownload)!==!1}h(),R.workspace.onDidChangeConfiguration(C=>{C.affectsConfiguration(rn.enableSchemaDownload)&&h()},null,t);let A={};b.onRequest(Mr.type,async C=>{let F=qt.parse(C);if(F.scheme==="untitled")return Promise.reject(new nn.ResponseError(3,`Unable to load ${F.scheme}`));if(C=="vscode://settings"){let O=await Bi.promisify(zi.default.readFile)(tn.default.join(R.workspace.pluginRoot,"data/schema.json"),"utf8"),oe=JSON.parse(O),D=Object.assign({},oe);D.properties=D.properties||{};let ie=R.extensions.schemes;return ie&&Object.assign(D.properties,ie),R.extensions.all.forEach(ce=>{let{packageJSON:ye}=ce,{contributes:Ee}=ye;if(!Ee)return;let{configuration:Ae}=Ee;if(Ae){let{properties:ve,definitions:Se}=Ae;ve&&Object.assign(D.properties,ve),Se&&Object.assign(D.definitions,Se)}}),JSON.stringify(D)}if(C=="vscode://schemas/vscode-extensions")return JSON.stringify(Ji);if(F.scheme!=="http"&&F.scheme!=="https"){let O=await R.workspace.loadFile(C);return A[F.toString()]=!0,O.getDocumentContent()}else{if(S)return await Promise.resolve(n.getContent(C));r.warn("Schema download disabled!")}return"{}"});let q=C=>A[C]?(b.sendNotification(Cr.type,C),!0):!1;R.workspace.onDidChangeTextDocument(C=>q(C.textDocument.uri)),R.workspace.onDidCloseTextDocument(C=>{let F=C.uri;q(F)&&delete A[F],p.delete(C.uri)},null,t)},S=>{});let _=R.window.createStatusBarItem(0,{progress:!0});t.push(_),t.push(R.commands.registerCommand("json.retryResolveSchema",async()=>{let S=await R.workspace.document;!S||["json","jsonc"].indexOf(S.filetype)==-1||(_.isProgress=!0,_.text="loading schema",_.show(),b.sendRequest(kr.type,S.uri).then(h=>{_.text="\u26A0\uFE0F",_.isProgress=!1;let A=h.findIndex(q=>q.code===768);if(A!==-1){let q=h[A];p.set(S.uri,q.message),_.show()}else _.hide()},()=>{_.show(),_.isProgress=!1,_.text="\u26A0\uFE0F"}))}))}function Bu(){let e=R.workspace.getConfiguration("http"),t={http:{proxy:e.get("proxy"),proxyStrictSSL:e.get("proxyStrictSSL")},json:{format:R.workspace.getConfiguration("json").get("format"),schemas:[]}},r=Object.create(null),n=(s,c,p)=>{for(let g of s){let m=Hu(g,c);if(!m)continue;let b=r[m];b||(b=r[m]={url:m,fileMatch:[]},t.json.schemas.push(b));let _=g.fileMatch,S=b.fileMatch;if(Array.isArray(_))if(p)for(let h of _)h[0]==="/"?(S.push(p+h),S.push(p+"/*"+h)):(S.push(p+"/"+h),S.push(p+"/*/"+h));else S.push(..._);g.schema&&(b.schema=g.schema)}},o=R.workspace.getConfiguration("json",null).get("schemas");return Array.isArray(o)&&n(o,R.workspace.root),t}function Hu(e,t){let r=e.url;return r?t&&(r[0]==="."||r[0]==="/")&&(r=qt.file(tn.default.normalize(tn.default.join(t,r))).toString()):e.schema&&(r=e.schema.id||`vscode://schemas/custom/${encodeURIComponent(en(e.schema).toString(16))}`),r}function Uu(){return{getContent(e,t){return R.fetch(e,{headers:{"Accept-Encoding":"gzip, deflate"}}).then(n=>typeof n=="string"?n:Buffer.isBuffer(n)?$i.default(n.toString("utf8")):JSON.stringify(n))}}}function Pr(e){let t=[];t.push({fileMatch:["coc-settings.json"],uri:"vscode://settings"});for(let r of Li.schemas){let{fileMatch:n,url:o}=r;Array.isArray(n)?t.push({fileMatch:n,uri:o}):typeof n=="string"&&t.push({fileMatch:[n],uri:o})}return R.extensions.all.forEach(r=>{let n=r.packageJSON;if(n&&n.contributes&&n.contributes.jsonValidation){let o=n.contributes.jsonValidation;Array.isArray(o)&&o.forEach(s=>{let{fileMatch:c,url:p}=s;if(typeof c=="string"&&(c=[c]),Array.isArray(c)&&typeof p=="string"){let g=p;g[0]==="."&&g[1]==="/"&&(g=Fi(qt.file(r.extensionPath),g).toString()),c=c.map(m=>(m[0]==="%"?(m=m.replace(/%APP_SETTINGS_HOME%/,"/User"),m=m.replace(/%MACHINE_SETTINGS_HOME%/,"/Machine"),m=m.replace(/%APP_WORKSPACES_HOME%/,"/Workspaces")):m.match(/^(\w+:\/\/|\/|!)/)||(m="/"+m),m)),t.push({fileMatch:c,uri:g})}})}}),t} +//# sourceMappingURL=index.js.map diff --git a/coc/extensions/node_modules/coc-json/lib/server.js b/coc/extensions/node_modules/coc-json/lib/server.js new file mode 100644 index 0000000..f8594c4 --- /dev/null +++ b/coc/extensions/node_modules/coc-json/lib/server.js @@ -0,0 +1,87 @@ +var df=Object.create,vn=Object.defineProperty,hf=Object.getPrototypeOf,pf=Object.prototype.hasOwnProperty,gf=Object.getOwnPropertyNames,mf=Object.getOwnPropertyDescriptor;var Ys=e=>vn(e,"__esModule",{value:!0});var W=(e,t)=>()=>(t||(t={exports:{}},e(t.exports,t)),t.exports),vf=(e,t)=>{Ys(e);for(var r in t)vn(e,r,{get:t[r],enumerable:!0})},yf=(e,t,r)=>{if(Ys(e),t&&typeof t=="object"||typeof t=="function")for(let n of gf(t))!pf.call(e,n)&&n!=="default"&&vn(e,n,{get:()=>t[n],enumerable:!(r=mf(t,n))||r.enumerable});return e},Ke=e=>e&&e.__esModule?e:yf(vn(e!=null?df(hf(e)):{},"default",{value:e,enumerable:!0}),e);var yn=W(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});function bf(e){return e===!0||e===!1}et.boolean=bf;function Zs(e){return typeof e=="string"||e instanceof String}et.string=Zs;function wf(e){return typeof e=="number"||e instanceof Number}et.number=wf;function Cf(e){return e instanceof Error}et.error=Cf;function Qs(e){return typeof e=="function"}et.func=Qs;function Ks(e){return Array.isArray(e)}et.array=Ks;function xf(e){return Ks(e)&&e.every(t=>Zs(t))}et.stringArray=xf;function Sf(e,t){return Array.isArray(e)&&e.every(t)}et.typedArray=Sf;function Tf(e){return e&&Qs(e.then)}et.thenable=Tf});var vt=W(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});var wi;function Ci(){if(wi===void 0)throw new Error("No runtime abstraction layer installed");return wi}(function(e){function t(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");wi=r}e.install=t})(Ci||(Ci={}));bi.default=Ci});var xi=W(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});var kf;(function(e){function t(r){return{dispose:r}}e.create=t})(kf=bn.Disposable||(bn.Disposable={}))});var sa=W(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});var _f=vt(),zt=xi(),Pf=require("util"),Ti=8192,ea=Buffer.from("\r","ascii")[0],ta=Buffer.from(` +`,"ascii")[0],Rf=`\r +`,ra=class{constructor(t="utf-8"){this._encoding=t,this.index=0,this.buffer=Buffer.allocUnsafe(Ti)}get encoding(){return this._encoding}append(t){let r;if(typeof t=="string"?r=Buffer.from(t,this._encoding):r=t,this.buffer.length-this.index>=r.length)this.buffer.set(r,this.index);else{var n=(Math.ceil((this.index+r.length)/Ti)+1)*Ti;this.index===0?(this.buffer=Buffer.allocUnsafe(n),this.buffer.set(r)):this.buffer=Buffer.concat([this.buffer.slice(0,this.index),r],n)}this.index+=r.length}tryReadHeaders(){let t=0;for(;t+3=this.index)return;let r=new Map;this.buffer.toString("ascii",0,t).split(Rf).forEach(o=>{let s=o.indexOf(":");if(s===-1)throw new Error("Message header must separate key and value using :");let u=o.substr(0,s),l=o.substr(s+1).trim();r.set(u,l)});let i=t+4;return this.buffer=this.buffer.slice(i),this.index=this.index-i,r}tryReadBody(t){if(this.indexthis.stream.off("close",t))}onError(t){return this.stream.on("error",t),zt.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),zt.Disposable.create(()=>this.stream.off("end",t))}onData(t){return this.stream.on("data",t),zt.Disposable.create(()=>this.stream.off("data",t))}},ia=class{constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),zt.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),zt.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),zt.Disposable.create(()=>this.stream.off("end",t))}write(t,r){return new Promise((n,i)=>{let o=s=>{s==null?n():i(s)};typeof t=="string"?this.stream.write(t,r,o):this.stream.write(t,o)})}end(){this.stream.end()}},oa=Object.freeze({messageBuffer:Object.freeze({create:e=>new ra(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>Promise.resolve(Buffer.from(JSON.stringify(e,void 0,0),t.charset))}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>e instanceof Buffer?Promise.resolve(JSON.parse(e.toString(t.charset))):Promise.resolve(JSON.parse(new Pf.TextDecoder(t.charset).decode(e)))})}),stream:Object.freeze({asReadableStream:e=>new na(e),asWritableStream:e=>new ia(e)}),console,timer:Object.freeze({setTimeout(e,t,...r){return setTimeout(e,t,...r)},clearTimeout(e){clearTimeout(e)},setImmediate(e,...t){return setImmediate(e,...t)},clearImmediate(e){clearImmediate(e)}})});function ki(){return oa}(function(e){function t(){_f.default.install(oa)}e.install=t})(ki||(ki={}));Si.default=ki});var ar=W(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});function Ef(e){return e===!0||e===!1}yt.boolean=Ef;function aa(e){return typeof e=="string"||e instanceof String}yt.string=aa;function Of(e){return typeof e=="number"||e instanceof Number}yt.number=Of;function Nf(e){return e instanceof Error}yt.error=Nf;function Ff(e){return typeof e=="function"}yt.func=Ff;function ua(e){return Array.isArray(e)}yt.array=ua;function qf(e){return ua(e)&&e.every(t=>aa(t))}yt.stringArray=qf});var _i=W(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});var Bt=ar(),ca;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.serverErrorStart=-32099,e.serverErrorEnd=-32e3,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.RequestCancelled=-32800,e.ContentModified=-32801,e.MessageWriteError=1,e.MessageReadError=2})(ca=te.ErrorCodes||(te.ErrorCodes={}));var wn=class extends Error{constructor(t,r,n){super(r);this.code=Bt.number(t)?t:ca.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,wn.prototype)}toJson(){return{code:this.code,message:this.message,data:this.data}}};te.ResponseError=wn;var ae=class{constructor(t,r){this._method=t,this._numberOfParams=r}get method(){return this._method}get numberOfParams(){return this._numberOfParams}};te.AbstractMessageSignature=ae;var la=class extends ae{constructor(t){super(t,0)}};te.RequestType0=la;var fa=class extends ae{constructor(t){super(t,1)}};te.RequestType=fa;var da=class extends ae{constructor(t){super(t,1)}};te.RequestType1=da;var ha=class extends ae{constructor(t){super(t,2)}};te.RequestType2=ha;var pa=class extends ae{constructor(t){super(t,3)}};te.RequestType3=pa;var ga=class extends ae{constructor(t){super(t,4)}};te.RequestType4=ga;var ma=class extends ae{constructor(t){super(t,5)}};te.RequestType5=ma;var va=class extends ae{constructor(t){super(t,6)}};te.RequestType6=va;var ya=class extends ae{constructor(t){super(t,7)}};te.RequestType7=ya;var ba=class extends ae{constructor(t){super(t,8)}};te.RequestType8=ba;var wa=class extends ae{constructor(t){super(t,9)}};te.RequestType9=wa;var Ca=class extends ae{constructor(t){super(t,1);this._=void 0}};te.NotificationType=Ca;var xa=class extends ae{constructor(t){super(t,0)}};te.NotificationType0=xa;var Sa=class extends ae{constructor(t){super(t,1)}};te.NotificationType1=Sa;var Ta=class extends ae{constructor(t){super(t,2)}};te.NotificationType2=Ta;var ka=class extends ae{constructor(t){super(t,3)}};te.NotificationType3=ka;var _a=class extends ae{constructor(t){super(t,4)}};te.NotificationType4=_a;var Pa=class extends ae{constructor(t){super(t,5)}};te.NotificationType5=Pa;var Ra=class extends ae{constructor(t){super(t,6)}};te.NotificationType6=Ra;var Ea=class extends ae{constructor(t){super(t,7)}};te.NotificationType7=Ea;var Oa=class extends ae{constructor(t){super(t,8)}};te.NotificationType8=Oa;var Na=class extends ae{constructor(t){super(t,9)}};te.NotificationType9=Na;function Af(e){let t=e;return t&&Bt.string(t.method)&&(Bt.string(t.id)||Bt.number(t.id))}te.isRequestMessage=Af;function jf(e){let t=e;return t&&Bt.string(t.method)&&e.id===void 0}te.isNotificationMessage=jf;function Df(e){let t=e;return t&&(t.result!==void 0||!!t.error)&&(Bt.string(t.id)||Bt.number(t.id)||t.id===null)}te.isResponseMessage=Df});var ur=W(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});var Mf=vt(),If;(function(e){let t={dispose(){}};e.None=function(){return t}})(If=Wr.Event||(Wr.Event={}));var Fa=class{add(t,r=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(t),this._contexts.push(r),Array.isArray(n)&&n.push({dispose:()=>this.remove(t,r)})}remove(t,r=null){if(!this._callbacks)return;let n=!1;for(let i=0,o=this._callbacks.length;i{this._callbacks||(this._callbacks=new Fa),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,r);let i={dispose:()=>{!this._callbacks||(this._callbacks.remove(t,r),i.dispose=$r._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(i),i}),this._event}fire(t){this._callbacks&&this._callbacks.invoke.call(this._callbacks,t)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};Wr.Emitter=$r;$r._noop=function(){}});var Oi=W(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});var qa=vt(),Lf=ar(),Pi=ur(),Ri;(function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Pi.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Pi.Event.None});function t(r){let n=r;return n&&(n===e.None||n===e.Cancelled||Lf.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}e.is=t})(Ri=Vr.CancellationToken||(Vr.CancellationToken={}));var Wf=Object.freeze(function(e,t){let r=qa.default().timer.setTimeout(e.bind(t),0);return{dispose(){qa.default().timer.clearTimeout(r)}}}),Ei=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Wf:(this._emitter||(this._emitter=new Pi.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Aa=class{get token(){return this._token||(this._token=new Ei),this._token}cancel(){this._token?this._token.cancel():this._token=Ri.Cancelled}dispose(){this._token?this._token instanceof Ei&&this._token.dispose():this._token=Ri.None}};Vr.CancellationTokenSource=Aa});var Da=W(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});var Cn=vt(),lr=ar(),Ni=ur(),$f;(function(e){function t(r){let n=r;return n&&lr.func(n.listen)&&lr.func(n.dispose)&&lr.func(n.onError)&&lr.func(n.onClose)&&lr.func(n.onPartialMessage)}e.is=t})($f=cr.MessageReader||(cr.MessageReader={}));var Fi=class{constructor(){this.errorEmitter=new Ni.Emitter,this.closeEmitter=new Ni.Emitter,this.partialMessageEmitter=new Ni.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t){this.errorEmitter.fire(this.asError(t))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(t){this.partialMessageEmitter.fire(t)}asError(t){return t instanceof Error?t:new Error(`Reader received error. Reason: ${lr.string(t.message)?t.message:"unknown"}`)}};cr.AbstractMessageReader=Fi;var qi;(function(e){function t(r){var n;let i,o,s,u=new Map,l,f=new Map;if(r===void 0||typeof r=="string")i=r!=null?r:"utf-8";else{if(i=(n=r.charset)!==null&&n!==void 0?n:"utf-8",r.contentDecoder!==void 0&&(s=r.contentDecoder,u.set(s.name,s)),r.contentDecoders!==void 0)for(let a of r.contentDecoders)u.set(a.name,a);if(r.contentTypeDecoder!==void 0&&(l=r.contentTypeDecoder,f.set(l.name,l)),r.contentTypeDecoders!==void 0)for(let a of r.contentTypeDecoders)f.set(a.name,a)}return l===void 0&&(l=Cn.default().applicationJson.decoder,f.set(l.name,l)),{charset:i,contentDecoder:s,contentDecoders:u,contentTypeDecoder:l,contentTypeDecoders:f}}e.fromOptions=t})(qi||(qi={}));var ja=class extends Fi{constructor(t,r){super();this.readable=t,this.options=qi.fromOptions(r),this.buffer=Cn.default().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0}set partialMessageTimeout(t){this._partialMessageTimeout=t}get partialMessageTimeout(){return this._partialMessageTimeout}listen(t){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=t;let r=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),r}onData(t){for(this.buffer.append(t);;){if(this.nextMessageLength===-1){let i=this.buffer.tryReadHeaders();if(!i)return;let o=i.get("Content-Length");if(!o)throw new Error("Header must provide a Content-Length property.");let s=parseInt(o);if(isNaN(s))throw new Error("Content-Length value must be a number.");this.nextMessageLength=s}let r=this.buffer.tryReadBody(this.nextMessageLength);if(r===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1;let n;this.options.contentDecoder!==void 0?n=this.options.contentDecoder.decode(r):n=Promise.resolve(r),n.then(i=>{this.options.contentTypeDecoder.decode(i,this.options).then(o=>{this.callback(o)},o=>{this.fireError(o)})},i=>{this.fireError(i)})}}clearPartialMessageTimer(){this.partialMessageTimer&&(Cn.default().timer.clearTimeout(this.partialMessageTimer),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=Cn.default().timer.setTimeout((t,r)=>{this.partialMessageTimer=void 0,t===this.messageToken&&(this.firePartialMessage({messageToken:t,waitingTime:r}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};cr.ReadableStreamMessageReader=ja});var Ia=W(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});var Vf=vt(),Ma=class{constructor(t=1){if(t<=0)throw new Error("Capacity must be greater than 0");this._capacity=t,this._active=0,this._waiting=[]}lock(t){return new Promise((r,n)=>{this._waiting.push({thunk:t,resolve:r,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||Vf.default().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let t=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let r=t.thunk();r instanceof Promise?r.then(n=>{this._active--,t.resolve(n),this.runNext()},n=>{this._active--,t.reject(n),this.runNext()}):(this._active--,t.resolve(r),this.runNext())}catch(r){this._active--,t.reject(r),this.runNext()}}};Ai.Semaphore=Ma});var Ha=W(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});var La=vt(),Hr=ar(),Hf=Ia(),Wa=ur(),zf="Content-Length: ",$a=`\r +`,Bf;(function(e){function t(r){let n=r;return n&&Hr.func(n.dispose)&&Hr.func(n.onClose)&&Hr.func(n.onError)&&Hr.func(n.write)}e.is=t})(Bf=fr.MessageWriter||(fr.MessageWriter={}));var ji=class{constructor(){this.errorEmitter=new Wa.Emitter,this.closeEmitter=new Wa.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t,r,n){this.errorEmitter.fire([this.asError(t),r,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(t){return t instanceof Error?t:new Error(`Writer received error. Reason: ${Hr.string(t.message)?t.message:"unknown"}`)}};fr.AbstractMessageWriter=ji;var Di;(function(e){function t(r){var n,i;return r===void 0||typeof r=="string"?{charset:r!=null?r:"utf-8",contentTypeEncoder:La.default().applicationJson.encoder}:{charset:(n=r.charset)!==null&&n!==void 0?n:"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:(i=r.contentTypeEncoder)!==null&&i!==void 0?i:La.default().applicationJson.encoder}}e.fromOptions=t})(Di||(Di={}));var Va=class extends ji{constructor(t,r){super();this.writable=t,this.options=Di.fromOptions(r),this.errorCount=0,this.writeSemaphore=new Hf.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(t){return this.options.contentTypeEncoder.encode(t,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let i=[];return i.push(zf,n.byteLength.toString(),$a),i.push($a),this.doWrite(t,i,n)},n=>{throw this.fireError(n),n})}doWrite(t,r,n){return this.writeSemaphore.lock(async()=>{try{return await this.writable.write(r.join(""),"ascii"),this.writable.write(n)}catch(i){this.handleError(i,t)}})}handleError(t,r){this.errorCount++,this.fireError(t,r,this.errorCount)}};fr.WriteableStreamMessageWriter=Va});var Ba=W(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});var qe;(function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last})(qe=dr.Touch||(dr.Touch={}));var Mi=class{constructor(){this[Symbol.toStringTag]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var t;return(t=this._head)===null||t===void 0?void 0:t.value}get last(){var t;return(t=this._tail)===null||t===void 0?void 0:t.value}has(t){return this._map.has(t)}get(t,r=qe.None){let n=this._map.get(t);if(!!n)return r!==qe.None&&this.touch(n,r),n.value}set(t,r,n=qe.None){let i=this._map.get(t);if(i)i.value=r,n!==qe.None&&this.touch(i,n);else{switch(i={key:t,value:r,next:void 0,previous:void 0},n){case qe.None:this.addItemLast(i);break;case qe.First:this.addItemFirst(i);break;case qe.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(t,i),this._size++}return this}delete(t){return!!this.remove(t)}remove(t){let r=this._map.get(t);if(!!r)return this._map.delete(t),this.removeItem(r),this._size--,r.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let t=this._head;return this._map.delete(t.key),this.removeItem(t),this._size--,t.value}forEach(t,r){let n=this._state,i=this._head;for(;i;){if(r?t.bind(r)(i.value,i.key,this):t(i.value,i.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let t=this,r=this._state,n=this._head,i={[Symbol.iterator](){return i},next(){if(t._state!==r)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:n.key,done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return i}values(){let t=this,r=this._state,n=this._head,i={[Symbol.iterator](){return i},next(){if(t._state!==r)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:n.value,done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return i}entries(){let t=this,r=this._state,n=this._head,i={[Symbol.iterator](){return i},next(){if(t._state!==r)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:[n.key,n.value],done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return i}[Symbol.iterator](){return this.entries()}trimOld(t){if(t>=this.size)return;if(t===0){this.clear();return}let r=this._head,n=this.size;for(;r&&n>t;)this._map.delete(r.key),r=r.next,n--;this._head=r,this._size=n,r&&(r.previous=void 0),this._state++}addItemFirst(t){if(!this._head&&!this._tail)this._tail=t;else if(this._head)t.next=this._head,this._head.previous=t;else throw new Error("Invalid list");this._head=t,this._state++}addItemLast(t){if(!this._head&&!this._tail)this._head=t;else if(this._tail)t.previous=this._tail,this._tail.next=t;else throw new Error("Invalid list");this._tail=t,this._state++}removeItem(t){if(t===this._head&&t===this._tail)this._head=void 0,this._tail=void 0;else if(t===this._head){if(!t.next)throw new Error("Invalid list");t.next.previous=void 0,this._head=t.next}else if(t===this._tail){if(!t.previous)throw new Error("Invalid list");t.previous.next=void 0,this._tail=t.previous}else{let r=t.next,n=t.previous;if(!r||!n)throw new Error("Invalid list");r.previous=n,n.next=r}t.next=void 0,t.previous=void 0,this._state++}touch(t,r){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(r!==qe.First&&r!==qe.Last)){if(r===qe.First){if(t===this._head)return;let n=t.next,i=t.previous;t===this._tail?(i.next=void 0,this._tail=i):(n.previous=i,i.next=n),t.previous=void 0,t.next=this._head,this._head.previous=t,this._head=t,this._state++}else if(r===qe.Last){if(t===this._tail)return;let n=t.next,i=t.previous;t===this._head?(n.previous=void 0,this._head=n):(n.previous=i,i.next=n),t.next=void 0,t.previous=this._tail,this._tail.next=t,this._tail=t,this._state++}}}toJSON(){let t=[];return this.forEach((r,n)=>{t.push([n,r])}),t}fromJSON(t){this.clear();for(let[r,n]of t)this.set(r,n)}};dr.LinkedMap=Mi;var za=class extends Mi{constructor(t,r=1){super();this._limit=t,this._ratio=Math.min(Math.max(0,r),1)}get limit(){return this._limit}set limit(t){this._limit=t,this.checkTrim()}get ratio(){return this._ratio}set ratio(t){this._ratio=Math.min(Math.max(0,t),1),this.checkTrim()}get(t,r=qe.AsNew){return super.get(t,r)}peek(t){return super.get(t,qe.None)}set(t,r){return super.set(t,r,qe.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};dr.LRUCache=za});var Za=W(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});var Ja=vt(),ve=ar(),ie=_i(),Ua=Ba(),zr=ur(),xn=Oi(),Br;(function(e){e.type=new ie.NotificationType("$/cancelRequest")})(Br||(Br={}));var Sn;(function(e){e.type=new ie.NotificationType("$/progress")})(Sn||(Sn={}));var Ga=class{constructor(){}};re.ProgressType=Ga;re.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var ye;(function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Verbose=2]="Verbose"})(ye=re.Trace||(re.Trace={}));(function(e){function t(n){if(!ve.string(n))return e.Off;switch(n=n.toLowerCase(),n){case"off":return e.Off;case"messages":return e.Messages;case"verbose":return e.Verbose;default:return e.Off}}e.fromString=t;function r(n){switch(n){case e.Off:return"off";case e.Messages:return"messages";case e.Verbose:return"verbose";default:return"off"}}e.toString=r})(ye=re.Trace||(re.Trace={}));var tt;(function(e){e.Text="text",e.JSON="json"})(tt=re.TraceFormat||(re.TraceFormat={}));(function(e){function t(r){return r=r.toLowerCase(),r==="json"?e.JSON:e.Text}e.fromString=t})(tt=re.TraceFormat||(re.TraceFormat={}));var Xa;(function(e){e.type=new ie.NotificationType("$/setTraceNotification")})(Xa=re.SetTraceNotification||(re.SetTraceNotification={}));var Ii;(function(e){e.type=new ie.NotificationType("$/logTraceNotification")})(Ii=re.LogTraceNotification||(re.LogTraceNotification={}));var Tn;(function(e){e[e.Closed=1]="Closed",e[e.Disposed=2]="Disposed",e[e.AlreadyListening=3]="AlreadyListening"})(Tn=re.ConnectionErrors||(re.ConnectionErrors={}));var Jt=class extends Error{constructor(t,r){super(r);this.code=t,Object.setPrototypeOf(this,Jt.prototype)}};re.ConnectionError=Jt;var Ya;(function(e){function t(r){let n=r;return n&&ve.func(n.cancelUndispatched)}e.is=t})(Ya=re.ConnectionStrategy||(re.ConnectionStrategy={}));var Li;(function(e){e.Message=Object.freeze({createCancellationTokenSource(r){return new xn.CancellationTokenSource}});function t(r){let n=r;return n&&ve.func(n.createCancellationTokenSource)}e.is=t})(Li=re.CancellationReceiverStrategy||(re.CancellationReceiverStrategy={}));var Wi;(function(e){e.Message=Object.freeze({sendCancellation(r,n){r.sendNotification(Br.type,{id:n})},cleanup(r){}});function t(r){let n=r;return n&&ve.func(n.sendCancellation)&&ve.func(n.cleanup)}e.is=t})(Wi=re.CancellationSenderStrategy||(re.CancellationSenderStrategy={}));var $i;(function(e){e.Message=Object.freeze({receiver:Li.Message,sender:Wi.Message});function t(r){let n=r;return n&&Li.is(n.receiver)&&Wi.is(n.sender)}e.is=t})($i=re.CancellationStrategy||(re.CancellationStrategy={}));var Jf;(function(e){function t(r){let n=r;return n&&($i.is(n.cancellationStrategy)||Ya.is(n.connectionStrategy))}e.is=t})(Jf=re.ConnectionOptions||(re.ConnectionOptions={}));var rt;(function(e){e[e.New=1]="New",e[e.Listening=2]="Listening",e[e.Closed=3]="Closed",e[e.Disposed=4]="Disposed"})(rt||(rt={}));function Uf(e,t,r,n){let i=r!==void 0?r:re.NullLogger,o=0,s=0,u=0,l="2.0",f,a=Object.create(null),c,m=Object.create(null),y=new Map,x,T=new Ua.LinkedMap,C=Object.create(null),p=Object.create(null),h=ye.Off,g=tt.Text,O,q=rt.New,D=new zr.Emitter,_=new zr.Emitter,b=new zr.Emitter,v=new zr.Emitter,w=new zr.Emitter,R=n&&n.cancellationStrategy?n.cancellationStrategy:$i.Message;function F(d){return"req-"+d.toString()}function L(d){return d===null?"res-unknown-"+(++u).toString():"res-"+d.toString()}function $(){return"not-"+(++s).toString()}function ne(d,S){ie.isRequestMessage(S)?d.set(F(S.id),S):ie.isResponseMessage(S)?d.set(L(S.id),S):d.set($(),S)}function K(d){}function Pe(){return q===rt.Listening}function Me(){return q===rt.Closed}function Se(){return q===rt.Disposed}function we(){(q===rt.New||q===rt.Listening)&&(q=rt.Closed,_.fire(void 0))}function se(d){D.fire([d,void 0,void 0])}function Be(d){D.fire(d)}e.onClose(we),e.onError(se),t.onClose(we),t.onError(Be);function Ce(){x||T.size===0||(x=Ja.default().timer.setImmediate(()=>{x=void 0,me()}))}function me(){if(T.size===0)return;let d=T.shift();try{ie.isRequestMessage(d)?_t(d):ie.isNotificationMessage(d)?$t(d):ie.isResponseMessage(d)?nr(d):Pt(d)}finally{Ce()}}let pt=d=>{try{if(ie.isNotificationMessage(d)&&d.method===Br.type.method){let S=F(d.params.id),A=T.get(S);if(ie.isRequestMessage(A)){let j=n==null?void 0:n.connectionStrategy,z=j&&j.cancelUndispatched?j.cancelUndispatched(A,K):K(A);if(z&&(z.error!==void 0||z.result!==void 0)){T.delete(S),z.id=A.id,gt(z,d.method,Date.now()),t.write(z);return}}}ne(T,d)}finally{Ce()}};function _t(d){if(Se())return;function S(ee,xe,le){let Fe={jsonrpc:l,id:d.id};ee instanceof ie.ResponseError?Fe.error=ee.toJson():Fe.result=ee===void 0?null:ee,gt(Fe,xe,le),t.write(Fe)}function A(ee,xe,le){let Fe={jsonrpc:l,id:d.id,error:ee.toJson()};gt(Fe,xe,le),t.write(Fe)}function j(ee,xe,le){ee===void 0&&(ee=null);let Fe={jsonrpc:l,id:d.id,result:ee};gt(Fe,xe,le),t.write(Fe)}Ht(d);let z=a[d.method],de,he;z&&(de=z.type,he=z.handler);let Ne=Date.now();if(he||f){let ee=String(d.id),xe=R.receiver.createCancellationTokenSource(ee);p[ee]=xe;try{let le;d.params===void 0||de!==void 0&&de.numberOfParams===0?le=he?he(xe.token):f(d.method,xe.token):ve.array(d.params)&&(de===void 0||de.numberOfParams>1)?le=he?he(...d.params,xe.token):f(d.method,...d.params,xe.token):le=he?he(d.params,xe.token):f(d.method,d.params,xe.token);let Fe=le;le?Fe.then?Fe.then(mt=>{delete p[ee],S(mt,d.method,Ne)},mt=>{delete p[ee],mt instanceof ie.ResponseError?A(mt,d.method,Ne):mt&&ve.string(mt.message)?A(new ie.ResponseError(ie.ErrorCodes.InternalError,`Request ${d.method} failed with message: ${mt.message}`),d.method,Ne):A(new ie.ResponseError(ie.ErrorCodes.InternalError,`Request ${d.method} failed unexpectedly without providing any details.`),d.method,Ne)}):(delete p[ee],S(le,d.method,Ne)):(delete p[ee],j(le,d.method,Ne))}catch(le){delete p[ee],le instanceof ie.ResponseError?S(le,d.method,Ne):le&&ve.string(le.message)?A(new ie.ResponseError(ie.ErrorCodes.InternalError,`Request ${d.method} failed with message: ${le.message}`),d.method,Ne):A(new ie.ResponseError(ie.ErrorCodes.InternalError,`Request ${d.method} failed unexpectedly without providing any details.`),d.method,Ne)}}else A(new ie.ResponseError(ie.ErrorCodes.MethodNotFound,`Unhandled method ${d.method}`),d.method,Ne)}function nr(d){if(!Se())if(d.id===null)d.error?i.error(`Received response message without id: Error is: +${JSON.stringify(d.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let S=String(d.id),A=C[S];if(Lr(d,A),A){delete C[S];try{if(d.error){let j=d.error;A.reject(new ie.ResponseError(j.code,j.message,j.data))}else if(d.result!==void 0)A.resolve(d.result);else throw new Error("Should never happen.")}catch(j){j.message?i.error(`Response handler '${A.method}' failed with message: ${j.message}`):i.error(`Response handler '${A.method}' failed unexpectedly.`)}}}}function $t(d){if(Se())return;let S,A;if(d.method===Br.type.method)A=j=>{let z=j.id,de=p[String(z)];de&&de.cancel()};else{let j=m[d.method];j&&(A=j.handler,S=j.type)}if(A||c)try{or(d),d.params===void 0||S!==void 0&&S.numberOfParams===0?A?A():c(d.method):ve.array(d.params)&&(S===void 0||S.numberOfParams>1)?A?A(...d.params):c(d.method,...d.params):A?A(d.params):c(d.method,d.params)}catch(j){j.message?i.error(`Notification handler '${d.method}' failed with message: ${j.message}`):i.error(`Notification handler '${d.method}' failed unexpectedly.`)}else b.fire(d)}function Pt(d){if(!d){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message: +${JSON.stringify(d,null,4)}`);let S=d;if(ve.string(S.id)||ve.number(S.id)){let A=String(S.id),j=C[A];j&&j.reject(new Error("The received response has neither a result nor an error property."))}}function ir(d){if(!(h===ye.Off||!O))if(g===tt.Text){let S;h===ye.Verbose&&d.params&&(S=`Params: ${JSON.stringify(d.params,null,4)} + +`),O.log(`Sending request '${d.method} - (${d.id})'.`,S)}else Ze("send-request",d)}function Vt(d){if(!(h===ye.Off||!O))if(g===tt.Text){let S;h===ye.Verbose&&(d.params?S=`Params: ${JSON.stringify(d.params,null,4)} + +`:S=`No parameters provided. + +`),O.log(`Sending notification '${d.method}'.`,S)}else Ze("send-notification",d)}function gt(d,S,A){if(!(h===ye.Off||!O))if(g===tt.Text){let j;h===ye.Verbose&&(d.error&&d.error.data?j=`Error data: ${JSON.stringify(d.error.data,null,4)} + +`:d.result?j=`Result: ${JSON.stringify(d.result,null,4)} + +`:d.error===void 0&&(j=`No result returned. + +`)),O.log(`Sending response '${S} - (${d.id})'. Processing request took ${Date.now()-A}ms`,j)}else Ze("send-response",d)}function Ht(d){if(!(h===ye.Off||!O))if(g===tt.Text){let S;h===ye.Verbose&&d.params&&(S=`Params: ${JSON.stringify(d.params,null,4)} + +`),O.log(`Received request '${d.method} - (${d.id})'.`,S)}else Ze("receive-request",d)}function or(d){if(!(h===ye.Off||!O||d.method===Ii.type.method))if(g===tt.Text){let S;h===ye.Verbose&&(d.params?S=`Params: ${JSON.stringify(d.params,null,4)} + +`:S=`No parameters provided. + +`),O.log(`Received notification '${d.method}'.`,S)}else Ze("receive-notification",d)}function Lr(d,S){if(!(h===ye.Off||!O))if(g===tt.Text){let A;if(h===ye.Verbose&&(d.error&&d.error.data?A=`Error data: ${JSON.stringify(d.error.data,null,4)} + +`:d.result?A=`Result: ${JSON.stringify(d.result,null,4)} + +`:d.error===void 0&&(A=`No result returned. + +`)),S){let j=d.error?` Request failed: ${d.error.message} (${d.error.code}).`:"";O.log(`Received response '${S.method} - (${d.id})' in ${Date.now()-S.timerStart}ms.${j}`,A)}else O.log(`Received response ${d.id} without active response promise.`,A)}else Ze("receive-response",d)}function Ze(d,S){if(!O||h===ye.Off)return;let A={isLSPMessage:!0,type:d,message:S,timestamp:Date.now()};O.log(A)}function Qe(){if(Me())throw new Jt(Tn.Closed,"Connection is closed.");if(Se())throw new Jt(Tn.Disposed,"Connection is disposed.")}function yi(){if(Pe())throw new Jt(Tn.AlreadyListening,"Connection is already listening")}function Re(){if(!Pe())throw new Error("Call listen() first.")}function Rt(d){return d===void 0?null:d}function N(d,S){let A,j=d.numberOfParams;switch(j){case 0:A=null;break;case 1:A=Rt(S[0]);break;default:A=[];for(let z=0;z{Qe();let A,j;if(ve.string(d))switch(A=d,S.length){case 0:j=null;break;case 1:j=S[0];break;default:j=S;break}else A=d.method,j=N(d,S);let z={jsonrpc:l,method:A,params:j};Vt(z),t.write(z)},onNotification:(d,S)=>{Qe(),ve.func(d)?c=d:S&&(ve.string(d)?m[d]={type:void 0,handler:S}:m[d.method]={type:d,handler:S})},onProgress:(d,S,A)=>{if(y.has(S))throw new Error(`Progress handler for token ${S} already registered`);return y.set(S,A),{dispose:()=>{y.delete(S)}}},sendProgress:(d,S,A)=>{M.sendNotification(Sn.type,{token:S,value:A})},onUnhandledProgress:v.event,sendRequest:(d,...S)=>{Qe(),Re();let A,j,z;if(ve.string(d))switch(A=d,S.length){case 0:j=null;break;case 1:xn.CancellationToken.is(S[0])?(j=null,z=S[0]):j=Rt(S[0]);break;default:let ee=S.length-1;xn.CancellationToken.is(S[ee])?(z=S[ee],S.length===2?j=Rt(S[0]):j=S.slice(0,ee).map(xe=>Rt(xe))):j=S.map(xe=>Rt(xe));break}else{A=d.method,j=N(d,S);let ee=d.numberOfParams;z=xn.CancellationToken.is(S[ee])?S[ee]:void 0}let de=o++,he;return z&&(he=z.onCancellationRequested(()=>{R.sender.sendCancellation(M,de)})),new Promise((ee,xe)=>{let le={jsonrpc:l,id:de,method:A,params:j},Fe=sr=>{ee(sr),R.sender.cleanup(de),he==null||he.dispose()},mt=sr=>{xe(sr),R.sender.cleanup(de),he==null||he.dispose()},mn={method:A,timerStart:Date.now(),resolve:Fe,reject:mt};ir(le);try{t.write(le)}catch(sr){mn.reject(new ie.ResponseError(ie.ErrorCodes.MessageWriteError,sr.message?sr.message:"Unknown reason")),mn=null}mn&&(C[String(de)]=mn)})},onRequest:(d,S)=>{Qe(),ve.func(d)?f=d:S&&(ve.string(d)?a[d]={type:void 0,handler:S}:a[d.method]={type:d,handler:S})},trace:(d,S,A)=>{let j=!1,z=tt.Text;A!==void 0&&(ve.boolean(A)?j=A:(j=A.sendNotification||!1,z=A.traceFormat||tt.Text)),h=d,g=z,h===ye.Off?O=void 0:O=S,j&&!Me()&&!Se()&&M.sendNotification(Xa.type,{value:ye.toString(d)})},onError:D.event,onClose:_.event,onUnhandledNotification:b.event,onDispose:w.event,dispose:()=>{if(Se())return;q=rt.Disposed,w.fire(void 0);let d=new Error("Connection got disposed.");Object.keys(C).forEach(S=>{C[S].reject(d)}),C=Object.create(null),p=Object.create(null),T=new Ua.LinkedMap,ve.func(t.dispose)&&t.dispose(),ve.func(e.dispose)&&e.dispose()},listen:()=>{Qe(),yi(),q=rt.Listening,e.listen(pt)},inspect:()=>{Ja.default().console.log("inspect")}};return M.onNotification(Ii.type,d=>{h===ye.Off||!O||O.log(d.message,h===ye.Verbose?d.verbose:void 0)}),M.onNotification(Sn.type,d=>{let S=y.get(d.token);S?S(d.value):v.fire(d)}),M}re.createMessageConnection=Uf});var zi=W(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});var ue=_i();H.RequestType=ue.RequestType;H.RequestType0=ue.RequestType0;H.RequestType1=ue.RequestType1;H.RequestType2=ue.RequestType2;H.RequestType3=ue.RequestType3;H.RequestType4=ue.RequestType4;H.RequestType5=ue.RequestType5;H.RequestType6=ue.RequestType6;H.RequestType7=ue.RequestType7;H.RequestType8=ue.RequestType8;H.RequestType9=ue.RequestType9;H.ResponseError=ue.ResponseError;H.ErrorCodes=ue.ErrorCodes;H.NotificationType=ue.NotificationType;H.NotificationType0=ue.NotificationType0;H.NotificationType1=ue.NotificationType1;H.NotificationType2=ue.NotificationType2;H.NotificationType3=ue.NotificationType3;H.NotificationType4=ue.NotificationType4;H.NotificationType5=ue.NotificationType5;H.NotificationType6=ue.NotificationType6;H.NotificationType7=ue.NotificationType7;H.NotificationType8=ue.NotificationType8;H.NotificationType9=ue.NotificationType9;var Gf=xi();H.Disposable=Gf.Disposable;var Qa=ur();H.Event=Qa.Event;H.Emitter=Qa.Emitter;var Ka=Oi();H.CancellationTokenSource=Ka.CancellationTokenSource;H.CancellationToken=Ka.CancellationToken;var Vi=Da();H.MessageReader=Vi.MessageReader;H.AbstractMessageReader=Vi.AbstractMessageReader;H.ReadableStreamMessageReader=Vi.ReadableStreamMessageReader;var Hi=Ha();H.MessageWriter=Hi.MessageWriter;H.AbstractMessageWriter=Hi.AbstractMessageWriter;H.WriteableStreamMessageWriter=Hi.WriteableStreamMessageWriter;var Ie=Za();H.ConnectionStrategy=Ie.ConnectionStrategy;H.ConnectionOptions=Ie.ConnectionOptions;H.NullLogger=Ie.NullLogger;H.createMessageConnection=Ie.createMessageConnection;H.ProgressType=Ie.ProgressType;H.Trace=Ie.Trace;H.TraceFormat=Ie.TraceFormat;H.SetTraceNotification=Ie.SetTraceNotification;H.LogTraceNotification=Ie.LogTraceNotification;H.ConnectionErrors=Ie.ConnectionErrors;H.ConnectionError=Ie.ConnectionError;H.CancellationReceiverStrategy=Ie.CancellationReceiverStrategy;H.CancellationSenderStrategy=Ie.CancellationSenderStrategy;H.CancellationStrategy=Ie.CancellationStrategy;var Xf=vt();H.RAL=Xf.default});var ze=W(Ee=>{"use strict";function Yf(e){for(var t in e)Ee.hasOwnProperty(t)||(Ee[t]=e[t])}Object.defineProperty(Ee,"__esModule",{value:!0});var Jr=sa();Jr.default.install();var dt=zi(),Zf=require("path"),Qf=require("os"),Kf=require("crypto"),kn=require("net");Yf(zi());var eu=class extends dt.AbstractMessageReader{constructor(t){super();this.process=t;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose())}listen(t){return this.process.on("message",t),dt.Disposable.create(()=>this.process.off("message",t))}};Ee.IPCMessageReader=eu;var tu=class extends dt.AbstractMessageWriter{constructor(t){super();this.process=t,this.errorCount=0;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose)}write(t){try{return typeof this.process.send=="function"&&this.process.send(t,void 0,void 0,r=>{r?(this.errorCount++,this.handleError(r,t)):this.errorCount=0}),Promise.resolve()}catch(r){return this.handleError(r,t),Promise.reject(r)}}handleError(t,r){this.errorCount++,this.fireError(t,r,this.errorCount)}};Ee.IPCMessageWriter=tu;var hr=class extends dt.ReadableStreamMessageReader{constructor(t,r="utf-8"){super(Jr.default().stream.asReadableStream(t),r)}};Ee.SocketMessageReader=hr;var pr=class extends dt.WriteableStreamMessageWriter{constructor(t,r){super(Jr.default().stream.asWritableStream(t),r);this.socket=t}dispose(){super.dispose(),this.socket.destroy()}};Ee.SocketMessageWriter=pr;var Bi=class extends dt.ReadableStreamMessageReader{constructor(t,r){super(Jr.default().stream.asReadableStream(t),r)}};Ee.StreamMessageReader=Bi;var Ji=class extends dt.WriteableStreamMessageWriter{constructor(t,r){super(Jr.default().stream.asWritableStream(t),r)}};Ee.StreamMessageWriter=Ji;function ed(){let e=Kf.randomBytes(21).toString("hex");return process.platform==="win32"?`\\\\.\\pipe\\vscode-jsonrpc-${e}-sock`:Zf.join(Qf.tmpdir(),`vscode-${e}.sock`)}Ee.generateRandomPipeName=ed;function td(e,t="utf-8"){let r,n=new Promise((i,o)=>{r=i});return new Promise((i,o)=>{let s=kn.createServer(u=>{s.close(),r([new hr(u,t),new pr(u,t)])});s.on("error",o),s.listen(e,()=>{s.removeListener("error",o),i({onConnected:()=>n})})})}Ee.createClientPipeTransport=td;function rd(e,t="utf-8"){let r=kn.createConnection(e);return[new hr(r,t),new pr(r,t)]}Ee.createServerPipeTransport=rd;function nd(e,t="utf-8"){let r,n=new Promise((i,o)=>{r=i});return new Promise((i,o)=>{let s=kn.createServer(u=>{s.close(),r([new hr(u,t),new pr(u,t)])});s.on("error",o),s.listen(e,"127.0.0.1",()=>{s.removeListener("error",o),i({onConnected:()=>n})})})}Ee.createClientSocketTransport=nd;function id(e,t="utf-8"){let r=kn.createConnection(e,"127.0.0.1");return[new hr(r,t),new pr(r,t)]}Ee.createServerSocketTransport=id;function od(e){return e.listen!==void 0&&e.read===void 0}function sd(e){return e.write!==void 0&&e.end===void 0}function ad(e,t,r,n){r||(r=dt.NullLogger);let i=od(e)?e:new Bi(e),o=sd(t)?t:new Ji(t);return dt.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),dt.createMessageConnection(i,o,r,n)}Ee.createMessageConnection=ad});var Ui=W((qv,ru)=>{"use strict";ru.exports=ze()});var Ro=W(ud=>{vf(ud,{CodeAction:()=>xo,CodeActionContext:()=>Co,CodeActionKind:()=>wo,CodeLens:()=>So,Color:()=>Pn,ColorInformation:()=>Xi,ColorPresentation:()=>Yi,Command:()=>gr,CompletionItem:()=>uo,CompletionItemKind:()=>io,CompletionItemTag:()=>so,CompletionList:()=>co,CreateFile:()=>Yr,DeleteFile:()=>Qr,Diagnostic:()=>Ur,DiagnosticCode:()=>to,DiagnosticRelatedInformation:()=>Rn,DiagnosticSeverity:()=>Ki,DiagnosticTag:()=>eo,DocumentHighlight:()=>go,DocumentHighlightKind:()=>po,DocumentLink:()=>ko,DocumentSymbol:()=>bo,EOL:()=>ld,FoldingRange:()=>Qi,FoldingRangeKind:()=>Zi,FormattingOptions:()=>To,Hover:()=>lo,InsertReplaceEdit:()=>ao,InsertTextFormat:()=>oo,Location:()=>_n,LocationLink:()=>Gi,MarkedString:()=>Kr,MarkupContent:()=>Nn,MarkupKind:()=>mr,ParameterInformation:()=>fo,Position:()=>nt,Range:()=>Te,RenameFile:()=>Zr,SelectionRange:()=>_o,SignatureInformation:()=>ho,SymbolInformation:()=>yo,SymbolKind:()=>mo,SymbolTag:()=>vo,TextDocument:()=>Po,TextDocumentEdit:()=>Gr,TextDocumentIdentifier:()=>ro,TextDocumentItem:()=>no,TextEdit:()=>Et,VersionedTextDocumentIdentifier:()=>Xr,WorkspaceChange:()=>cd,WorkspaceEdit:()=>En});"use strict";var nt;(function(e){function t(n,i){return{line:n,character:i}}e.create=t;function r(n){var i=n;return E.objectLiteral(i)&&E.number(i.line)&&E.number(i.character)}e.is=r})(nt||(nt={}));var Te;(function(e){function t(n,i,o,s){if(E.number(n)&&E.number(i)&&E.number(o)&&E.number(s))return{start:nt.create(n,i),end:nt.create(o,s)};if(nt.is(n)&&nt.is(i))return{start:n,end:i};throw new Error("Range#create called with invalid arguments["+n+", "+i+", "+o+", "+s+"]")}e.create=t;function r(n){var i=n;return E.objectLiteral(i)&&nt.is(i.start)&&nt.is(i.end)}e.is=r})(Te||(Te={}));var _n;(function(e){function t(n,i){return{uri:n,range:i}}e.create=t;function r(n){var i=n;return E.defined(i)&&Te.is(i.range)&&(E.string(i.uri)||E.undefined(i.uri))}e.is=r})(_n||(_n={}));var Gi;(function(e){function t(n,i,o,s){return{targetUri:n,targetRange:i,targetSelectionRange:o,originSelectionRange:s}}e.create=t;function r(n){var i=n;return E.defined(i)&&Te.is(i.targetRange)&&E.string(i.targetUri)&&(Te.is(i.targetSelectionRange)||E.undefined(i.targetSelectionRange))&&(Te.is(i.originSelectionRange)||E.undefined(i.originSelectionRange))}e.is=r})(Gi||(Gi={}));var Pn;(function(e){function t(n,i,o,s){return{red:n,green:i,blue:o,alpha:s}}e.create=t;function r(n){var i=n;return E.number(i.red)&&E.number(i.green)&&E.number(i.blue)&&E.number(i.alpha)}e.is=r})(Pn||(Pn={}));var Xi;(function(e){function t(n,i){return{range:n,color:i}}e.create=t;function r(n){var i=n;return Te.is(i.range)&&Pn.is(i.color)}e.is=r})(Xi||(Xi={}));var Yi;(function(e){function t(n,i,o){return{label:n,textEdit:i,additionalTextEdits:o}}e.create=t;function r(n){var i=n;return E.string(i.label)&&(E.undefined(i.textEdit)||Et.is(i))&&(E.undefined(i.additionalTextEdits)||E.typedArray(i.additionalTextEdits,Et.is))}e.is=r})(Yi||(Yi={}));var Zi;(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(Zi||(Zi={}));var Qi;(function(e){function t(n,i,o,s,u){var l={startLine:n,endLine:i};return E.defined(o)&&(l.startCharacter=o),E.defined(s)&&(l.endCharacter=s),E.defined(u)&&(l.kind=u),l}e.create=t;function r(n){var i=n;return E.number(i.startLine)&&E.number(i.startLine)&&(E.undefined(i.startCharacter)||E.number(i.startCharacter))&&(E.undefined(i.endCharacter)||E.number(i.endCharacter))&&(E.undefined(i.kind)||E.string(i.kind))}e.is=r})(Qi||(Qi={}));var Rn;(function(e){function t(n,i){return{location:n,message:i}}e.create=t;function r(n){var i=n;return E.defined(i)&&_n.is(i.location)&&E.string(i.message)}e.is=r})(Rn||(Rn={}));var Ki;(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(Ki||(Ki={}));var eo;(function(e){e.Unnecessary=1,e.Deprecated=2})(eo||(eo={}));var to;(function(e){function t(r){var n=r;return n!=null&&(E.number(n.value)||E.string(n.value))&&E.string(n.target)}e.is=t})(to||(to={}));var Ur;(function(e){function t(n,i,o,s,u,l){var f={range:n,message:i};return E.defined(o)&&(f.severity=o),E.defined(s)&&(f.code=s),E.defined(u)&&(f.source=u),E.defined(l)&&(f.relatedInformation=l),f}e.create=t;function r(n){var i=n;return E.defined(i)&&Te.is(i.range)&&E.string(i.message)&&(E.number(i.severity)||E.undefined(i.severity))&&(E.number(i.code)||E.string(i.code)||E.undefined(i.code))&&(E.string(i.source)||E.undefined(i.source))&&(E.undefined(i.relatedInformation)||E.typedArray(i.relatedInformation,Rn.is))}e.is=r})(Ur||(Ur={}));var gr;(function(e){function t(n,i){for(var o=[],s=2;s0&&(u.arguments=o),u}e.create=t;function r(n){var i=n;return E.defined(i)&&E.string(i.title)&&E.string(i.command)}e.is=r})(gr||(gr={}));var Et;(function(e){function t(o,s){return{range:o,newText:s}}e.replace=t;function r(o,s){return{range:{start:o,end:o},newText:s}}e.insert=r;function n(o){return{range:o,newText:""}}e.del=n;function i(o){var s=o;return E.objectLiteral(s)&&E.string(s.newText)&&Te.is(s.range)}e.is=i})(Et||(Et={}));var Gr;(function(e){function t(n,i){return{textDocument:n,edits:i}}e.create=t;function r(n){var i=n;return E.defined(i)&&Xr.is(i.textDocument)&&Array.isArray(i.edits)}e.is=r})(Gr||(Gr={}));var Yr;(function(e){function t(n,i){var o={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),o}e.create=t;function r(n){var i=n;return i&&i.kind==="create"&&E.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||E.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||E.boolean(i.options.ignoreIfExists)))}e.is=r})(Yr||(Yr={}));var Zr;(function(e){function t(n,i,o){var s={kind:"rename",oldUri:n,newUri:i};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(s.options=o),s}e.create=t;function r(n){var i=n;return i&&i.kind==="rename"&&E.string(i.oldUri)&&E.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||E.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||E.boolean(i.options.ignoreIfExists)))}e.is=r})(Zr||(Zr={}));var Qr;(function(e){function t(n,i){var o={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),o}e.create=t;function r(n){var i=n;return i&&i.kind==="delete"&&E.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||E.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||E.boolean(i.options.ignoreIfNotExists)))}e.is=r})(Qr||(Qr={}));var En;(function(e){function t(r){var n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(function(i){return E.string(i.kind)?Yr.is(i)||Zr.is(i)||Qr.is(i):Gr.is(i)}))}e.is=t})(En||(En={}));var On=function(){function e(t){this.edits=t}return e.prototype.insert=function(t,r){this.edits.push(Et.insert(t,r))},e.prototype.replace=function(t,r){this.edits.push(Et.replace(t,r))},e.prototype.delete=function(t){this.edits.push(Et.del(t))},e.prototype.add=function(t){this.edits.push(t)},e.prototype.all=function(){return this.edits},e.prototype.clear=function(){this.edits.splice(0,this.edits.length)},e}(),cd=function(){function e(t){var r=this;this._textEditChanges=Object.create(null),t&&(this._workspaceEdit=t,t.documentChanges?t.documentChanges.forEach(function(n){if(Gr.is(n)){var i=new On(n.edits);r._textEditChanges[n.textDocument.uri]=i}}):t.changes&&Object.keys(t.changes).forEach(function(n){var i=new On(t.changes[n]);r._textEditChanges[n]=i}))}return Object.defineProperty(e.prototype,"edit",{get:function(){return this._workspaceEdit===void 0?{documentChanges:[]}:this._workspaceEdit},enumerable:!0,configurable:!0}),e.prototype.getTextEditChange=function(t){if(Xr.is(t)){if(this._workspaceEdit||(this._workspaceEdit={documentChanges:[]}),!this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var r=t,n=this._textEditChanges[r.uri];if(!n){var i=[],o={textDocument:r,edits:i};this._workspaceEdit.documentChanges.push(o),n=new On(i),this._textEditChanges[r.uri]=n}return n}else{if(this._workspaceEdit||(this._workspaceEdit={changes:Object.create(null)}),!this._workspaceEdit.changes)throw new Error("Workspace edit is not configured for normal text edit changes.");var n=this._textEditChanges[t];if(!n){var i=[];this._workspaceEdit.changes[t]=i,n=new On(i),this._textEditChanges[t]=n}return n}},e.prototype.createFile=function(t,r){this.checkDocumentChanges(),this._workspaceEdit.documentChanges.push(Yr.create(t,r))},e.prototype.renameFile=function(t,r,n){this.checkDocumentChanges(),this._workspaceEdit.documentChanges.push(Zr.create(t,r,n))},e.prototype.deleteFile=function(t,r){this.checkDocumentChanges(),this._workspaceEdit.documentChanges.push(Qr.create(t,r))},e.prototype.checkDocumentChanges=function(){if(!this._workspaceEdit||!this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.")},e}(),ro;(function(e){function t(n){return{uri:n}}e.create=t;function r(n){var i=n;return E.defined(i)&&E.string(i.uri)}e.is=r})(ro||(ro={}));var Xr;(function(e){function t(n,i){return{uri:n,version:i}}e.create=t;function r(n){var i=n;return E.defined(i)&&E.string(i.uri)&&(i.version===null||E.number(i.version))}e.is=r})(Xr||(Xr={}));var no;(function(e){function t(n,i,o,s){return{uri:n,languageId:i,version:o,text:s}}e.create=t;function r(n){var i=n;return E.defined(i)&&E.string(i.uri)&&E.string(i.languageId)&&E.number(i.version)&&E.string(i.text)}e.is=r})(no||(no={}));var mr;(function(e){e.PlainText="plaintext",e.Markdown="markdown"})(mr||(mr={}));(function(e){function t(r){var n=r;return n===e.PlainText||n===e.Markdown}e.is=t})(mr||(mr={}));var Nn;(function(e){function t(r){var n=r;return E.objectLiteral(r)&&mr.is(n.kind)&&E.string(n.value)}e.is=t})(Nn||(Nn={}));var io;(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(io||(io={}));var oo;(function(e){e.PlainText=1,e.Snippet=2})(oo||(oo={}));var so;(function(e){e.Deprecated=1})(so||(so={}));var ao;(function(e){function t(n,i,o){return{newText:n,insert:i,replace:o}}e.create=t;function r(n){var i=n;return i&&E.string(i.newText)&&Te.is(i.insert)&&Te.is(i.replace)}e.is=r})(ao||(ao={}));var uo;(function(e){function t(r){return{label:r}}e.create=t})(uo||(uo={}));var co;(function(e){function t(r,n){return{items:r||[],isIncomplete:!!n}}e.create=t})(co||(co={}));var Kr;(function(e){function t(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}e.fromPlainText=t;function r(n){var i=n;return E.string(i)||E.objectLiteral(i)&&E.string(i.language)&&E.string(i.value)}e.is=r})(Kr||(Kr={}));var lo;(function(e){function t(r){var n=r;return!!n&&E.objectLiteral(n)&&(Nn.is(n.contents)||Kr.is(n.contents)||E.typedArray(n.contents,Kr.is))&&(r.range===void 0||Te.is(r.range))}e.is=t})(lo||(lo={}));var fo;(function(e){function t(r,n){return n?{label:r,documentation:n}:{label:r}}e.create=t})(fo||(fo={}));var ho;(function(e){function t(r,n){for(var i=[],o=2;o=0;a--){var c=l[a],m=o.offsetAt(c.range.start),y=o.offsetAt(c.range.end);if(y<=f)u=u.substring(0,m)+c.newText+u.substring(y,u.length);else throw new Error("Overlapping edit");f=m}return u}e.applyEdits=n;function i(o,s){if(o.length<=1)return o;var u=o.length/2|0,l=o.slice(0,u),f=o.slice(u);i(l,s),i(f,s);for(var a=0,c=0,m=0;a0&&t.push(r.length),this._lineOffsets=t}return this._lineOffsets},e.prototype.positionAt=function(t){t=Math.max(Math.min(t,this._content.length),0);var r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return nt.create(0,t);for(;nt?i=o:n=o+1}var s=n-1;return nt.create(s,t-r[s])},e.prototype.offsetAt=function(t){var r=this.getLineOffsets();if(t.line>=r.length)return this._content.length;if(t.line<0)return 0;var n=r[t.line],i=t.line+1{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});var Fn=ze(),nu=class extends Fn.RequestType0{constructor(t){super(t)}};vr.ProtocolRequestType0=nu;var iu=class extends Fn.RequestType{constructor(t){super(t)}};vr.ProtocolRequestType=iu;var ou=class extends Fn.NotificationType{constructor(t){super(t)}};vr.ProtocolNotificationType=ou;var su=class extends Fn.NotificationType0{constructor(t){super(t)}};vr.ProtocolNotificationType0=su});var cu=W(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});function dd(e){return e===!0||e===!1}it.boolean=dd;function au(e){return typeof e=="string"||e instanceof String}it.string=au;function hd(e){return typeof e=="number"||e instanceof Number}it.number=hd;function pd(e){return e instanceof Error}it.error=pd;function gd(e){return typeof e=="function"}it.func=gd;function uu(e){return Array.isArray(e)}it.array=uu;function md(e){return uu(e)&&e.every(t=>au(t))}it.stringArray=md;function vd(e,t){return Array.isArray(e)&&e.every(t)}it.typedArray=vd;function yd(e){return e!==null&&typeof e=="object"}it.objectLiteral=yd});var lu=W(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});var bd=ze(),wd=Le(),Cd;(function(e){e.method="textDocument/implementation",e.type=new wd.ProtocolRequestType(e.method),e.resultType=new bd.ProgressType})(Cd=qn.ImplementationRequest||(qn.ImplementationRequest={}))});var fu=W(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});var xd=ze(),Sd=Le(),Td;(function(e){e.method="textDocument/typeDefinition",e.type=new Sd.ProtocolRequestType(e.method),e.resultType=new xd.ProgressType})(Td=An.TypeDefinitionRequest||(An.TypeDefinitionRequest={}))});var hu=W(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});var du=Le(),kd;(function(e){e.type=new du.ProtocolRequestType0("workspace/workspaceFolders")})(kd=yr.WorkspaceFoldersRequest||(yr.WorkspaceFoldersRequest={}));var _d;(function(e){e.type=new du.ProtocolNotificationType("workspace/didChangeWorkspaceFolders")})(_d=yr.DidChangeWorkspaceFoldersNotification||(yr.DidChangeWorkspaceFoldersNotification={}))});var pu=W(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});var Pd=Le(),Rd;(function(e){e.type=new Pd.ProtocolRequestType("workspace/configuration")})(Rd=jn.ConfigurationRequest||(jn.ConfigurationRequest={}))});var mu=W(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});var Ed=ze(),gu=Le(),Od;(function(e){e.method="textDocument/documentColor",e.type=new gu.ProtocolRequestType(e.method),e.resultType=new Ed.ProgressType})(Od=br.DocumentColorRequest||(br.DocumentColorRequest={}));var Nd;(function(e){e.type=new gu.ProtocolRequestType("textDocument/colorPresentation")})(Nd=br.ColorPresentationRequest||(br.ColorPresentationRequest={}))});var vu=W(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});var Fd=ze(),qd=Le(),Ad;(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(Ad=wr.FoldingRangeKind||(wr.FoldingRangeKind={}));var jd;(function(e){e.method="textDocument/foldingRange",e.type=new qd.ProtocolRequestType(e.method),e.resultType=new Fd.ProgressType})(jd=wr.FoldingRangeRequest||(wr.FoldingRangeRequest={}))});var yu=W(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});var Dd=ze(),Md=Le(),Id;(function(e){e.method="textDocument/declaration",e.type=new Md.ProtocolRequestType(e.method),e.resultType=new Dd.ProgressType})(Id=Dn.DeclarationRequest||(Dn.DeclarationRequest={}))});var bu=W(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});var Ld=ze(),Wd=Le(),$d;(function(e){e.method="textDocument/selectionRange",e.type=new Wd.ProtocolRequestType(e.method),e.resultType=new Ld.ProgressType})($d=Mn.SelectionRangeRequest||(Mn.SelectionRangeRequest={}))});var Cu=W(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});var Vd=ze(),wu=Le(),Hd;(function(e){e.type=new Vd.ProgressType})(Hd=Ot.WorkDoneProgress||(Ot.WorkDoneProgress={}));var zd;(function(e){e.type=new wu.ProtocolRequestType("window/workDoneProgress/create")})(zd=Ot.WorkDoneProgressCreateRequest||(Ot.WorkDoneProgressCreateRequest={}));var Bd;(function(e){e.type=new wu.ProtocolNotificationType("window/workDoneProgress/cancel")})(Bd=Ot.WorkDoneProgressCancelNotification||(Ot.WorkDoneProgressCancelNotification={}))});var xu=W(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});var Eo=Le(),Jd;(function(e){e.method="textDocument/prepareCallHierarchy",e.type=new Eo.ProtocolRequestType(e.method)})(Jd=Nt.CallHierarchyPrepareRequest||(Nt.CallHierarchyPrepareRequest={}));var Ud;(function(e){e.method="callHierarchy/incomingCalls",e.type=new Eo.ProtocolRequestType(e.method)})(Ud=Nt.CallHierarchyIncomingCallsRequest||(Nt.CallHierarchyIncomingCallsRequest={}));var Gd;(function(e){e.method="callHierarchy/outgoingCalls",e.type=new Eo.ProtocolRequestType(e.method)})(Gd=Nt.CallHierarchyOutgoingCallsRequest||(Nt.CallHierarchyOutgoingCallsRequest={}))});var Pu=W(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});var Ft=cu(),bt=ze(),U=Le(),Xd=lu();P.ImplementationRequest=Xd.ImplementationRequest;var Yd=fu();P.TypeDefinitionRequest=Yd.TypeDefinitionRequest;var Su=hu();P.WorkspaceFoldersRequest=Su.WorkspaceFoldersRequest;P.DidChangeWorkspaceFoldersNotification=Su.DidChangeWorkspaceFoldersNotification;var Zd=pu();P.ConfigurationRequest=Zd.ConfigurationRequest;var Tu=mu();P.DocumentColorRequest=Tu.DocumentColorRequest;P.ColorPresentationRequest=Tu.ColorPresentationRequest;var Qd=vu();P.FoldingRangeRequest=Qd.FoldingRangeRequest;var Kd=yu();P.DeclarationRequest=Kd.DeclarationRequest;var eh=bu();P.SelectionRangeRequest=eh.SelectionRangeRequest;var Oo=Cu();P.WorkDoneProgress=Oo.WorkDoneProgress;P.WorkDoneProgressCreateRequest=Oo.WorkDoneProgressCreateRequest;P.WorkDoneProgressCancelNotification=Oo.WorkDoneProgressCancelNotification;var No=xu();P.CallHierarchyIncomingCallsRequest=No.CallHierarchyIncomingCallsRequest;P.CallHierarchyOutgoingCallsRequest=No.CallHierarchyOutgoingCallsRequest;P.CallHierarchyPrepareRequest=No.CallHierarchyPrepareRequest;var ku;(function(e){function t(r){let n=r;return Ft.string(n.language)||Ft.string(n.scheme)||Ft.string(n.pattern)}e.is=t})(ku=P.DocumentFilter||(P.DocumentFilter={}));var _u;(function(e){function t(r){if(!Array.isArray(r))return!1;for(let n of r)if(!Ft.string(n)&&!ku.is(n))return!1;return!0}e.is=t})(_u=P.DocumentSelector||(P.DocumentSelector={}));var th;(function(e){e.type=new U.ProtocolRequestType("client/registerCapability")})(th=P.RegistrationRequest||(P.RegistrationRequest={}));var rh;(function(e){e.type=new U.ProtocolRequestType("client/unregisterCapability")})(rh=P.UnregistrationRequest||(P.UnregistrationRequest={}));var nh;(function(e){e.Create="create",e.Rename="rename",e.Delete="delete"})(nh=P.ResourceOperationKind||(P.ResourceOperationKind={}));var ih;(function(e){e.Abort="abort",e.Transactional="transactional",e.TextOnlyTransactional="textOnlyTransactional",e.Undo="undo"})(ih=P.FailureHandlingKind||(P.FailureHandlingKind={}));var oh;(function(e){function t(r){let n=r;return n&&Ft.string(n.id)&&n.id.length>0}e.hasId=t})(oh=P.StaticRegistrationOptions||(P.StaticRegistrationOptions={}));var sh;(function(e){function t(r){let n=r;return n&&(n.documentSelector===null||_u.is(n.documentSelector))}e.is=t})(sh=P.TextDocumentRegistrationOptions||(P.TextDocumentRegistrationOptions={}));var ah;(function(e){function t(n){let i=n;return Ft.objectLiteral(i)&&(i.workDoneProgress===void 0||Ft.boolean(i.workDoneProgress))}e.is=t;function r(n){let i=n;return i&&Ft.boolean(i.workDoneProgress)}e.hasWorkDoneProgress=r})(ah=P.WorkDoneProgressOptions||(P.WorkDoneProgressOptions={}));var uh;(function(e){e.type=new U.ProtocolRequestType("initialize")})(uh=P.InitializeRequest||(P.InitializeRequest={}));var ch;(function(e){e.unknownProtocolVersion=1})(ch=P.InitializeError||(P.InitializeError={}));var lh;(function(e){e.type=new U.ProtocolNotificationType("initialized")})(lh=P.InitializedNotification||(P.InitializedNotification={}));var fh;(function(e){e.type=new U.ProtocolRequestType0("shutdown")})(fh=P.ShutdownRequest||(P.ShutdownRequest={}));var dh;(function(e){e.type=new U.ProtocolNotificationType0("exit")})(dh=P.ExitNotification||(P.ExitNotification={}));var hh;(function(e){e.type=new U.ProtocolNotificationType("workspace/didChangeConfiguration")})(hh=P.DidChangeConfigurationNotification||(P.DidChangeConfigurationNotification={}));var ph;(function(e){e.Error=1,e.Warning=2,e.Info=3,e.Log=4})(ph=P.MessageType||(P.MessageType={}));var gh;(function(e){e.type=new U.ProtocolNotificationType("window/showMessage")})(gh=P.ShowMessageNotification||(P.ShowMessageNotification={}));var mh;(function(e){e.type=new U.ProtocolRequestType("window/showMessageRequest")})(mh=P.ShowMessageRequest||(P.ShowMessageRequest={}));var vh;(function(e){e.type=new U.ProtocolNotificationType("window/logMessage")})(vh=P.LogMessageNotification||(P.LogMessageNotification={}));var yh;(function(e){e.type=new U.ProtocolNotificationType("telemetry/event")})(yh=P.TelemetryEventNotification||(P.TelemetryEventNotification={}));var bh;(function(e){e.None=0,e.Full=1,e.Incremental=2})(bh=P.TextDocumentSyncKind||(P.TextDocumentSyncKind={}));var wh;(function(e){e.method="textDocument/didOpen",e.type=new U.ProtocolNotificationType(e.method)})(wh=P.DidOpenTextDocumentNotification||(P.DidOpenTextDocumentNotification={}));var Ch;(function(e){e.method="textDocument/didChange",e.type=new U.ProtocolNotificationType(e.method)})(Ch=P.DidChangeTextDocumentNotification||(P.DidChangeTextDocumentNotification={}));var xh;(function(e){e.method="textDocument/didClose",e.type=new U.ProtocolNotificationType(e.method)})(xh=P.DidCloseTextDocumentNotification||(P.DidCloseTextDocumentNotification={}));var Sh;(function(e){e.method="textDocument/didSave",e.type=new U.ProtocolNotificationType(e.method)})(Sh=P.DidSaveTextDocumentNotification||(P.DidSaveTextDocumentNotification={}));var Th;(function(e){e.Manual=1,e.AfterDelay=2,e.FocusOut=3})(Th=P.TextDocumentSaveReason||(P.TextDocumentSaveReason={}));var kh;(function(e){e.method="textDocument/willSave",e.type=new U.ProtocolNotificationType(e.method)})(kh=P.WillSaveTextDocumentNotification||(P.WillSaveTextDocumentNotification={}));var _h;(function(e){e.method="textDocument/willSaveWaitUntil",e.type=new U.ProtocolRequestType(e.method)})(_h=P.WillSaveTextDocumentWaitUntilRequest||(P.WillSaveTextDocumentWaitUntilRequest={}));var Ph;(function(e){e.type=new U.ProtocolNotificationType("workspace/didChangeWatchedFiles")})(Ph=P.DidChangeWatchedFilesNotification||(P.DidChangeWatchedFilesNotification={}));var Rh;(function(e){e.Created=1,e.Changed=2,e.Deleted=3})(Rh=P.FileChangeType||(P.FileChangeType={}));var Eh;(function(e){e.Create=1,e.Change=2,e.Delete=4})(Eh=P.WatchKind||(P.WatchKind={}));var Oh;(function(e){e.type=new U.ProtocolNotificationType("textDocument/publishDiagnostics")})(Oh=P.PublishDiagnosticsNotification||(P.PublishDiagnosticsNotification={}));var Nh;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.TriggerForIncompleteCompletions=3})(Nh=P.CompletionTriggerKind||(P.CompletionTriggerKind={}));var Fh;(function(e){e.method="textDocument/completion",e.type=new U.ProtocolRequestType(e.method),e.resultType=new bt.ProgressType})(Fh=P.CompletionRequest||(P.CompletionRequest={}));var qh;(function(e){e.method="completionItem/resolve",e.type=new U.ProtocolRequestType(e.method)})(qh=P.CompletionResolveRequest||(P.CompletionResolveRequest={}));var Ah;(function(e){e.method="textDocument/hover",e.type=new U.ProtocolRequestType(e.method)})(Ah=P.HoverRequest||(P.HoverRequest={}));var jh;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.ContentChange=3})(jh=P.SignatureHelpTriggerKind||(P.SignatureHelpTriggerKind={}));var Dh;(function(e){e.method="textDocument/signatureHelp",e.type=new U.ProtocolRequestType(e.method)})(Dh=P.SignatureHelpRequest||(P.SignatureHelpRequest={}));var Mh;(function(e){e.method="textDocument/definition",e.type=new U.ProtocolRequestType(e.method),e.resultType=new bt.ProgressType})(Mh=P.DefinitionRequest||(P.DefinitionRequest={}));var Ih;(function(e){e.method="textDocument/references",e.type=new U.ProtocolRequestType(e.method),e.resultType=new bt.ProgressType})(Ih=P.ReferencesRequest||(P.ReferencesRequest={}));var Lh;(function(e){e.method="textDocument/documentHighlight",e.type=new U.ProtocolRequestType(e.method),e.resultType=new bt.ProgressType})(Lh=P.DocumentHighlightRequest||(P.DocumentHighlightRequest={}));var Wh;(function(e){e.method="textDocument/documentSymbol",e.type=new U.ProtocolRequestType(e.method),e.resultType=new bt.ProgressType})(Wh=P.DocumentSymbolRequest||(P.DocumentSymbolRequest={}));var $h;(function(e){e.method="textDocument/codeAction",e.type=new U.ProtocolRequestType(e.method),e.resultType=new bt.ProgressType})($h=P.CodeActionRequest||(P.CodeActionRequest={}));var Vh;(function(e){e.method="workspace/symbol",e.type=new U.ProtocolRequestType(e.method),e.resultType=new bt.ProgressType})(Vh=P.WorkspaceSymbolRequest||(P.WorkspaceSymbolRequest={}));var Hh;(function(e){e.type=new U.ProtocolRequestType("textDocument/codeLens"),e.resultType=new bt.ProgressType})(Hh=P.CodeLensRequest||(P.CodeLensRequest={}));var zh;(function(e){e.type=new U.ProtocolRequestType("codeLens/resolve")})(zh=P.CodeLensResolveRequest||(P.CodeLensResolveRequest={}));var Bh;(function(e){e.method="textDocument/documentLink",e.type=new U.ProtocolRequestType(e.method),e.resultType=new bt.ProgressType})(Bh=P.DocumentLinkRequest||(P.DocumentLinkRequest={}));var Jh;(function(e){e.type=new U.ProtocolRequestType("documentLink/resolve")})(Jh=P.DocumentLinkResolveRequest||(P.DocumentLinkResolveRequest={}));var Uh;(function(e){e.method="textDocument/formatting",e.type=new U.ProtocolRequestType(e.method)})(Uh=P.DocumentFormattingRequest||(P.DocumentFormattingRequest={}));var Gh;(function(e){e.method="textDocument/rangeFormatting",e.type=new U.ProtocolRequestType(e.method)})(Gh=P.DocumentRangeFormattingRequest||(P.DocumentRangeFormattingRequest={}));var Xh;(function(e){e.method="textDocument/onTypeFormatting",e.type=new U.ProtocolRequestType(e.method)})(Xh=P.DocumentOnTypeFormattingRequest||(P.DocumentOnTypeFormattingRequest={}));var Yh;(function(e){e.method="textDocument/rename",e.type=new U.ProtocolRequestType(e.method)})(Yh=P.RenameRequest||(P.RenameRequest={}));var Zh;(function(e){e.method="textDocument/prepareRename",e.type=new U.ProtocolRequestType(e.method)})(Zh=P.PrepareRenameRequest||(P.PrepareRenameRequest={}));var Qh;(function(e){e.type=new U.ProtocolRequestType("workspace/executeCommand")})(Qh=P.ExecuteCommandRequest||(P.ExecuteCommandRequest={}));var Kh;(function(e){e.type=new U.ProtocolRequestType("workspace/applyEdit")})(Kh=P.ApplyWorkspaceEditRequest||(P.ApplyWorkspaceEditRequest={}))});var Eu=W(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});var Ru=ze();function ep(e,t,r,n){return Ru.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),Ru.createMessageConnection(e,t,r,n)}Fo.createProtocolConnection=ep});var Ou=W(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});var qo=Le(),tp;(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.member="member",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator"})(tp=We.SemanticTokenTypes||(We.SemanticTokenTypes={}));var rp;(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(rp=We.SemanticTokenModifiers||(We.SemanticTokenModifiers={}));var np;(function(e){function t(r){let n=r;return n!==void 0&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}e.is=t})(np=We.SemanticTokens||(We.SemanticTokens={}));var ip;(function(e){e.method="textDocument/semanticTokens",e.type=new qo.ProtocolRequestType(e.method)})(ip=We.SemanticTokensRequest||(We.SemanticTokensRequest={}));var op;(function(e){e.method="textDocument/semanticTokens/edits",e.type=new qo.ProtocolRequestType(e.method)})(op=We.SemanticTokensEditsRequest||(We.SemanticTokensEditsRequest={}));var sp;(function(e){e.method="textDocument/semanticTokens/range",e.type=new qo.ProtocolRequestType(e.method)})(sp=We.SemanticTokensRangeRequest||(We.SemanticTokensRangeRequest={}))});var Nu=W(Ut=>{"use strict";function In(e){for(var t in e)Ut.hasOwnProperty(t)||(Ut[t]=e[t])}Object.defineProperty(Ut,"__esModule",{value:!0});In(ze());In(Ro());In(Le());In(Pu());var ap=Eu();Ut.createProtocolConnection=ap.createProtocolConnection;var wt=Ou(),up;(function(e){e.SemanticTokenTypes=wt.SemanticTokenTypes,e.SemanticTokenModifiers=wt.SemanticTokenModifiers,e.SemanticTokens=wt.SemanticTokens;let t;(function(i){i.method=wt.SemanticTokensRequest.method,i.type=wt.SemanticTokensRequest.type})(t=e.SemanticTokensRequest||(e.SemanticTokensRequest={}));let r;(function(i){i.method=wt.SemanticTokensEditsRequest.method,i.type=wt.SemanticTokensEditsRequest.type})(r=e.SemanticTokensEditsRequest||(e.SemanticTokensEditsRequest={}));let n;(function(i){i.method=wt.SemanticTokensRangeRequest.method,i.type=wt.SemanticTokensRangeRequest.type})(n=e.SemanticTokensRangeRequest||(e.SemanticTokensRangeRequest={}))})(up=Ut.Proposed||(Ut.Proposed={}))});var Ct=W(en=>{"use strict";function Fu(e){for(var t in e)en.hasOwnProperty(t)||(en[t]=e[t])}Object.defineProperty(en,"__esModule",{value:!0});var cp=Ui();Fu(Ui());Fu(Nu());function lp(e,t,r,n){return cp.createMessageConnection(e,t,r,n)}en.createProtocolConnection=lp});var Ao=W(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});var Ln=class{constructor(t){this._value=t}asHex(){return this._value}equals(t){return this.asHex()===t.asHex()}},G=class extends Ln{constructor(){super([G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),"-",G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),"-","4",G._randomHex(),G._randomHex(),G._randomHex(),"-",G._oneOf(G._timeHighBits),G._randomHex(),G._randomHex(),G._randomHex(),"-",G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex(),G._randomHex()].join(""))}static _oneOf(t){return t[Math.floor(t.length*Math.random())]}static _randomHex(){return G._oneOf(G._chars)}};G._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];G._timeHighBits=["8","9","a","b"];Gt.empty=new Ln("00000000-0000-0000-0000-000000000000");function qu(){return new G}Gt.v4=qu;var fp=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Au(e){return fp.test(e)}Gt.isUUID=Au;function dp(e){if(!Au(e))throw new Error("invalid uuid");return new Ln(e)}Gt.parse=dp;function hp(){return qu().asHex()}Gt.generateUuid=hp});var Du=W(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});var qt=Ct(),pp=Ao(),xt=class{constructor(t,r){this._connection=t,this._token=r,xt.Instances.set(this._token,this)}begin(t,r,n,i){let o={kind:"begin",title:t,percentage:r,message:n,cancellable:i};this._connection.sendProgress(qt.WorkDoneProgress.type,this._token,o)}report(t,r){let n={kind:"report"};typeof t=="number"?(n.percentage=t,r!==void 0&&(n.message=r)):n.message=t,this._connection.sendProgress(qt.WorkDoneProgress.type,this._token,n)}done(){xt.Instances.delete(this._token),this._connection.sendProgress(qt.WorkDoneProgress.type,this._token,{kind:"end"})}};xt.Instances=new Map;var jo=class extends xt{constructor(t,r){super(t,r);this._source=new qt.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},Wn=class{constructor(){}begin(){}report(){}done(){}},Do=class extends Wn{constructor(){super();this._source=new qt.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function gp(e,t){if(t===void 0||t.workDoneToken===void 0)return new Wn;let r=t.workDoneToken;return delete t.workDoneToken,new xt(e,r)}tn.attachWorkDone=gp;tn.ProgressFeature=e=>class extends e{constructor(){super();this._progressSupported=!1}initialize(t){var r;((r=t==null?void 0:t.window)===null||r===void 0?void 0:r.workDoneProgress)===!0&&(this._progressSupported=!0,this.connection.onNotification(qt.WorkDoneProgressCancelNotification.type,n=>{let i=xt.Instances.get(n.token);(i instanceof jo||i instanceof Do)&&i.cancel()}))}attachWorkDoneProgress(t){return t===void 0?new Wn:new xt(this.connection,t)}createWorkDoneProgress(){if(this._progressSupported){let t=pp.generateUuid();return this.connection.sendRequest(qt.WorkDoneProgressCreateRequest.type,{token:t}).then(()=>new jo(this.connection,t))}else return Promise.resolve(new Do)}};var Mo;(function(e){e.type=new qt.ProgressType})(Mo||(Mo={}));var ju=class{constructor(t,r){this._connection=t,this._token=r}report(t){this._connection.sendProgress(Mo.type,this._token,t)}};function mp(e,t){if(t===void 0||t.partialResultToken===void 0)return;let r=t.partialResultToken;return delete t.partialResultToken,new ju(e,r)}tn.attachPartialResult=mp});var Mu=W(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});var vp=Ct(),yp=yn();Io.ConfigurationFeature=e=>class extends e{getConfiguration(t){return t?yp.string(t)?this._getConfiguration({section:t}):this._getConfiguration(t):this._getConfiguration({})}_getConfiguration(t){let r={items:Array.isArray(t)?t:[t]};return this.connection.sendRequest(vp.ConfigurationRequest.type,r).then(n=>Array.isArray(t)?n:n[0])}}});var Iu=W(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});var $n=Ct();Lo.WorkspaceFoldersFeature=e=>class extends e{initialize(t){let r=t.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new $n.Emitter,this.connection.onNotification($n.DidChangeWorkspaceFoldersNotification.type,n=>{this._onDidChangeWorkspaceFolders.fire(n.event)}))}getWorkspaceFolders(){return this.connection.sendRequest($n.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return this._unregistration||(this._unregistration=this.connection.client.register($n.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}}});var Lu=W(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});var $o=Ct();Wo.CallHierarchyFeature=e=>class extends e{get callHierarchy(){return{onPrepare:t=>{this.connection.onRequest($o.CallHierarchyPrepareRequest.type,(r,n)=>t(r,n,this.attachWorkDoneProgress(r),void 0))},onIncomingCalls:t=>{let r=$o.CallHierarchyIncomingCallsRequest.type;this.connection.onRequest(r,(n,i)=>t(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:t=>{let r=$o.CallHierarchyOutgoingCallsRequest.type;this.connection.onRequest(r,(n,i)=>t(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}}});var Yo=W(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});var I=Ct(),Je=yn(),Vo=Ao(),J=Du(),bp=Mu(),wp=Iu(),Cp=Lu();function Ho(e){if(e!==null)return e}var Wu=class{constructor(t){this._documents=Object.create(null),this._configuration=t,this._onDidChangeContent=new I.Emitter,this._onDidOpen=new I.Emitter,this._onDidClose=new I.Emitter,this._onDidSave=new I.Emitter,this._onWillSave=new I.Emitter}get onDidChangeContent(){return this._onDidChangeContent.event}get onDidOpen(){return this._onDidOpen.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(t){this._willSaveWaitUntil=t}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(t){return this._documents[t]}all(){return Object.keys(this._documents).map(t=>this._documents[t])}keys(){return Object.keys(this._documents)}listen(t){t.__textDocumentSync=I.TextDocumentSyncKind.Full,t.onDidOpenTextDocument(r=>{let n=r.textDocument,i=this._configuration.create(n.uri,n.languageId,n.version,n.text);this._documents[n.uri]=i;let o=Object.freeze({document:i});this._onDidOpen.fire(o),this._onDidChangeContent.fire(o)}),t.onDidChangeTextDocument(r=>{let n=r.textDocument,i=r.contentChanges;if(i.length===0)return;let o=this._documents[n.uri],{version:s}=n;if(s==null)throw new Error(`Received document change event for ${n.uri} without valid version identifier`);o=this._configuration.update(o,i,s),this._documents[n.uri]=o,this._onDidChangeContent.fire(Object.freeze({document:o}))}),t.onDidCloseTextDocument(r=>{let n=this._documents[r.textDocument.uri];n&&(delete this._documents[r.textDocument.uri],this._onDidClose.fire(Object.freeze({document:n})))}),t.onWillSaveTextDocument(r=>{let n=this._documents[r.textDocument.uri];n&&this._onWillSave.fire(Object.freeze({document:n,reason:r.reason}))}),t.onWillSaveTextDocumentWaitUntil((r,n)=>{let i=this._documents[r.textDocument.uri];return i&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:i,reason:r.reason}),n):[]}),t.onDidSaveTextDocument(r=>{let n=this._documents[r.textDocument.uri];n&&this._onDidSave.fire(Object.freeze({document:n}))})}};ke.TextDocuments=Wu;var $u=class{constructor(){this._messages=Object.create(null)}add(t){let r=this._messages[t];r||(r=0),r++,this._messages[t]=r}sendErrors(t){Object.keys(this._messages).forEach(r=>{t.window.showErrorMessage(r)})}};ke.ErrorMessageTracker=$u;var zo=class{constructor(){}rawAttach(t){this._rawConnection=t}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(t){}initialize(t){}error(t){this.send(I.MessageType.Error,t)}warn(t){this.send(I.MessageType.Warning,t)}info(t){this.send(I.MessageType.Info,t)}log(t){this.send(I.MessageType.Log,t)}send(t,r){this._rawConnection&&this._rawConnection.sendNotification(I.LogMessageNotification.type,{type:t,message:r})}},Vu=class{constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}showErrorMessage(t,...r){let n={type:I.MessageType.Error,message:t,actions:r};return this.connection.sendRequest(I.ShowMessageRequest.type,n).then(Ho)}showWarningMessage(t,...r){let n={type:I.MessageType.Warning,message:t,actions:r};return this.connection.sendRequest(I.ShowMessageRequest.type,n).then(Ho)}showInformationMessage(t,...r){let n={type:I.MessageType.Info,message:t,actions:r};return this.connection.sendRequest(I.ShowMessageRequest.type,n).then(Ho)}},Hu=J.ProgressFeature(Vu),xp;(function(e){function t(){return new Bo}e.create=t})(xp=ke.BulkRegistration||(ke.BulkRegistration={}));var Bo=class{constructor(){this._registrations=[],this._registered=new Set}add(t,r){let n=Je.string(t)?t:t.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=Vo.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},Sp;(function(e){function t(){return new Vn(void 0,[])}e.create=t})(Sp=ke.BulkUnregistration||(ke.BulkUnregistration={}));var Vn=class{constructor(t,r){this._connection=t,this._unregistrations=new Map,r.forEach(n=>{this._unregistrations.set(n.method,n)})}get isAttached(){return!!this._connection}attach(t){this._connection=t}add(t){this._unregistrations.set(t.method,t)}dispose(){let t=[];for(let n of this._unregistrations.values())t.push(n);let r={unregisterations:t};this._connection.sendRequest(I.UnregistrationRequest.type,r).then(void 0,n=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(t){let r=Je.string(t)?t:t.method,n=this._unregistrations.get(r);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(I.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(r)},o=>{this._connection.console.info(`Unregistering request handler for ${n.id} failed.`)}),!0}},Jo=class{attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}register(t,r,n){return t instanceof Bo?this.registerMany(t):t instanceof Vn?this.registerSingle1(t,r,n):this.registerSingle2(t,r)}registerSingle1(t,r,n){let i=Je.string(r)?r:r.method,o=Vo.generateUuid(),s={registrations:[{id:o,method:i,registerOptions:n||{}}]};return t.isAttached||t.attach(this.connection),this.connection.sendRequest(I.RegistrationRequest.type,s).then(u=>(t.add({id:o,method:i}),t),u=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(u)))}registerSingle2(t,r){let n=Je.string(t)?t:t.method,i=Vo.generateUuid(),o={registrations:[{id:i,method:n,registerOptions:r||{}}]};return this.connection.sendRequest(I.RegistrationRequest.type,o).then(s=>I.Disposable.create(()=>{this.unregisterSingle(i,n)}),s=>(this.connection.console.info(`Registering request handler for ${n} failed.`),Promise.reject(s)))}unregisterSingle(t,r){let n={unregisterations:[{id:t,method:r}]};return this.connection.sendRequest(I.UnregistrationRequest.type,n).then(void 0,i=>{this.connection.console.info(`Unregistering request handler for ${t} failed.`)})}registerMany(t){let r=t.asRegistrationParams();return this.connection.sendRequest(I.RegistrationRequest.type,r).then(()=>new Vn(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},zu=class{constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}applyEdit(t){function r(i){return i&&!!i.edit}let n=r(t)?t:{edit:t};return this.connection.sendRequest(I.ApplyWorkspaceEditRequest.type,n)}},Bu=wp.WorkspaceFoldersFeature(bp.ConfigurationFeature(zu)),Uo=class{constructor(){this._trace=I.Trace.Off}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}set trace(t){this._trace=t}log(t,r){this._trace!==I.Trace.Off&&this.connection.sendNotification(I.LogTraceNotification.type,{message:t,verbose:this._trace===I.Trace.Verbose?r:void 0})}},Go=class{constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}logEvent(t){this.connection.sendNotification(I.TelemetryEventNotification.type,t)}},Xo=class{constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}attachWorkDoneProgress(t){return J.attachWorkDone(this.connection,t)}attachPartialResultProgress(t,r){return J.attachPartialResult(this.connection,r)}};ke._LanguagesImpl=Xo;var Ju=Cp.CallHierarchyFeature(Xo);function Uu(e,t){return function(r){return t(e(r))}}ke.combineConsoleFeatures=Uu;function Gu(e,t){return function(r){return t(e(r))}}ke.combineTelemetryFeatures=Gu;function Xu(e,t){return function(r){return t(e(r))}}ke.combineTracerFeatures=Xu;function Yu(e,t){return function(r){return t(e(r))}}ke.combineClientFeatures=Yu;function Zu(e,t){return function(r){return t(e(r))}}ke.combineWindowFeatures=Zu;function Qu(e,t){return function(r){return t(e(r))}}ke.combineWorkspaceFeatures=Qu;function Tp(e,t){return function(r){return t(e(r))}}ke.combineLanguagesFeatures=Tp;function kp(e,t){function r(i,o,s){return i&&o?s(i,o):i||o}return{__brand:"features",console:r(e.console,t.console,Uu),tracer:r(e.tracer,t.tracer,Xu),telemetry:r(e.telemetry,t.telemetry,Gu),client:r(e.client,t.client,Yu),window:r(e.window,t.window,Zu),workspace:r(e.workspace,t.workspace,Qu)}}ke.combineFeatures=kp;function _p(e,t,r){let n=r&&r.console?new(r.console(zo)):new zo,i=e(n);n.rawAttach(i);let o=r&&r.tracer?new(r.tracer(Uo)):new Uo,s=r&&r.telemetry?new(r.telemetry(Go)):new Go,u=r&&r.client?new(r.client(Jo)):new Jo,l=r&&r.window?new(r.window(Hu)):new Hu,f=r&&r.workspace?new(r.workspace(Bu)):new Bu,a=r&&r.languages?new(r.languages(Ju)):new Ju,c=[n,o,s,u,l,f,a];function m(p){return p instanceof Promise?p:Je.thenable(p)?new Promise((h,g)=>{p.then(O=>h(O),O=>g(O))}):Promise.resolve(p)}let y,x,T,C={listen:()=>i.listen(),sendRequest:(p,...h)=>i.sendRequest(Je.string(p)?p:p.method,...h),onRequest:(p,h)=>i.onRequest(p,h),sendNotification:(p,h)=>{let g=Je.string(p)?p:p.method;arguments.length===1?i.sendNotification(g):i.sendNotification(g,h)},onNotification:(p,h)=>i.onNotification(p,h),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:p=>x=p,onInitialized:p=>i.onNotification(I.InitializedNotification.type,p),onShutdown:p=>y=p,onExit:p=>T=p,get console(){return n},get telemetry(){return s},get tracer(){return o},get client(){return u},get window(){return l},get workspace(){return f},get languages(){return a},onDidChangeConfiguration:p=>i.onNotification(I.DidChangeConfigurationNotification.type,p),onDidChangeWatchedFiles:p=>i.onNotification(I.DidChangeWatchedFilesNotification.type,p),__textDocumentSync:void 0,onDidOpenTextDocument:p=>i.onNotification(I.DidOpenTextDocumentNotification.type,p),onDidChangeTextDocument:p=>i.onNotification(I.DidChangeTextDocumentNotification.type,p),onDidCloseTextDocument:p=>i.onNotification(I.DidCloseTextDocumentNotification.type,p),onWillSaveTextDocument:p=>i.onNotification(I.WillSaveTextDocumentNotification.type,p),onWillSaveTextDocumentWaitUntil:p=>i.onRequest(I.WillSaveTextDocumentWaitUntilRequest.type,p),onDidSaveTextDocument:p=>i.onNotification(I.DidSaveTextDocumentNotification.type,p),sendDiagnostics:p=>i.sendNotification(I.PublishDiagnosticsNotification.type,p),onHover:p=>i.onRequest(I.HoverRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),void 0)),onCompletion:p=>i.onRequest(I.CompletionRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onCompletionResolve:p=>i.onRequest(I.CompletionResolveRequest.type,p),onSignatureHelp:p=>i.onRequest(I.SignatureHelpRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),void 0)),onDeclaration:p=>i.onRequest(I.DeclarationRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onDefinition:p=>i.onRequest(I.DefinitionRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onTypeDefinition:p=>i.onRequest(I.TypeDefinitionRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onImplementation:p=>i.onRequest(I.ImplementationRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onReferences:p=>i.onRequest(I.ReferencesRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onDocumentHighlight:p=>i.onRequest(I.DocumentHighlightRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onDocumentSymbol:p=>i.onRequest(I.DocumentSymbolRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onWorkspaceSymbol:p=>i.onRequest(I.WorkspaceSymbolRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onCodeAction:p=>i.onRequest(I.CodeActionRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onCodeLens:p=>i.onRequest(I.CodeLensRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onCodeLensResolve:p=>i.onRequest(I.CodeLensResolveRequest.type,(h,g)=>p(h,g)),onDocumentFormatting:p=>i.onRequest(I.DocumentFormattingRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),void 0)),onDocumentRangeFormatting:p=>i.onRequest(I.DocumentRangeFormattingRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),void 0)),onDocumentOnTypeFormatting:p=>i.onRequest(I.DocumentOnTypeFormattingRequest.type,(h,g)=>p(h,g)),onRenameRequest:p=>i.onRequest(I.RenameRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),void 0)),onPrepareRename:p=>i.onRequest(I.PrepareRenameRequest.type,(h,g)=>p(h,g)),onDocumentLinks:p=>i.onRequest(I.DocumentLinkRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onDocumentLinkResolve:p=>i.onRequest(I.DocumentLinkResolveRequest.type,(h,g)=>p(h,g)),onDocumentColor:p=>i.onRequest(I.DocumentColorRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onColorPresentation:p=>i.onRequest(I.ColorPresentationRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onFoldingRanges:p=>i.onRequest(I.FoldingRangeRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onSelectionRanges:p=>i.onRequest(I.SelectionRangeRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),J.attachPartialResult(i,h))),onExecuteCommand:p=>i.onRequest(I.ExecuteCommandRequest.type,(h,g)=>p(h,g,J.attachWorkDone(i,h),void 0)),dispose:()=>i.dispose()};for(let p of c)p.attach(C);return i.onRequest(I.InitializeRequest.type,p=>{t.initialize(p),Je.string(p.trace)&&(o.trace=I.Trace.fromString(p.trace));for(let h of c)h.initialize(p.capabilities);if(x){let h=x(p,new I.CancellationTokenSource().token,J.attachWorkDone(i,p),void 0);return m(h).then(g=>{if(g instanceof I.ResponseError)return g;let O=g;O||(O={capabilities:{}});let q=O.capabilities;q||(q={},O.capabilities=q),q.textDocumentSync===void 0||q.textDocumentSync===null?q.textDocumentSync=Je.number(C.__textDocumentSync)?C.__textDocumentSync:I.TextDocumentSyncKind.None:!Je.number(q.textDocumentSync)&&!Je.number(q.textDocumentSync.change)&&(q.textDocumentSync.change=Je.number(C.__textDocumentSync)?C.__textDocumentSync:I.TextDocumentSyncKind.None);for(let D of c)D.fillServerCapabilities(q);return O})}else{let h={capabilities:{textDocumentSync:I.TextDocumentSyncKind.None}};for(let g of c)g.fillServerCapabilities(h.capabilities);return h}}),i.onRequest(I.ShutdownRequest.type,()=>{if(t.shutdownReceived=!0,y)return y(new I.CancellationTokenSource().token)}),i.onNotification(I.ExitNotification.type,()=>{try{T&&T()}finally{t.shutdownReceived?t.exit(0):t.exit(1)}}),i.onNotification(I.SetTraceNotification.type,p=>{o.trace=I.Trace.fromString(p.value)}),C}ke.createConnection=_p});var ec=W(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});var Pp=require("url"),ot=require("path"),Zo=require("fs"),Qo=require("child_process");function Rp(e){let t=Pp.parse(e);if(t.protocol!=="file:"||!t.path)return;let r=t.path.split("/");for(var n=0,i=r.length;n1){let o=r[0],s=r[1];o.length===0&&s.length>1&&s[1]===":"&&r.shift()}return ot.normalize(r.join("/"))}St.uriToFilePath=Rp;function Ko(){return process.platform==="win32"}function Hn(e,t,r,n){let i="NODE_PATH",o=["var p = process;","p.on('message',function(m){","if(m.c==='e'){","p.exit(0);","}","else if(m.c==='rs'){","try{","var r=require.resolve(m.a);","p.send({c:'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((s,u)=>{let l=process.env,f=Object.create(null);Object.keys(l).forEach(a=>f[a]=l[a]),t&&Zo.existsSync(t)&&(f[i]?f[i]=t+ot.delimiter+f[i]:f[i]=t,n&&n(`NODE_PATH value is: ${f[i]}`)),f.ELECTRON_RUN_AS_NODE="1";try{let a=Qo.fork("",[],{cwd:r,env:f,execArgv:["-e",o]});if(a.pid===void 0){u(new Error(`Starting process to resolve node module ${e} failed`));return}a.on("error",m=>{u(m)}),a.on("message",m=>{m.c==="r"&&(a.send({c:"e"}),m.s?s(m.r):u(new Error(`Failed to resolve module: ${e}`)))});let c={c:"rs",a:e};a.send(c)}catch(a){u(a)}})}St.resolve=Hn;function es(e){let t="npm",r=Object.create(null);Object.keys(process.env).forEach(o=>r[o]=process.env[o]),r.NO_UPDATE_NOTIFIER="true";let n={encoding:"utf8",env:r};Ko()&&(t="npm.cmd",n.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let o=Qo.spawnSync(t,["config","get","prefix"],n).stdout;if(!o){e&&e("'npm config get prefix' didn't return a value.");return}let s=o.trim();return e&&e(`'npm config get prefix' value is: ${s}`),s.length>0?Ko()?ot.join(s,"node_modules"):ot.join(s,"lib","node_modules"):void 0}catch(o){return}finally{process.removeListener("SIGPIPE",i)}}St.resolveGlobalNodePath=es;function Ep(e){let t="yarn",r={encoding:"utf8"};Ko()&&(t="yarn.cmd",r.shell=!0);let n=()=>{};try{process.on("SIGPIPE",n);let i=Qo.spawnSync(t,["global","dir","--json"],r),o=i.stdout;if(!o){e&&(e("'yarn global dir' didn't return a value."),i.stderr&&e(i.stderr));return}let s=o.trim().split(/\r?\n/);for(let u of s)try{let l=JSON.parse(u);if(l.type==="log")return ot.join(l.data,"node_modules")}catch(l){}return}catch(i){return}finally{process.removeListener("SIGPIPE",n)}}St.resolveGlobalYarnPath=Ep;var Ku;(function(e){let t;function r(){return t!==void 0||(process.platform==="win32"?t=!1:t=!Zo.existsSync(__filename.toUpperCase())||!Zo.existsSync(__filename.toLowerCase())),t}e.isCaseSensitive=r;function n(i,o){return r()?ot.normalize(o).indexOf(ot.normalize(i))===0:ot.normalize(o).toLowerCase().indexOf(ot.normalize(i).toLowerCase())===0}e.isParent=n})(Ku=St.FileSystem||(St.FileSystem={}));function Op(e,t,r,n){return r?(ot.isAbsolute(r)||(r=ot.join(e,r)),Hn(t,r,r,n).then(i=>Ku.isParent(r,i)?i:Promise.reject(new Error(`Failed to load ${t} from node path location.`))).then(void 0,i=>Hn(t,es(n),e,n))):Hn(t,es(n),e,n)}St.resolveModulePath=Op});var rc=W((oy,tc)=>{"use strict";tc.exports=Ct()});var ic=W(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});var ts=Ct();zn.SemanticTokensFeature=e=>class extends e{get semanticTokens(){return{on:t=>{let r=ts.Proposed.SemanticTokensRequest.type;this.connection.onRequest(r,(n,i)=>t(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onEdits:t=>{let r=ts.Proposed.SemanticTokensEditsRequest.type;this.connection.onRequest(r,(n,i)=>t(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:t=>{let r=ts.Proposed.SemanticTokensRangeRequest.type;this.connection.onRequest(r,(n,i)=>t(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};var nc=class{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(t,r,n,i,o){let s=t,u=r;this._dataLen>0&&(s-=this._prevLine,s===0&&(u-=this._prevChar)),this._data[this._dataLen++]=s,this._data[this._dataLen++]=u,this._data[this._dataLen++]=n,this._data[this._dataLen++]=i,this._data[this._dataLen++]=o,this._prevLine=t,this._prevChar=r}get id(){return this._id.toString()}previousResult(t){this.id===t&&(this._prevData=this._data),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this._data}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){if(this._prevData!==void 0){let t=this._prevData.length,r=this._data.length,n=0;for(;n{"use strict";function oc(e){for(var t in e)Cr.hasOwnProperty(t)||(Cr[t]=e[t])}Object.defineProperty(Cr,"__esModule",{value:!0});var sc=ic();oc(Ct());oc(Yo());var Np;(function(e){e.all={__brand:"features",languages:sc.SemanticTokensFeature},e.SemanticTokensBuilder=sc.SemanticTokensBuilder})(Np=Cr.ProposedFeatures||(Cr.ProposedFeatures={}))});var Bn=W(Xt=>{"use strict";function Fp(e){for(var t in e)Xt.hasOwnProperty(t)||(Xt[t]=e[t])}Object.defineProperty(Xt,"__esModule",{value:!0});var rs=yn(),qp=Yo(),rn=ec(),Yt=rc();Fp(ac());var Ap;(function(e){e.uriToFilePath=rn.uriToFilePath,e.resolveGlobalNodePath=rn.resolveGlobalNodePath,e.resolveGlobalYarnPath=rn.resolveGlobalYarnPath,e.resolve=rn.resolve,e.resolveModulePath=rn.resolveModulePath})(Ap=Xt.Files||(Xt.Files={}));var xr=!1,uc;function jp(){let e="--clientProcessId";function t(r){try{let n=parseInt(r);isNaN(n)||(uc=setInterval(()=>{try{process.kill(n,0)}catch(i){process.exit(xr?0:1)}},3e3))}catch(n){}}for(let r=2;r{let t=e.processId;rs.number(t)&&uc===void 0&&setInterval(()=>{try{process.kill(t,0)}catch(r){process.exit(xr?0:1)}},3e3)},get shutdownReceived(){return xr},set shutdownReceived(e){xr=e},exit:e=>{process.exit(e)}};function Ip(e,t,r,n){let i,o,s,u;return e!==void 0&&e.__brand==="features"&&(i=e,e=t,t=r,r=n),Yt.ConnectionStrategy.is(e)||Yt.ConnectionOptions.is(e)?u=e:(o=e,s=t,u=r),Mp(o,s,u,i)}Xt.createConnection=Ip;function Mp(e,t,r,n){if(!e&&!t&&process.argv.length>2){let u,l,f=process.argv.slice(2);for(let a=0;a{process.exit(xr?0:1)}),u.on("close",()=>{process.exit(xr?0:1)})}let s=u=>Yt.createProtocolConnection(e,t,u,r);return qp.createConnection(s,Dp,n)}});var lc=W((cy,cc)=>{"use strict";cc.exports=Bn()});var hs=W(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});var fs;function ds(){if(fs===void 0)throw new Error("No runtime abstraction layer installed");return fs}(function(e){function t(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");fs=r}e.install=t})(ds||(ds={}));ls.default=ds});var gs=W(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.config=ce.loadMessageBundle=ce.localize=ce.format=ce.setPseudo=ce.isPseudo=ce.isDefined=ce.BundleFormat=ce.MessageFormat=void 0;var xc=hs(),Bp;(function(e){e.file="file",e.bundle="bundle",e.both="both"})(Bp=ce.MessageFormat||(ce.MessageFormat={}));var Jp;(function(e){e.standalone="standalone",e.languagePack="languagePack"})(Jp=ce.BundleFormat||(ce.BundleFormat={}));var Sc;(function(e){function t(r){var n=r;return n&&ps(n.key)&&ps(n.comment)}e.is=t})(Sc||(Sc={}));function ps(e){return typeof e!="undefined"}ce.isDefined=ps;ce.isPseudo=!1;function Up(e){ce.isPseudo=e}ce.setPseudo=Up;function Tc(e,t){var r;return ce.isPseudo&&(e="\uFF3B"+e.replace(/[aouei]/g,"$&$&")+"\uFF3D"),t.length===0?r=e:r=e.replace(/\{(\d+)\}/g,function(n,i){var o=i[0],s=t[o],u=n;return typeof s=="string"?u=s:(typeof s=="number"||typeof s=="boolean"||s===void 0||s===null)&&(u=String(s)),u}),r}ce.format=Tc;function Gp(e,t){for(var r=[],n=2;n{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.config=At.loadMessageBundle=void 0;var at=require("path"),Ge=require("fs"),Zp=hs(),Ve=gs(),kc=gs();Object.defineProperty(At,"MessageFormat",{enumerable:!0,get:function(){return kc.MessageFormat}});Object.defineProperty(At,"BundleFormat",{enumerable:!0,get:function(){return kc.BundleFormat}});var _c=Object.prototype.toString;function Qp(e){return _c.call(e)==="[object Number]"}function Tt(e){return _c.call(e)==="[object String]"}function Kp(e){return e===!0||e===!1}function Er(e){return JSON.parse(Ge.readFileSync(e,"utf8"))}var Zn,Z;function eg(){if(Z={locale:void 0,language:void 0,languagePackSupport:!1,cacheLanguageResolution:!0,messageFormat:Ve.MessageFormat.bundle},Tt(process.env.VSCODE_NLS_CONFIG))try{var e=JSON.parse(process.env.VSCODE_NLS_CONFIG),t=void 0;if(e.availableLanguages){var r=e.availableLanguages["*"];Tt(r)&&(t=r)}if(Tt(e.locale)&&(Z.locale=e.locale.toLowerCase()),t===void 0?Z.language=Z.locale:t!=="en"&&(Z.language=t),Kp(e._languagePackSupport)&&(Z.languagePackSupport=e._languagePackSupport),Tt(e._cacheRoot)&&(Z.cacheRoot=e._cacheRoot),Tt(e._languagePackId)&&(Z.languagePackId=e._languagePackId),Tt(e._translationsConfigFile)){Z.translationsConfigFile=e._translationsConfigFile;try{Z.translationsConfig=Er(Z.translationsConfigFile)}catch(i){if(e._corruptedFile){var n=at.dirname(e._corruptedFile);Ge.exists(n,function(o){o&&Ge.writeFile(e._corruptedFile,"corrupted","utf8",function(s){console.error(s)})})}}}}catch(i){}Ve.setPseudo(Z.locale==="pseudo"),Zn=Object.create(null)}eg();function tg(){return Z.languagePackSupport===!0&&Z.cacheRoot!==void 0&&Z.languagePackId!==void 0&&Z.translationsConfigFile!==void 0&&Z.translationsConfig!==void 0}function ms(e){return function(t,r){for(var n=[],i=2;i=e.length){console.error(`Broken localize call found. Index out of bounds. Stacktrace is +: `+new Error("").stack);return}return Ve.format(e[t],n)}else{if(Tt(r))return console.warn("Message "+r+" didn't get externalized correctly."),Ve.format(r,n);console.error(`Broken localize call found. Stacktrace is +: `+new Error("").stack)}}}function rg(e){var t;if(Z.cacheLanguageResolution&&t)t=t;else{if(Ve.isPseudo||!Z.language)t=".nls.json";else for(var r=Z.language;r;){var n=".nls."+r+".json";if(Ge.existsSync(e+n)){t=n;break}else{var i=r.lastIndexOf("-");i>0?r=r.substring(0,i):(t=".nls.json",r=null)}}Z.cacheLanguageResolution&&(t=t)}return e+t}function ng(e){for(var t=Z.language;t;){var r=at.join(e,"nls.bundle."+t+".json");if(Ge.existsSync(r))return r;var n=t.lastIndexOf("-");n>0?t=t.substring(0,n):t=void 0}if(t===void 0){var r=at.join(e,"nls.bundle.json");if(Ge.existsSync(r))return r}}function ig(e){var t=Er(at.join(e,"nls.metadata.json")),r=Object.create(null);for(var n in t){var i=t[n];r[n]=i.messages}return r}function og(e,t){var r=Z.translationsConfig[e.id];if(!!r){var n=Er(r).contents,i=Er(at.join(t,"nls.metadata.json")),o=Object.create(null);for(var s in i){var u=i[s],l=n[e.outDir+"/"+s];if(l){for(var f=[],a=0;a{"use strict";var hl=require("url"),Kt=require("https"),pl="__agent_base_https_request_patched__";Kt.request[pl]||(Kt.request=function(e){return function(t,r){let n;return typeof t=="string"?n=hl.parse(t):n=Object.assign({},t),n.port==null&&(n.port=443),n.secureEndpoint=!0,e.call(Kt,n,r)}}(Kt.request),Kt.request[pl]=!0);Kt.get=function(e,t,r){let n;typeof e=="string"&&t&&typeof t!="function"?n=Object.assign({},hl.parse(e),t):!t&&!r?n=e:r||(n=e,r=t);let i=Kt.request(n,r);return i.end(),i}});var ml=W((As,js)=>{(function(e,t){typeof As=="object"&&typeof js!="undefined"?js.exports=t():typeof define=="function"&&define.amd?define(t):e.ES6Promise=t()})(As,function(){"use strict";function e(N){var M=typeof N;return N!==null&&(M==="object"||M==="function")}function t(N){return typeof N=="function"}var r=void 0;Array.isArray?r=Array.isArray:r=function(N){return Object.prototype.toString.call(N)==="[object Array]"};var n=r,i=0,o=void 0,s=void 0,u=function(M,d){O[i]=M,O[i+1]=d,i+=2,i===2&&(s?s(q):_())};function l(N){s=N}function f(N){u=N}var a=typeof window!="undefined"?window:void 0,c=a||{},m=c.MutationObserver||c.WebKitMutationObserver,y=typeof self=="undefined"&&typeof process!="undefined"&&{}.toString.call(process)==="[object process]",x=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";function T(){return function(){return process.nextTick(q)}}function C(){return typeof o!="undefined"?function(){o(q)}:g()}function p(){var N=0,M=new m(q),d=document.createTextNode("");return M.observe(d,{characterData:!0}),function(){d.data=N=++N%2}}function h(){var N=new MessageChannel;return N.port1.onmessage=q,function(){return N.port2.postMessage(0)}}function g(){var N=setTimeout;return function(){return N(q,1)}}var O=new Array(1e3);function q(){for(var N=0;N{"use strict";vl.exports=function(){"use strict";var e=void 0;function t(n){return typeof n=="function"}global!==void 0?e=global:window!==void 0&&window.document?e=window:e=self;var r=function(){if(!e.hasOwnProperty("Promise"))return!1;var n=e.Promise;return!n.hasOwnProperty("resolve")||!n.hasOwnProperty("reject")||!n.hasOwnProperty("all")||!n.hasOwnProperty("race")?!1:function(){var i=void 0,o=new e.Promise(function(s){i=s});return o?t(i):!1}()}();return r?e.Promise:ml().Promise}()});var wl=W((o0,bl)=>{"use strict";bl.exports=function(){"use strict";var e=yl();function t(r){return r&&typeof r.then=="function"&&typeof r.catch=="function"}return function(n,i){return function(){for(var o=arguments.length,s=Array(o),u=0;u1?T-1:0),p=1;p{"use strict";gl();var Ug=require("util").inherits,Gg=wl(),xl=require("events").EventEmitter;Cl.exports=er;function Xg(e){return e&&typeof e.addRequest=="function"}function er(e,t){if(!(this instanceof er))return new er(e,t);xl.call(this),this._promisifiedCallback=!1;let r=t;typeof e=="function"?this.callback=e:e&&(r=e),this.timeout=r&&r.timeout||null,this.options=r}Ug(er,xl);er.prototype.callback=function(t,r){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')};er.prototype.addRequest=function(t,r){let n=Object.assign({},r);n.host==null&&(n.host="localhost"),n.port==null&&(n.port=n.secureEndpoint?443:80);let i=Object.assign({},this.options,n);i.host&&i.path&&delete i.path,delete i.agent,delete i.hostname,delete i._defaultAgent,delete i.defaultPort,delete i.createConnection,t._last=!0,t.shouldKeepAlive=!1;let o,s=!1,u=this.timeout,l=this.freeSocket;function f(y){t._hadError||(t.emit("error",y),t._hadError=!0)}function a(){o=null,s=!0;let y=new Error('A "socket" was not created for HTTP request before '+u+"ms");y.code="ETIMEOUT",f(y)}function c(y){s||(o!=null&&(clearTimeout(o),o=null),f(y))}function m(y){if(!s)if(o!=null&&(clearTimeout(o),o=null),Xg(y))y.addRequest(t,i);else if(y){function x(){l(y,i)}y.on("free",x),t.onSocket(y)}else{let T=new Error("no Duplex stream was returned to agent-base for `"+t.method+" "+t.path+"`");f(T)}}!this._promisifiedCallback&&this.callback.length>=3&&(this.callback=Gg(this.callback,this),this._promisifiedCallback=!0),u>0&&(o=setTimeout(a,u));try{Promise.resolve(this.callback(t,i)).then(m,c)}catch(y){Promise.reject(y).catch(c)}};er.prototype.freeSocket=function(t,r){t.destroy()}});var Tl=W((a0,Sl)=>{var cn=1e3,ln=cn*60,fn=ln*60,dn=fn*24,Yg=dn*365.25;Sl.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Zg(e);if(r==="number"&&isNaN(e)===!1)return t.long?Kg(e):Qg(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Zg(e){if(e=String(e),!(e.length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!!t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Yg;case"days":case"day":case"d":return r*dn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*fn;case"minutes":case"minute":case"mins":case"min":case"m":return r*ln;case"seconds":case"second":case"secs":case"sec":case"s":return r*cn;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Qg(e){return e>=dn?Math.round(e/dn)+"d":e>=fn?Math.round(e/fn)+"h":e>=ln?Math.round(e/ln)+"m":e>=cn?Math.round(e/cn)+"s":e+"ms"}function Kg(e){return si(e,dn,"day")||si(e,fn,"hour")||si(e,ln,"minute")||si(e,cn,"second")||e+" ms"}function si(e,t,r){if(!(e{Y=kl.exports=Ms.debug=Ms.default=Ms;Y.coerce=em;Y.disable=tm;Y.enable=rm;Y.enabled=nm;Y.humanize=Tl();Y.instances=[];Y.names=[];Y.skips=[];Y.formatters={};function im(e){var t=0,r;for(r in e)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Y.colors[Math.abs(t)%Y.colors.length]}function Ms(e){var t;function r(){if(!!r.enabled){var n=r,i=+new Date,o=i-(t||i);n.diff=o,n.prev=t,n.curr=i,t=i;for(var s=new Array(arguments.length),u=0;u{De=_l.exports=Is();De.log=sm;De.formatArgs=am;De.save=um;De.load=Pl;De.useColors=cm;De.storage=typeof chrome!="undefined"&&typeof chrome.storage!="undefined"?chrome.storage.local:lm();De.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function cm(){return typeof window!="undefined"&&window.process&&window.process.type==="renderer"?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}De.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}};function am(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+De.humanize(this.diff),!!t){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,function(o){o!=="%%"&&(n++,o==="%c"&&(i=n))}),e.splice(i,0,r)}}function sm(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function um(e){try{e==null?De.storage.removeItem("debug"):De.storage.debug=e}catch(t){}}function Pl(){var e;try{e=De.storage.debug}catch(t){}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}De.enable(Pl());function lm(){try{return window.localStorage}catch(e){}}});var Nl=W((be,El)=>{var fm=require("tty"),ai=require("util");be=El.exports=Is();be.init=dm;be.log=hm;be.formatArgs=pm;be.save=gm;be.load=Ol;be.useColors=mm;be.colors=[6,2,3,4,5,1];try{Ls=require("supports-color"),Ls&&Ls.level>=2&&(be.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}var Ls;be.inspectOpts=Object.keys(process.env).filter(function(e){return/^debug_/i.test(e)}).reduce(function(e,t){var r=t.substring(6).toLowerCase().replace(/_([a-z])/g,function(i,o){return o.toUpperCase()}),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[r]=n,e},{});function mm(){return"colors"in be.inspectOpts?Boolean(be.inspectOpts.colors):fm.isatty(process.stderr.fd)}be.formatters.o=function(e){return this.inspectOpts.colors=this.useColors,ai.inspect(e,this.inspectOpts).split(` +`).map(function(t){return t.trim()}).join(" ")};be.formatters.O=function(e){return this.inspectOpts.colors=this.useColors,ai.inspect(e,this.inspectOpts)};function pm(e){var t=this.namespace,r=this.useColors;if(r){var n=this.color,i="[3"+(n<8?n:"8;5;"+n),o=" "+i+";1m"+t+" ";e[0]=o+e[0].split(` +`).join(` +`+o),e.push(i+"m+"+be.humanize(this.diff)+"")}else e[0]=vm()+t+" "+e[0]}function vm(){return be.inspectOpts.hideDate?"":new Date().toISOString()+" "}function hm(){return process.stderr.write(ai.format.apply(ai,arguments)+` +`)}function gm(e){e==null?delete process.env.DEBUG:process.env.DEBUG=e}function Ol(){return process.env.DEBUG}function dm(e){e.inspectOpts={};for(var t=Object.keys(be.inspectOpts),r=0;r{typeof process=="undefined"||process.type==="renderer"?Ws.exports=Rl():Ws.exports=Nl()});var jl=W((c0,ql)=>{var ym=require("net"),bm=require("tls"),$s=require("url"),Al=Ds(),wm=require("util").inherits,ui=Fl()("http-proxy-agent");ql.exports=hn;function hn(e){if(!(this instanceof hn))return new hn(e);if(typeof e=="string"&&(e=$s.parse(e)),!e)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");ui("creating new HttpProxyAgent instance: %o",e),Al.call(this,e);var t=Object.assign({},e);this.secureProxy=t.protocol?/^https:?$/i.test(t.protocol):!1,t.host=t.hostname||t.host,t.port=+t.port||(this.secureProxy?443:80),t.host&&t.path&&(delete t.path,delete t.pathname),this.proxy=t}wm(hn,Al);hn.prototype.callback=function(t,r,n){var i=this.proxy,o=$s.parse(t.path);o.protocol==null&&(o.protocol="http:"),o.hostname==null&&(o.hostname=r.hostname||r.host),o.port==null&&(o.port=r.port),o.port==80&&delete o.port;var s=$s.format(o);t.path=s,i.auth&&t.setHeader("Proxy-Authorization","Basic "+Buffer.from(i.auth).toString("base64"));var u;if(this.secureProxy?u=bm.connect(i):u=ym.connect(i),t._header&&(ui("regenerating stored HTTP header string for request"),t._header=null,t._implicitHeader(),t.output&&t.output.length>0)){ui("patching connection write() output buffer with updated header");var l=t.output[0],f=l.indexOf(`\r +\r +`)+4;t.output[0]=t._header+l.substring(f),ui("output buffer: %o",t.output)}n(null,u)}});var Ml=W((l0,Dl)=>{var Fr=1e3,qr=Fr*60,Ar=qr*60,tr=Ar*24,Cm=tr*7,xm=tr*365.25;Dl.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Sm(e);if(r==="number"&&isFinite(e))return t.long?km(e):Tm(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Sm(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*xm;case"weeks":case"week":case"w":return r*Cm;case"days":case"day":case"d":return r*tr;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Ar;case"minutes":case"minute":case"mins":case"min":case"m":return r*qr;case"seconds":case"second":case"secs":case"sec":case"s":return r*Fr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Tm(e){var t=Math.abs(e);return t>=tr?Math.round(e/tr)+"d":t>=Ar?Math.round(e/Ar)+"h":t>=qr?Math.round(e/qr)+"m":t>=Fr?Math.round(e/Fr)+"s":e+"ms"}function km(e){var t=Math.abs(e);return t>=tr?ci(e,t,tr,"day"):t>=Ar?ci(e,t,Ar,"hour"):t>=qr?ci(e,t,qr,"minute"):t>=Fr?ci(e,t,Fr,"second"):e+" ms"}function ci(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}});var Vs=W((f0,Il)=>{"use strict";function _m(e){r.debug=r,r.default=r,r.coerce=l,r.disable=s,r.enable=o,r.enabled=u,r.humanize=Ml(),Object.keys(e).forEach(function(f){r[f]=e[f]}),r.instances=[],r.names=[],r.skips=[],r.formatters={};function t(f){for(var a=0,c=0;c{"use strict";function fi(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fi=function(r){return typeof r}:fi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},fi(e)}Xe.log=Pm;Xe.formatArgs=Rm;Xe.save=Em;Xe.load=Om;Xe.useColors=Nm;Xe.storage=Fm();Xe.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Nm(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Rm(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+li.exports.humanize(this.diff),!!this.useColors){var t="color: "+this.color;e.splice(1,0,t,"color: inherit");var r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,function(i){i!=="%%"&&(r++,i==="%c"&&(n=r))}),e.splice(n,0,t)}}function Pm(){var e;return(typeof console=="undefined"?"undefined":fi(console))==="object"&&console.log&&(e=console).log.apply(e,arguments)}function Em(e){try{e?Xe.storage.setItem("debug",e):Xe.storage.removeItem("debug")}catch(t){}}function Om(){var e;try{e=Xe.storage.getItem("debug")}catch(t){}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}function Fm(){try{return localStorage}catch(e){}}li.exports=Vs()(Xe);var qm=li.exports.formatters;qm.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var $l=W((Oe,di)=>{"use strict";var Am=require("tty"),hi=require("util");Oe.init=jm;Oe.log=Dm;Oe.formatArgs=Mm;Oe.save=Im;Oe.load=Lm;Oe.useColors=Wm;Oe.colors=[6,2,3,4,5,1];try{pi=require("supports-color"),pi&&(pi.stderr||pi).level>=2&&(Oe.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}var pi;Oe.inspectOpts=Object.keys(process.env).filter(function(e){return/^debug_/i.test(e)}).reduce(function(e,t){var r=t.substring(6).toLowerCase().replace(/_([a-z])/g,function(i,o){return o.toUpperCase()}),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[r]=n,e},{});function Wm(){return"colors"in Oe.inspectOpts?Boolean(Oe.inspectOpts.colors):Am.isatty(process.stderr.fd)}function Mm(e){var t=this.namespace,r=this.useColors;if(r){var n=this.color,i="[3"+(n<8?n:"8;5;"+n),o=" ".concat(i,";1m").concat(t," ");e[0]=o+e[0].split(` +`).join(` +`+o),e.push(i+"m+"+di.exports.humanize(this.diff)+"")}else e[0]=$m()+t+" "+e[0]}function $m(){return Oe.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Dm(){return process.stderr.write(hi.format.apply(hi,arguments)+` +`)}function Im(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function Lm(){return process.env.DEBUG}function jm(e){e.inspectOpts={};for(var t=Object.keys(Oe.inspectOpts),r=0;r{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?Hs.exports=Ll():Hs.exports=$l()});var Ul=W((h0,Hl)=>{var zl=require("net"),Bl=require("tls"),Vm=require("url"),Hm=require("assert"),Jl=Ds(),zm=require("util").inherits,rr=Vl()("https-proxy-agent");Hl.exports=pn;function pn(e){if(!(this instanceof pn))return new pn(e);if(typeof e=="string"&&(e=Vm.parse(e)),!e)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");rr("creating new HttpsProxyAgent instance: %o",e),Jl.call(this,e);var t=Object.assign({},e);this.secureProxy=t.protocol?/^https:?$/i.test(t.protocol):!1,t.host=t.hostname||t.host,t.port=+t.port||(this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in t)&&(t.ALPNProtocols=["http 1.1"]),t.host&&t.path&&(delete t.path,delete t.pathname),this.proxy=t,this.defaultPort=443}zm(pn,Jl);pn.prototype.callback=function(t,r,n){var i=this.proxy,o;this.secureProxy?o=Bl.connect(i):o=zl.connect(i);var s=[],u=0;function l(){var g=o.read();g?y(g):o.once("readable",l)}function f(){o.removeListener("end",c),o.removeListener("error",m),o.removeListener("close",a),o.removeListener("readable",l)}function a(g){rr("onclose had error %o",g)}function c(){rr("onend")}function m(g){f(),n(g)}function y(g){s.push(g),u+=g.length;var O=Buffer.concat(s,u),q=O.toString("ascii");if(!~q.indexOf(`\r +\r +`)){rr("have not received end of HTTP headers yet..."),l();return}var D=q.substring(0,q.indexOf(`\r +`)),_=+D.split(" ")[1];if(rr("got proxy server response: %o",D),_==200){var b=o;s=O=null,r.secureEndpoint&&(rr("upgrading proxy-connected socket to TLS connection: %o",r.host),r.socket=o,r.servername=r.servername||r.host,r.host=null,r.hostname=null,r.port=null,b=Bl.connect(r)),f(),t.once("socket",Bm),n(null,b)}else f(),o.destroy(),o=new zl.Socket,o.readable=!0,s=O,t.once("socket",x),n(null,o)}function x(g){rr("replaying proxy buffer for failed request"),Hm(g.listenerCount("data")>0),g.push(s),s=null}o.on("error",m),o.on("close",a),o.on("end",c),l();var T=r.host+":"+r.port,C="CONNECT "+T+` HTTP/1.1\r +`,p=Object.assign({},i.headers);i.auth&&(p["Proxy-Authorization"]="Basic "+Buffer.from(i.auth).toString("base64"));var h=r.host;Jm(r.port,r.secureEndpoint)||(h+=":"+r.port),p.Host=h,p.Connection="close",Object.keys(p).forEach(function(g){C+=g+": "+p[g]+`\r +`}),o.write(C+`\r +`)};function Bm(e){e.resume()}function Jm(e,t){return Boolean(!t&&e===80||t&&e===443)}});var ef=W(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});var ft=require("path"),Ye=require("fs"),Gl=Object.prototype.toString;function gi(e){return typeof e!="undefined"}function Um(e){return Gl.call(e)==="[object Number]"}function kt(e){return Gl.call(e)==="[object String]"}function Gm(e){return e===!0||e===!1}function jr(e){return JSON.parse(Ye.readFileSync(e,"utf8"))}var Dr;(function(e){e.file="file",e.bundle="bundle",e.both="both"})(Dr=Wt.MessageFormat||(Wt.MessageFormat={}));var Xl;(function(e){e.standalone="standalone",e.languagePack="languagePack"})(Xl=Wt.BundleFormat||(Wt.BundleFormat={}));var Yl;(function(e){function t(r){var n=r;return n&&gi(n.key)&&gi(n.comment)}e.is=t})(Yl||(Yl={}));var Zl,mi,Q,vi;function Xm(){if(Q={locale:void 0,language:void 0,languagePackSupport:!1,cacheLanguageResolution:!0,messageFormat:Dr.bundle},kt(process.env.VSCODE_NLS_CONFIG))try{var e=JSON.parse(process.env.VSCODE_NLS_CONFIG),t=void 0,r=void 0;if(e.availableLanguages){var n=e.availableLanguages["*"];kt(n)&&(t=n)}if(kt(e.locale)&&(Q.locale=e.locale.toLowerCase()),t===void 0?Q.language=Q.locale:t!=="en"&&(Q.language=t),Gm(e._languagePackSupport)&&(Q.languagePackSupport=e._languagePackSupport),kt(e._cacheRoot)&&(Q.cacheRoot=e._cacheRoot),kt(e._languagePackId)&&(Q.languagePackId=e._languagePackId),kt(e._translationsConfigFile)){Q.translationsConfigFile=e._translationsConfigFile;try{Q.translationsConfig=jr(Q.translationsConfigFile)}catch(o){if(e._corruptedFile){var i=ft.dirname(e._corruptedFile);Ye.exists(i,function(s){s&&Ye.writeFile(e._corruptedFile,"corrupted","utf8",function(u){console.error(u)})})}}}}catch(o){}vi=Q.locale==="pseudo",Zl=void 0,mi=Object.create(null)}Xm();function Ym(){return Q.languagePackSupport===!0&&Q.cacheRoot!==void 0&&Q.languagePackId!==void 0&&Q.translationsConfigFile!==void 0&&Q.translationsConfig!==void 0}function zs(e,t){var r;return vi&&(e="\uFF3B"+e.replace(/[aouei]/g,"$&$&")+"\uFF3D"),t.length===0?r=e:r=e.replace(/\{(\d+)\}/g,function(n,i){var o=i[0],s=t[o],u=n;return typeof s=="string"?u=s:(typeof s=="number"||typeof s=="boolean"||s===void 0||s===null)&&(u=String(s)),u}),r}function Bs(e){return function(t,r){for(var n=[],i=2;i=e.length){console.error(`Broken localize call found. Index out of bounds. Stacktrace is +: `+new Error("").stack);return}return zs(e[t],n)}else{if(kt(r))return console.warn("Message "+r+" didn't get externalized correctly."),zs(r,n);console.error(`Broken localize call found. Stacktrace is +: `+new Error("").stack)}}}function Zm(e,t){for(var r=[],n=2;n0?r=r.substring(0,i):(t=".nls.json",r=null)}}Q.cacheLanguageResolution&&(t=t)}return e+t}function Km(e){for(var t=Q.language;t;){var r=ft.join(e,"nls.bundle."+t+".json");if(Ye.existsSync(r))return r;var n=t.lastIndexOf("-");n>0?t=t.substring(0,n):t=void 0}if(t===void 0){var r=ft.join(e,"nls.bundle.json");if(Ye.existsSync(r))return r}}function ev(e){var t=jr(ft.join(e,"nls.metadata.json")),r=Object.create(null);for(var n in t){var i=t[n];r[n]=i.messages}return r}function tv(e,t){var r=Q.translationsConfig[e.id];if(!!r){var n=jr(r).contents,i=jr(ft.join(t,"nls.metadata.json")),o=Object.create(null);for(var s in i){var u=i[s],l=n[e.outDir+"/"+s];if(l){for(var f=[],a=0;a{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});var Us=require("url"),av=require("https"),uv=require("http"),cv=jl(),lv=Ul(),tf=require("zlib"),rf=ef();process.env.VSCODE_NLS_CONFIG&&(nf=process.env.VSCODE_NLS_CONFIG,rf.config(JSON.parse(nf)));var nf,fe=rf.loadMessageBundle(),of=null,Gs=!0;function fv(e,t){of=e,Gs=t}gn.configure=fv;function sf(e){var t=dv(e.url,{proxyUrl:of,strictSSL:Gs});return e=Xs({},e),e=Xs(e,{agent:t,strictSSL:Gs}),typeof e.followRedirects!="number"&&(e.followRedirects=5),af(e).then(function(r){return new Promise(function(n,i){var o=r.res,s=o,u=o.headers&&o.headers["content-encoding"],l=!1;if(u==="gzip"){var f=tf.createGunzip();o.pipe(f),s=f}else if(u==="deflate"){var a=tf.createInflate();o.pipe(a),s=a}var c=[];s.on("data",function(m){return c.push(m)}),s.on("end",function(){if(!l){if(l=!0,e.followRedirects>0&&(o.statusCode>=300&&o.statusCode<=303||o.statusCode===307)){var m=o.headers.location;if(m){var y={type:e.type,url:m,user:e.user,password:e.password,responseType:e.responseType,headers:e.headers,timeout:e.timeout,followRedirects:e.followRedirects-1,data:e.data};sf(y).then(n,i);return}}var x={responseText:c.join(""),status:o.statusCode,headers:o.headers||{}};o.statusCode>=200&&o.statusCode<300||o.statusCode===1223?n(x):i(x)}}),s.on("error",function(m){var y={responseText:fe("error","Unable to access {0}. Error: {1}",e.url,m.message),status:500,headers:void 0};l=!0,i(y)})})},function(r){var n;return t?n=fe("error.cannot.connect.proxy","Unable to connect to {0} through a proxy . Error: {1}",e.url,r.message):n=fe("error.cannot.connect","Unable to connect to {0}. Error: {1}",e.url,r.message),Promise.reject({responseText:n,status:404})})}gn.xhr=sf;function Xs(e){for(var t=[],r=1;r=300&&u.statusCode<400&&e.followRedirects&&e.followRedirects>0&&u.headers.location?r(af(Xs({},e,{url:u.headers.location,followRedirects:e.followRedirects-1}))):r({req:t,res:u})};i.protocol==="https:"?t=av.request(o,s):t=uv.request(o,s),t.on("error",n),e.timeout&&t.setTimeout(e.timeout),e.data&&t.write(e.data),t.end()})}function hv(e){if(!(e<400))switch(e){case 400:return fe("status.400","Bad request. The request cannot be fulfilled due to bad syntax.");case 401:return fe("status.401","Unauthorized. The server is refusing to respond.");case 403:return fe("status.403","Forbidden. The server is refusing to respond.");case 404:return fe("status.404","Not Found. The requested location could not be found.");case 405:return fe("status.405","Method not allowed. A request was made using a request method not supported by that location.");case 406:return fe("status.406","Not Acceptable. The server can only generate a response that is not accepted by the client.");case 407:return fe("status.407","Proxy Authentication Required. The client must first authenticate itself with the proxy.");case 408:return fe("status.408","Request Timeout. The server timed out waiting for the request.");case 409:return fe("status.409","Conflict. The request could not be completed because of a conflict in the request.");case 410:return fe("status.410","Gone. The requested page is no longer available.");case 411:return fe("status.411",'Length Required. The "Content-Length" is not defined.');case 412:return fe("status.412","Precondition Failed. The precondition given in the request evaluated to false by the server.");case 413:return fe("status.413","Request Entity Too Large. The server will not accept the request, because the request entity is too large.");case 414:return fe("status.414","Request-URI Too Long. The server will not accept the request, because the URL is too long.");case 415:return fe("status.415","Unsupported Media Type. The server will not accept the request, because the media type is not supported.");case 500:return fe("status.500","Internal Server Error.");case 501:return fe("status.501","Not Implemented. The server either does not recognize the request method, or it lacks the ability to fulfill the request.");case 503:return fe("status.503","Service Unavailable. The server is currently unavailable (overloaded or down).");default:return fe("status.416","HTTP status code {0}",e)}}gn.getErrorStatusDescription=hv;function pv(e){return e.protocol==="http:"?process.env.HTTP_PROXY||process.env.http_proxy||null:e.protocol==="https:"&&(process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy)||null}function dv(e,t){t===void 0&&(t={});var r=Us.parse(e),n=t.proxyUrl||pv(r);if(!n)return null;var i=Us.parse(n);if(!/^https?:$/.test(i.protocol))return null;var o={host:i.hostname,port:Number(i.port),auth:i.auth,rejectUnauthorized:typeof t.strictSSL=="boolean"?t.strictSSL:!0};return r.protocol==="http:"?new cv(o):new lv(o)}});var ff=W(()=>{var cf=Ke(lc()),Mr=Ke(uf()),lf=Ke(require("fs")),Ir=cf.createConnection();console.log=Ir.console.log.bind(Ir.console);console.error=Ir.console.error.bind(Ir.console);process.on("unhandledRejection",e=>{Ir.console.error(Sr("Unhandled exception",e))});function gv(){return{getContent(e,t){return Mr.xhr({url:e,followRedirects:5,headers:{"Accept-Encoding":"gzip, deflate"}}).then(n=>n.responseText,n=>Promise.reject(n.responseText||Mr.getErrorStatusDescription(n.status)||n.toString()))}}}function mv(){return{getContent(e,t){return new Promise((r,n)=>{let i=lt.parse(e);lf.readFile(i.fsPath,t,(o,s)=>{if(o)return n(o);r(s.toString())})})}}}dl(Ir,{file:mv(),http:gv(),configureHttpRequests:Mr.configure})});var Jn=Ke(Bn());function Sr(e,t){if(t instanceof Error){let r=t;return`${e}: ${r.message} +${r.stack}`}else{if(typeof t=="string")return`${e}: ${t}`;if(t)return`${e}: ${t.toString()}`}return e}function nn(e,t,r,n){return new Promise(i=>{setImmediate(()=>(n.isCancellationRequested&&i(Un()),e().then(o=>{if(n.isCancellationRequested){i(Un());return}else i(o)},o=>{console.error(Sr(r,o)),i(t)})))})}function Tr(e,t,r,n){return new Promise(i=>{setImmediate(()=>{if(n.isCancellationRequested)i(Un());else try{let o=e();if(n.isCancellationRequested){i(Un());return}else i(o)}catch(o){console.error(Sr(r,o)),i(t)}})})}function Un(){return console.log("cancelled"),new Jn.ResponseError(Jn.ErrorCodes.RequestCancelled,"Request cancelled")}var je=Ke(Bn());"use strict";function _r(e,t){t===void 0&&(t=!1);var r=e.length,n=0,i="",o=0,s=16,u=0,l=0,f=0,a=0,c=0;function m(g,O){for(var q=0,D=0;q=48&&_<=57)D=D*16+_-48;else if(_>=65&&_<=70)D=D*16+_-65+10;else if(_>=97&&_<=102)D=D*16+_-97+10;else break;n++,q++}return q=r){g+=e.substring(O,n),c=2;break}var q=e.charCodeAt(n);if(q===34){g+=e.substring(O,n),n++;break}if(q===92){if(g+=e.substring(O,n),n++,n>=r){c=2;break}var D=e.charCodeAt(n++);switch(D){case 34:g+='"';break;case 92:g+="\\";break;case 47:g+="/";break;case 98:g+="\b";break;case 102:g+="\f";break;case 110:g+=` +`;break;case 114:g+="\r";break;case 116:g+=" ";break;case 117:var _=m(4,!0);_>=0?g+=String.fromCharCode(_):c=4;break;default:c=5}O=n;continue}if(q>=0&&q<=31)if(on(q)){g+=e.substring(O,n),c=2;break}else c=6;n++}return g}function C(){if(i="",c=0,o=n,l=u,a=f,n>=r)return o=r,s=17;var g=e.charCodeAt(n);if(ns(g)){do n++,i+=String.fromCharCode(g),g=e.charCodeAt(n);while(ns(g));return s=15}if(on(g))return n++,i+=String.fromCharCode(g),g===13&&e.charCodeAt(n)===10&&(n++,i+=` +`),u++,f=n,s=14;switch(g){case 123:return n++,s=1;case 125:return n++,s=2;case 91:return n++,s=3;case 93:return n++,s=4;case 58:return n++,s=6;case 44:return n++,s=5;case 34:return n++,i=T(),s=10;case 47:var O=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n=12&&g<=15);return g}return{setPosition:y,getPosition:function(){return n},scan:t?h:C,getToken:function(){return s},getTokenValue:function(){return i},getTokenOffset:function(){return o},getTokenLength:function(){return n-o},getTokenStartLine:function(){return l},getTokenStartCharacter:function(){return o-a},getTokenError:function(){return c}}}function ns(e){return e===32||e===9||e===11||e===12||e===160||e===5760||e>=8192&&e<=8203||e===8239||e===8287||e===12288||e===65279}function on(e){return e===10||e===13||e===8232||e===8233}function kr(e){return e>=48&&e<=57}"use strict";function ss(e,t,r){var n,i,o,s,u;if(t){for(s=t.offset,u=s+t.length,o=s;o>0&&!os(e,o-1);)o--;for(var l=u;ls)&&e.substring(L,$)!==F&&p.push({offset:L,length:$-L,content:F})}var g=C();if(g!==17){var O=y.getTokenOffset()+o,q=is(m,n);h(q,o,O)}for(;g!==17;){for(var D=y.getTokenOffset()+y.getTokenLength()+o,_=C(),b="",v=!1;!a&&(_===12||_===13);){var w=y.getTokenOffset()+o;h(" ",D,w),D=y.getTokenOffset()+y.getTokenLength()+o,v=_===12,b=v?T():"",_=C()}if(_===2)g!==1&&(c--,b=T());else if(_===4)g!==3&&(c--,b=T());else{switch(g){case 3:case 1:c++,b=T();break;case 5:case 12:b=T();break;case 13:a?b=T():v||(b=" ");break;case 6:v||(b=" ");break;case 10:if(_===6){v||(b="");break}case 7:case 8:case 9:case 11:case 2:case 4:_===12||_===13?v||(b=" "):_!==5&&_!==17&&(x=!0);break;case 16:x=!0;break}a&&(_===12||_===13)&&(b=T())}_===17&&(b=r.insertFinalNewline?f:"");var R=y.getTokenOffset()+o;h(b,D,R),g=_}return p}function is(e,t){for(var r="",n=0;n=e.offset&&t0)for(var F=n.getToken();F!==17;){if(w.indexOf(F)!==-1){p();break}else if(R.indexOf(F)!==-1)break;F=p()}}function g(v){var w=n.getTokenValue();return v?c(w):u(w),p(),!0}function O(){switch(n.getToken()){case 11:var v=n.getTokenValue(),w=Number(v);isNaN(w)&&(h(2),w=0),c(w);break;case 7:c(null);break;case 8:c(!0);break;case 9:c(!1);break;default:return!1}return p(),!0}function q(){return n.getToken()!==10?(h(3,[],[2,5]),!1):(g(!1),n.getToken()===6?(m(":"),p(),b()||h(4,[],[2,5])):h(5,[],[2,5]),!0)}function D(){s(),p();for(var v=!1;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(v||h(4,[],[]),m(","),p(),n.getToken()===2&&C)break}else v&&h(6,[],[]);q()||h(4,[],[2,5]),v=!0}return l(),n.getToken()!==2?h(7,[2],[]):p(),!0}function _(){f(),p();for(var v=!1;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(v||h(4,[],[]),m(","),p(),n.getToken()===4&&C)break}else v&&h(6,[],[]);b()||h(4,[],[4,5]),v=!0}return a(),n.getToken()!==4?h(8,[4],[]):p(),!0}function b(){switch(n.getToken()){case 3:return _();case 1:return D();case 10:return g(!0);default:return O()}}return p(),n.getToken()===17?r.allowEmptyContent?!0:(h(4,[],[]),!1):b()?(n.getToken()!==17&&h(9,[],[]),!0):(h(4,[],[]),!1)}"use strict";"use strict";var ht=_r;var hc=dc;var pc=us,gc=as,mc=Xn;function vc(e,t,r){return ss(e,t,r)}function Pr(e,t){if(e===t)return!0;if(e==null||t===null||t===void 0||typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;var r,n;if(Array.isArray(e)){if(e.length!==t.length)return!1;for(r=0;rt?i=o:n=o+1}var s=n-1;return{line:s,character:t-r[s]}},e.prototype.offsetAt=function(t){var r=this.getLineOffsets();if(t.line>=r.length)return this._content.length;if(t.line<0)return 0;var n=r[t.line],i=t.line+1l&&f.push(s.substring(l,y)),m.newText.length&&f.push(m.newText),l=i.offsetAt(m.range.end)}return f.push(s.substr(l)),f.join("")}e.applyEdits=n})(Rr||(Rr={}));function cs(e,t){if(e.length<=1)return e;var r=e.length/2|0,n=e.slice(0,r),i=e.slice(r);cs(n,t),cs(i,t);for(var o=0,s=0,u=0;or.line||t.line===r.line&&t.character>r.character?{start:r,end:t}:e}function zp(e){var t=wc(e.range);return t!==e.range?{newText:e.newText,range:t}:e}var X;(function(e){e[e.Undefined=0]="Undefined",e[e.EnumValueMismatch=1]="EnumValueMismatch",e[e.Deprecated=2]="Deprecated",e[e.UnexpectedEndOfComment=257]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=258]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=259]="UnexpectedEndOfNumber",e[e.InvalidUnicode=260]="InvalidUnicode",e[e.InvalidEscapeCharacter=261]="InvalidEscapeCharacter",e[e.InvalidCharacter=262]="InvalidCharacter",e[e.PropertyExpected=513]="PropertyExpected",e[e.CommaExpected=514]="CommaExpected",e[e.ColonExpected=515]="ColonExpected",e[e.ValueExpected=516]="ValueExpected",e[e.CommaOrCloseBacketExpected=517]="CommaOrCloseBacketExpected",e[e.CommaOrCloseBraceExpected=518]="CommaOrCloseBraceExpected",e[e.TrailingComma=519]="TrailingComma",e[e.DuplicateKey=520]="DuplicateKey",e[e.CommentNotPermitted=521]="CommentNotPermitted",e[e.SchemaResolveError=768]="SchemaResolveError"})(X||(X={}));var Yn;(function(e){e.LATEST={textDocument:{completion:{completionItem:{documentationFormat:[k.MarkupKind.Markdown,k.MarkupKind.PlainText],commitCharactersSupport:!0}}}}})(Yn||(Yn={}));var Ec=Ke(Or()),Zt=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),V=Ec.loadMessageBundle(),lg={"color-hex":{errorMessage:V("colorHexFormatWarning","Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA."),pattern:/^#([0-9A-Fa-f]{3,4}|([0-9A-Fa-f]{2}){3,4})$/},"date-time":{errorMessage:V("dateTimeFormatWarning","String is not a RFC3339 date-time."),pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},date:{errorMessage:V("dateFormatWarning","String is not a RFC3339 date."),pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i},time:{errorMessage:V("timeFormatWarning","String is not a RFC3339 time."),pattern:/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},email:{errorMessage:V("emailFormatWarning","String is not an e-mail address."),pattern:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/}},Qt=function(){function e(t,r,n){n===void 0&&(n=0),this.offset=r,this.length=n,this.parent=t}return Object.defineProperty(e.prototype,"children",{get:function(){return[]},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return"type: "+this.type+" ("+this.offset+"/"+this.length+")"+(this.parent?" parent: {"+this.parent.toString()+"}":"")},e}();var fg=function(e){Zt(t,e);function t(r,n){var i=e.call(this,r,n)||this;return i.type="null",i.value=null,i}return t}(Qt);var Oc=function(e){Zt(t,e);function t(r,n,i){var o=e.call(this,r,i)||this;return o.type="boolean",o.value=n,o}return t}(Qt);var dg=function(e){Zt(t,e);function t(r,n){var i=e.call(this,r,n)||this;return i.type="array",i.items=[],i}return Object.defineProperty(t.prototype,"children",{get:function(){return this.items},enumerable:!1,configurable:!0}),t}(Qt);var hg=function(e){Zt(t,e);function t(r,n){var i=e.call(this,r,n)||this;return i.type="number",i.isInteger=!0,i.value=Number.NaN,i}return t}(Qt);var bs=function(e){Zt(t,e);function t(r,n,i){var o=e.call(this,r,n,i)||this;return o.type="string",o.value="",o}return t}(Qt);var pg=function(e){Zt(t,e);function t(r,n,i){var o=e.call(this,r,n)||this;return o.type="property",o.colonOffset=-1,o.keyNode=i,o}return Object.defineProperty(t.prototype,"children",{get:function(){return this.valueNode?[this.keyNode,this.valueNode]:[this.keyNode]},enumerable:!1,configurable:!0}),t}(Qt);var gg=function(e){Zt(t,e);function t(r,n){var i=e.call(this,r,n)||this;return i.type="object",i.properties=[],i}return Object.defineProperty(t.prototype,"children",{get:function(){return this.properties},enumerable:!1,configurable:!0}),t}(Qt);function Ae(e){return Ue(e)?e?{}:{not:{}}:e}var Nc;(function(e){e[e.Key=0]="Key",e[e.Enum=1]="Enum"})(Nc||(Nc={}));var mg=function(){function e(t,r){t===void 0&&(t=-1),this.focusOffset=t,this.exclude=r,this.schemas=[]}return e.prototype.add=function(t){this.schemas.push(t)},e.prototype.merge=function(t){Array.prototype.push.apply(this.schemas,t.schemas)},e.prototype.include=function(t){return(this.focusOffset===-1||ws(t,this.focusOffset))&&t!==this.exclude},e.prototype.newSub=function(){return new e(-1,this.exclude)},e}(),Cs=function(){function e(){}return Object.defineProperty(e.prototype,"schemas",{get:function(){return[]},enumerable:!1,configurable:!0}),e.prototype.add=function(t){},e.prototype.merge=function(t){},e.prototype.include=function(t){return!0},e.prototype.newSub=function(){return this},e.instance=new e,e}(),He=function(){function e(){this.problems=[],this.propertiesMatches=0,this.propertiesValueMatches=0,this.primaryValueMatches=0,this.enumValueMatch=!1,this.enumValues=void 0}return e.prototype.hasProblems=function(){return!!this.problems.length},e.prototype.mergeAll=function(t){for(var r=0,n=t;r=e.offset&&t0?K={schema:we,validationResult:se,matchingSchemas:Be}:Ce===0&&(K.matchingSchemas.merge(Be),K.validationResult.mergeEnumValues(se))}}return ne.length>1&&$&&r.problems.push({location:{offset:i.offset,length:1},message:V("oneOfWarning","Matches multiple schemas when only one must validate.")}),K&&(r.merge(K.validationResult),r.propertiesMatches+=K.validationResult.propertiesMatches,r.propertiesValueMatches+=K.validationResult.propertiesValueMatches,n.merge(K.matchingSchemas)),ne.length};Array.isArray(t.anyOf)&&O(t.anyOf,!1),Array.isArray(t.oneOf)&&O(t.oneOf,!0);var q=function(L){var $=new He,ne=n.newSub();_e(i,Ae(L),$,ne),r.merge($),r.propertiesMatches+=$.propertiesMatches,r.propertiesValueMatches+=$.propertiesValueMatches,n.merge(ne)},D=function(L,$,ne){var K=Ae(L),Pe=new He,Me=n.newSub();_e(i,K,Pe,Me),n.merge(Me),Pe.hasProblems()?ne&&q(ne):$&&q($)},_=Ae(t.if);if(_&&D(_,Ae(t.then),Ae(t.else)),Array.isArray(t.enum)){for(var b=ut(i),v=!1,w=0,R=t.enum;w=_&&m.problems.push({location:{offset:a.offset,length:a.length},message:V("exclusiveMaximumWarning","Value is above the exclusive maximum of {0}.",_)});var b=q(c.minimum,c.exclusiveMinimum);$e(b)&&xv&&m.problems.push({location:{offset:a.offset,length:a.length},message:V("maximumWarning","Value is above the maximum of {0}.",v)})}function u(a,c,m,y){if($e(c.minLength)&&a.value.lengthc.maxLength&&m.problems.push({location:{offset:a.offset,length:a.length},message:V("maxLengthWarning","String is longer than the maximum length of {0}.",c.maxLength)}),yc(c.pattern)){var x=new RegExp(c.pattern);x.test(a.value)||m.problems.push({location:{offset:a.offset,length:a.length},message:c.patternErrorMessage||c.errorMessage||V("patternWarning",'String does not match the pattern of "{0}".',c.pattern)})}if(c.format)switch(c.format){case"uri":case"uri-reference":{var T=void 0;if(!a.value)T=V("uriEmpty","URI expected.");else{var C=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/.exec(a.value);C?!C[2]&&c.format==="uri"&&(T=V("uriSchemeMissing","URI with a scheme is expected.")):T=V("uriMissing","URI is expected.")}T&&m.problems.push({location:{offset:a.offset,length:a.length},message:c.patternErrorMessage||c.errorMessage||V("uriFormatWarning","String is not a URI: {0}",T)})}break;case"color-hex":case"date-time":case"date":case"time":case"email":var p=lg[c.format];(!a.value||!p.pattern.exec(a.value))&&m.problems.push({location:{offset:a.offset,length:a.length},message:c.patternErrorMessage||c.errorMessage||p.errorMessage});default:}}function l(a,c,m,y){if(Array.isArray(c.items)){for(var x=c.items,T=0;T=x.length&&m.propertiesValueMatches++}if(a.items.length>x.length)if(typeof c.additionalItems=="object")for(var O=x.length;Oc.maxItems&&m.problems.push({location:{offset:a.offset,length:a.length},message:V("maxItemsWarning","Array has too many items. Expected {0} or fewer.",c.maxItems)}),c.uniqueItems===!0){var w=ut(a),R=w.some(function(F,L){return L!==w.lastIndexOf(F)});R&&m.problems.push({location:{offset:a.offset,length:a.length},message:V("uniqueItemsWarning","Array has duplicate items.")})}}function f(a,c,m,y){for(var x=Object.create(null),T=[],C=0,p=a.properties;C=0;)T.splice(Qe,1),Qe=T.indexOf(Ze)};if(c.properties)for(var w=0,R=Object.keys(c.properties);w0)for(var Ce=0,me=T;Cec.maxProperties&&m.problems.push({location:{offset:a.offset,length:a.length},message:V("MaxPropWarning","Object has more properties than limit of {0}.",c.maxProperties)}),$e(c.minProperties)&&a.properties.length0){for(F--;F>0&&/\s/.test(i.charAt(F));)F--;L=F+1}if(f(_,b,F,L),v&&m(v,!1),w.length+R.length>0)for(var $=o.getToken();$!==17;){if(w.indexOf($)!==-1){u();break}else if(R.indexOf($)!==-1)break;$=u()}return v}function c(){switch(o.getTokenError()){case 4:return a(V("InvalidUnicode","Invalid unicode sequence in string."),X.InvalidUnicode),!0;case 5:return a(V("InvalidEscapeCharacter","Invalid escape character in string."),X.InvalidEscapeCharacter),!0;case 3:return a(V("UnexpectedEndOfNumber","Unexpected end of number."),X.UnexpectedEndOfNumber),!0;case 1:return a(V("UnexpectedEndOfComment","Unexpected end of comment."),X.UnexpectedEndOfComment),!0;case 2:return a(V("UnexpectedEndOfString","Unexpected end of string."),X.UnexpectedEndOfString),!0;case 6:return a(V("InvalidCharacter","Invalid characters in string. Control characters must be escaped."),X.InvalidCharacter),!0}return!1}function m(_,b){return _.length=o.getTokenOffset()+o.getTokenLength()-_.offset,b&&u(),_}function y(_){if(o.getToken()===3){var b=new dg(_,o.getTokenOffset());u();for(var v=0,w=!1;o.getToken()!==4&&o.getToken()!==17;){if(o.getToken()===5){w||a(V("ValueExpected","Value expected"),X.ValueExpected);var R=o.getTokenOffset();if(u(),o.getToken()===4){w&&f(V("TrailingComma","Trailing comma"),X.TrailingComma,R,R+1);continue}}else w&&a(V("ExpectedComma","Expected comma"),X.CommaExpected);var F=O(b);F?b.items.push(F):a(V("PropertyExpected","Value expected"),X.ValueExpected,void 0,[],[4,5]),w=!0}return o.getToken()!==4?a(V("ExpectedCloseBracket","Expected comma or closing bracket"),X.CommaOrCloseBacketExpected,b):m(b,!0)}}var x=new bs(void 0,0,0);function T(_,b){var v=new pg(_,o.getTokenOffset(),x),w=p(v);if(!w)if(o.getToken()===16){a(V("DoubleQuotesExpected","Property keys must be doublequoted"),X.Undefined);var R=new bs(v,o.getTokenOffset(),o.getTokenLength());R.value=o.getTokenValue(),w=R,u()}else return;v.keyNode=w;var F=b[w.value];if(F?(f(V("DuplicateKeyWarning","Duplicate object key"),X.DuplicateKey,v.keyNode.offset,v.keyNode.offset+v.keyNode.length,k.DiagnosticSeverity.Warning),typeof F=="object"&&f(V("DuplicateKeyWarning","Duplicate object key"),X.DuplicateKey,F.keyNode.offset,F.keyNode.offset+F.keyNode.length,k.DiagnosticSeverity.Warning),b[w.value]=!0):b[w.value]=v,o.getToken()===6)v.colonOffset=o.getTokenOffset(),u();else if(a(V("ColonExpected","Colon expected"),X.ColonExpected),o.getToken()===10&&e.positionAt(w.offset+w.length).line0?e.lastIndexOf(t)===r:r===0?e===t:!1}function Dc(e){return e.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}var Mc=Ke(Or()),xs=Mc.loadMessageBundle(),vg=[",","}","]"],yg=[":"],Ic=function(){function e(t,r,n,i){r===void 0&&(r=[]),n===void 0&&(n=Promise),i===void 0&&(i={}),this.schemaService=t,this.contributions=r,this.promiseConstructor=n,this.clientCapabilities=i}return e.prototype.doResolve=function(t){for(var r=this.contributions.length-1;r>=0;r--){var n=this.contributions[r].resolveCompletion;if(n){var i=n(t);if(i)return i}}return this.promiseConstructor.resolve(t)},e.prototype.doComplete=function(t,r,n){var i=this,o={items:[],isIncomplete:!1},s=t.getText(),u=t.offsetAt(r),l=n.getNodeFromOffset(u,!0);if(this.isInComment(t,l?l.offset:0,u))return Promise.resolve(o);if(l&&u===l.offset+l.length&&u>0){var f=s[u-1];(l.type==="object"&&f==="}"||l.type==="array"&&f==="]")&&(l=l.parent)}var a=this.getCurrentWord(t,u),c;if(l&&(l.type==="string"||l.type==="number"||l.type==="boolean"||l.type==="null"))c=k.Range.create(t.positionAt(l.offset),t.positionAt(l.offset+l.length));else{var m=u-a.length;m>0&&s[m-1]==='"'&&m--,c=k.Range.create(t.positionAt(m),r)}var y=!1,x={},T={add:function(C){var p=C.label,h=x[p];if(h)h.documentation||(h.documentation=C.documentation),h.detail||(h.detail=C.detail);else{if(p=p.replace(/[\n]/g,"\u21B5"),p.length>60){var g=p.substr(0,57).trim()+"...";x[g]||(p=g)}c&&C.insertText!==void 0&&(C.textEdit=k.TextEdit.replace(c,C.insertText)),y&&(C.commitCharacters=C.kind===k.CompletionItemKind.Property?yg:vg),C.label=p,x[p]=C,o.items.push(C)}},setAsIncomplete:function(){o.isIncomplete=!0},error:function(C){console.error(C)},log:function(C){console.log(C)},getNumberOfProposals:function(){return o.items.length}};return this.schemaService.getSchemaForResource(t.uri,n).then(function(C){var p=[],h=!0,g="",O=void 0;if(l&&l.type==="string"){var q=l.parent;q&&q.type==="property"&&q.keyNode===l&&(h=!q.valueNode,O=q,g=s.substr(l.offset+1,l.length-2),q&&(l=q.parent))}if(l&&l.type==="object"){if(l.offset===u)return o;var D=l.properties;D.forEach(function(w){(!O||O!==w)&&(x[w.keyNode.value]=k.CompletionItem.create("__"))});var _="";h&&(_=i.evaluateSeparatorAfter(t,t.offsetAt(c.end))),C?i.getPropertyCompletions(C,n,l,h,_,T):i.getSchemaLessPropertyCompletions(n,l,g,T);var b=sn(l);i.contributions.forEach(function(w){var R=w.collectPropertyCompletions(t.uri,b,a,h,_==="",T);R&&p.push(R)}),!C&&a.length>0&&s.charAt(u-a.length-1)!=='"'&&(T.add({kind:k.CompletionItemKind.Property,label:i.getLabelForValue(a),insertText:i.getInsertTextForProperty(a,void 0,!1,_),insertTextFormat:k.InsertTextFormat.Snippet,documentation:""}),T.setAsIncomplete())}var v={};return C?i.getValueCompletions(C,n,l,u,t,T,v):i.getSchemaLessValueCompletions(n,l,u,t,T),i.contributions.length>0&&i.getContributedValueCompletions(n,l,u,t,T,p),i.promiseConstructor.all(p).then(function(){if(T.getNumberOfProposals()===0){var w=u;l&&(l.type==="string"||l.type==="number"||l.type==="boolean"||l.type==="null")&&(w=l.offset+l.length);var R=i.evaluateSeparatorAfter(t,w);i.addFillerValueCompletions(v,R,T)}return o})})},e.prototype.getPropertyCompletions=function(t,r,n,i,o,s){var u=this,l=r.getMatchingSchemas(t.schema,n.offset);l.forEach(function(f){if(f.node===n&&!f.inverted){var a=f.schema.properties;a&&Object.keys(a).forEach(function(T){var C=a[T];if(typeof C=="object"&&!C.deprecationMessage&&!C.doNotSuggest){var p={kind:k.CompletionItemKind.Property,label:T,insertText:u.getInsertTextForProperty(T,C,i,o),insertTextFormat:k.InsertTextFormat.Snippet,filterText:u.getFilterTextForValue(T),documentation:u.fromMarkup(C.markdownDescription)||C.description||""};C.suggestSortText!==void 0&&(p.sortText=C.suggestSortText),p.insertText&&jt(p.insertText,"$1"+o)&&(p.command={title:"Suggest",command:"editor.action.triggerSuggest"}),s.add(p)}});var c=f.schema.propertyNames;if(typeof c=="object"&&!c.deprecationMessage&&!c.doNotSuggest){var m=function(T,C){C===void 0&&(C=void 0);var p={kind:k.CompletionItemKind.Property,label:T,insertText:u.getInsertTextForProperty(T,void 0,i,o),insertTextFormat:k.InsertTextFormat.Snippet,filterText:u.getFilterTextForValue(T),documentation:C||u.fromMarkup(c.markdownDescription)||c.description||""};c.suggestSortText!==void 0&&(p.sortText=c.suggestSortText),p.insertText&&jt(p.insertText,"$1"+o)&&(p.command={title:"Suggest",command:"editor.action.triggerSuggest"}),s.add(p)};if(c.enum)for(var y=0;y(r.colonOffset||0)){var a=r.valueNode;if(a&&(n>a.offset+a.length||a.type==="object"||a.type==="array"))return;var c=r.keyNode.value;t.visit(function(y){return y.type==="property"&&y.keyNode.value===c&&y.valueNode&&f(y.valueNode),!0}),c==="$schema"&&r.parent&&!r.parent.parent&&this.addDollarSchemaCompletions(l,o)}if(r.type==="array")if(r.parent&&r.parent.type==="property"){var m=r.parent.keyNode.value;t.visit(function(y){return y.type==="property"&&y.keyNode.value===m&&y.valueNode&&y.valueNode.type==="array"&&y.valueNode.items.forEach(f),!0})}else r.items.forEach(f)},e.prototype.getValueCompletions=function(t,r,n,i,o,s,u){var l=i,f=void 0,a=void 0;if(n&&(n.type==="string"||n.type==="number"||n.type==="boolean"||n.type==="null")&&(l=n.offset+n.length,a=n,n=n.parent),!n){this.addSchemaValueCompletions(t.schema,"",s,u);return}if(n.type==="property"&&i>(n.colonOffset||0)){var c=n.valueNode;if(c&&i>c.offset+c.length)return;f=n.keyNode.value,n=n.parent}if(n&&(f!==void 0||n.type==="array")){for(var m=this.evaluateSeparatorAfter(o,l),y=r.getMatchingSchemas(t.schema,n.offset,a),x=0,T=y;x(r.colonOffset||0)){var u=r.keyNode.value,l=r.valueNode;if((!l||n<=l.offset+l.length)&&r.parent){var f=sn(r.parent);this.contributions.forEach(function(a){var c=a.collectValueCompletions(i.uri,f,u,o);c&&s.push(c)})}}},e.prototype.addSchemaValueCompletions=function(t,r,n,i){var o=this;typeof t=="object"&&(this.addEnumValueCompletions(t,r,n),this.addDefaultValueCompletions(t,r,n),this.collectTypes(t,i),Array.isArray(t.allOf)&&t.allOf.forEach(function(s){return o.addSchemaValueCompletions(s,r,n,i)}),Array.isArray(t.anyOf)&&t.anyOf.forEach(function(s){return o.addSchemaValueCompletions(s,r,n,i)}),Array.isArray(t.oneOf)&&t.oneOf.forEach(function(s){return o.addSchemaValueCompletions(s,r,n,i)}))},e.prototype.addDefaultValueCompletions=function(t,r,n,i){var o=this;i===void 0&&(i=0);var s=!1;if(st(t.default)){for(var u=t.type,l=t.default,f=i;f>0;f--)l=[l],u="array";n.add({kind:this.getSuggestionKind(u),label:this.getLabelForValue(l),insertText:this.getInsertTextForValue(l,r),insertTextFormat:k.InsertTextFormat.Snippet,detail:xs("json.suggest.default","Default value")}),s=!0}Array.isArray(t.examples)&&t.examples.forEach(function(a){for(var c=t.type,m=a,y=i;y>0;y--)m=[m],c="array";n.add({kind:o.getSuggestionKind(c),label:o.getLabelForValue(m),insertText:o.getInsertTextForValue(m,r),insertTextFormat:k.InsertTextFormat.Snippet}),s=!0}),Array.isArray(t.defaultSnippets)&&t.defaultSnippets.forEach(function(a){var c=t.type,m=a.body,y=a.label,x,T;if(st(m)){for(var C=t.type,p=i;p>0;p--)m=[m],C="array";x=o.getInsertTextForSnippetValue(m,r),T=o.getFilterTextForSnippetValue(m),y=y||o.getLabelForSnippetValue(m)}else if(typeof a.bodyText=="string"){for(var h="",g="",O="",p=i;p>0;p--)h=h+O+`[ +`,g=g+` +`+O+"]",O+=" ",c="array";x=h+O+a.bodyText.split(` +`).join(` +`+O)+g+r,y=y||x,T=x.replace(/[\n]/g,"")}else return;n.add({kind:o.getSuggestionKind(c),label:y,documentation:o.fromMarkup(a.markdownDescription)||a.description,insertText:x,insertTextFormat:k.InsertTextFormat.Snippet,filterText:T}),s=!0}),!s&&typeof t.items=="object"&&!Array.isArray(t.items)&&i<5&&this.addDefaultValueCompletions(t.items,r,n,i+1)},e.prototype.addEnumValueCompletions=function(t,r,n){if(st(t.const)&&n.add({kind:this.getSuggestionKind(t.type),label:this.getLabelForValue(t.const),insertText:this.getInsertTextForValue(t.const,r),insertTextFormat:k.InsertTextFormat.Snippet,documentation:this.fromMarkup(t.markdownDescription)||t.description}),Array.isArray(t.enum))for(var i=0,o=t.enum.length;i0?r[0]:void 0}if(!t)return k.CompletionItemKind.Value;switch(t){case"string":return k.CompletionItemKind.Value;case"object":return k.CompletionItemKind.Module;case"property":return k.CompletionItemKind.Property;default:return k.CompletionItemKind.Value}},e.prototype.getLabelTextForMatchingNode=function(t,r){switch(t.type){case"array":return"[]";case"object":return"{}";default:var n=r.getText().substr(t.offset,t.length);return n}},e.prototype.getInsertTextForMatchingNode=function(t,r,n){switch(t.type){case"array":return this.getInsertTextForValue([],n);case"object":return this.getInsertTextForValue({},n);default:var i=r.getText().substr(t.offset,t.length)+n;return this.getInsertTextForPlainText(i)}},e.prototype.getInsertTextForProperty=function(t,r,n,i){var o=this.getInsertTextForValue(t,"");if(!n)return o;var s=o+": ",u,l=0;if(r){if(Array.isArray(r.defaultSnippets)){if(r.defaultSnippets.length===1){var f=r.defaultSnippets[0].body;st(f)&&(u=this.getInsertTextForSnippetValue(f,""))}l+=r.defaultSnippets.length}if(r.enum&&(!u&&r.enum.length===1&&(u=this.getInsertTextForGuessedValue(r.enum[0],"")),l+=r.enum.length),st(r.default)&&(u||(u=this.getInsertTextForGuessedValue(r.default,"")),l++),Array.isArray(r.examples)&&r.examples.length&&(u||(u=this.getInsertTextForGuessedValue(r.examples[0],"")),l+=r.examples.length),l===0){var a=Array.isArray(r.type)?r.type[0]:r.type;switch(a||(r.properties?a="object":r.items&&(a="array")),a){case"boolean":u="$1";break;case"string":u='"$1"';break;case"object":u="{$1}";break;case"array":u="[$1]";break;case"number":case"integer":u="${1:0}";break;case"null":u="${1:null}";break;default:return o}}}return(!u||l>1)&&(u="$1"),s+u+i},e.prototype.getCurrentWord=function(t,r){for(var n=r-1,i=t.getText();n>=0&&` +\r\v":{[,]}`.indexOf(i.charAt(n))===-1;)n--;return i.substring(n+1,r)},e.prototype.evaluateSeparatorAfter=function(t,r){var n=ht(t.getText(),!0);n.setPosition(r);var i=n.scan();switch(i){case 5:case 2:case 4:case 17:return"";default:return","}},e.prototype.findItemAtOffset=function(t,r,n){for(var i=ht(r.getText(),!0),o=t.items,s=o.length-1;s>=0;s--){var u=o[s];if(n>u.offset+u.length){i.setPosition(u.offset+u.length);var l=i.scan();return l===5&&n>=i.getTokenOffset()+i.getTokenLength()?s+1:s}else if(n>=u.offset)return s}return 0},e.prototype.isInComment=function(t,r,n){var i=ht(t.getText(),!1);i.setPosition(r);for(var o=i.scan();o!==17&&i.getTokenOffset()+i.getTokenLength()o.offset+1&&i=0;c--){var m=this.contributions[c],y=m.getInfoContribution(t.uri,a);if(y)return y.then(function(x){return f(x)})}return this.schemaService.getSchemaForResource(t.uri,n).then(function(x){if(x&&o){var T=n.getMatchingSchemas(x.schema,o.offset),C=void 0,p=void 0,h=void 0,g=void 0;T.every(function(q){if(q.node===o&&!q.inverted&&q.schema&&(C=C||q.schema.title,p=p||q.schema.markdownDescription||Ss(q.schema.description),q.schema.enum)){var D=q.schema.enum.indexOf(ut(o));q.schema.markdownEnumDescriptions?h=q.schema.markdownEnumDescriptions[D]:q.schema.enumDescriptions&&(h=Ss(q.schema.enumDescriptions[D])),h&&(g=q.schema.enum[D],typeof g!="string"&&(g=JSON.stringify(g)))}return!0});var O="";return C&&(O=Ss(C)),p&&(O.length>0&&(O+=` + +`),O+=p),h&&(O.length>0&&(O+=` + +`),O+="`"+bg(g)+"`: "+h),f([O])}return null})},e}();function Ss(e){if(e){var t=e.replace(/([^\n\r])(\r?\n)([^\n\r])/gm,`$1 + +$3`);return t.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function bg(e){return e.indexOf("`")!==-1?"`` "+e+" ``":e}"use strict";var wg=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),pe,an;typeof process=="object"?an=process.platform==="win32":typeof navigator=="object"&&(Wc=navigator.userAgent,an=Wc.indexOf("Windows")>=0);var Wc;var Cg=/^\w[\w\d+.-]*$/,xg=/^\//,Sg=/^\/\//;function Tg(e,t){if(!e.scheme&&t)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'+e.authority+'", path: "'+e.path+'", query: "'+e.query+'", fragment: "'+e.fragment+'"}');if(e.scheme&&!Cg.test(e.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(e.path){if(e.authority){if(!xg.test(e.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(Sg.test(e.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function kg(e,t){return!e&&!t?"file":e}function _g(e,t){switch(e){case"https":case"http":case"file":t?t[0]!==ct&&(t=ct+t):t=ct;break}return t}var oe="",ct="/",Pg=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,lt=function(){function e(t,r,n,i,o,s){s===void 0&&(s=!1),typeof t=="object"?(this.scheme=t.scheme||oe,this.authority=t.authority||oe,this.path=t.path||oe,this.query=t.query||oe,this.fragment=t.fragment||oe):(this.scheme=kg(t,s),this.authority=r||oe,this.path=_g(this.scheme,n||oe),this.query=i||oe,this.fragment=o||oe,Tg(this,s))}return e.isUri=function(t){return t instanceof e?!0:t?typeof t.authority=="string"&&typeof t.fragment=="string"&&typeof t.path=="string"&&typeof t.query=="string"&&typeof t.scheme=="string"&&typeof t.fsPath=="function"&&typeof t.with=="function"&&typeof t.toString=="function":!1},Object.defineProperty(e.prototype,"fsPath",{get:function(){return Vc(this,!1)},enumerable:!0,configurable:!0}),e.prototype.with=function(t){if(!t)return this;var r=t.scheme,n=t.authority,i=t.path,o=t.query,s=t.fragment;return r===void 0?r=this.scheme:r===null&&(r=oe),n===void 0?n=this.authority:n===null&&(n=oe),i===void 0?i=this.path:i===null&&(i=oe),o===void 0?o=this.query:o===null&&(o=oe),s===void 0?s=this.fragment:s===null&&(s=oe),r===this.scheme&&n===this.authority&&i===this.path&&o===this.query&&s===this.fragment?this:new Nr(r,n,i,o,s)},e.parse=function(t,r){r===void 0&&(r=!1);var n=Pg.exec(t);return n?new Nr(n[2]||oe,Kn(n[4]||oe),Kn(n[5]||oe),Kn(n[7]||oe),Kn(n[9]||oe),r):new Nr(oe,oe,oe,oe,oe)},e.file=function(t){var r=oe;if(an&&(t=t.replace(/\\/g,ct)),t[0]===ct&&t[1]===ct){var n=t.indexOf(ct,2);n===-1?(r=t.substring(2),t=ct):(r=t.substring(2,n),t=t.substring(n)||ct)}return new Nr("file",r,t,oe,oe)},e.from=function(t){return new Nr(t.scheme,t.authority,t.path,t.query,t.fragment)},e.prototype.toString=function(t){return t===void 0&&(t=!1),Ts(this,t)},e.prototype.toJSON=function(){return this},e.revive=function(t){if(t){if(t instanceof e)return t;var r=new Nr(t);return r._formatted=t.external,r._fsPath=t._sep===$c?t.fsPath:null,r}else return t},e}();var $c=an?1:void 0,Nr=function(e){wg(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r._formatted=null,r._fsPath=null,r}return Object.defineProperty(t.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=Vc(this,!1)),this._fsPath},enumerable:!0,configurable:!0}),t.prototype.toString=function(r){return r===void 0&&(r=!1),r?Ts(this,!0):(this._formatted||(this._formatted=Ts(this,!1)),this._formatted)},t.prototype.toJSON=function(){var r={$mid:1};return this._fsPath&&(r.fsPath=this._fsPath,r._sep=$c),this._formatted&&(r.external=this._formatted),this.path&&(r.path=this.path),this.scheme&&(r.scheme=this.scheme),this.authority&&(r.authority=this.authority),this.query&&(r.query=this.query),this.fragment&&(r.fragment=this.fragment),r},t}(lt),Hc=(pe={},pe[58]="%3A",pe[47]="%2F",pe[63]="%3F",pe[35]="%23",pe[91]="%5B",pe[93]="%5D",pe[64]="%40",pe[33]="%21",pe[36]="%24",pe[38]="%26",pe[39]="%27",pe[40]="%28",pe[41]="%29",pe[42]="%2A",pe[43]="%2B",pe[44]="%2C",pe[59]="%3B",pe[61]="%3D",pe[32]="%20",pe);function zc(e,t){for(var r=void 0,n=-1,i=0;i=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||o===45||o===46||o===95||o===126||t&&o===47)n!==-1&&(r+=encodeURIComponent(e.substring(n,i)),n=-1),r!==void 0&&(r+=e.charAt(i));else{r===void 0&&(r=e.substr(0,i));var s=Hc[o];s!==void 0?(n!==-1&&(r+=encodeURIComponent(e.substring(n,i)),n=-1),r+=s):n===-1&&(n=i)}}return n!==-1&&(r+=encodeURIComponent(e.substring(n))),r!==void 0?r:e}function Rg(e){for(var t=void 0,r=0;r1&&e.scheme==="file"?r="//"+e.authority+e.path:e.path.charCodeAt(0)===47&&(e.path.charCodeAt(1)>=65&&e.path.charCodeAt(1)<=90||e.path.charCodeAt(1)>=97&&e.path.charCodeAt(1)<=122)&&e.path.charCodeAt(2)===58?t?r=e.path.substr(1):r=e.path[1].toLowerCase()+e.path.substr(2):r=e.path,an&&(r=r.replace(/\//g,"\\")),r}function Ts(e,t){var r=t?Rg:zc,n="",i=e.scheme,o=e.authority,s=e.path,u=e.query,l=e.fragment;if(i&&(n+=i,n+=":"),(o||i==="file")&&(n+=ct,n+=ct),o){var f=o.indexOf("@");if(f!==-1){var a=o.substr(0,f);o=o.substr(f+1),f=a.indexOf(":"),f===-1?n+=r(a,!1):(n+=r(a.substr(0,f),!1),n+=":",n+=r(a.substr(f+1),!1)),n+="@"}o=o.toLowerCase(),f=o.indexOf(":"),f===-1?n+=r(o,!1):(n+=r(o.substr(0,f),!1),n+=o.substr(f))}if(s){if(s.length>=3&&s.charCodeAt(0)===47&&s.charCodeAt(2)===58){var c=s.charCodeAt(1);c>=65&&c<=90&&(s="/"+String.fromCharCode(c+32)+":"+s.substr(3))}else if(s.length>=2&&s.charCodeAt(1)===58){var c=s.charCodeAt(0);c>=65&&c<=90&&(s=String.fromCharCode(c+32)+":"+s.substr(2))}n+=r(s,!0)}return u&&(n+="?",n+=r(u,!1)),l&&(n+="#",n+=t?l:zc(l,!1)),n}function Bc(e){try{return decodeURIComponent(e)}catch(t){return e.length>3?e.substr(0,3)+Bc(e.substr(3)):e}}var Jc=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Kn(e){return e.match(Jc)?e.replace(Jc,function(t){return Bc(t)}):e}var Uc=Ke(Or()),Dt=Uc.loadMessageBundle(),Eg=function(){function e(t,r){this.patternRegExps=[],this.isInclude=[];try{for(var n=0,i=t;n0;)this.callOnDispose.pop()()},e.prototype.onResourceChange=function(t){var r=this,n=!1;t=It(t);for(var i=[t],o=Object.keys(this.schemasById).map(function(f){return r.schemasById[f]});i.length;)for(var s=i.pop(),u=0;u1&&(i=o[1]),jt(i,".")&&(i=i.substr(0,i.length-1)),new Mt({},[Dt("json.schema.nocontent","Unable to load schema from '{0}': {1}.",ei(t),i)])})},e.prototype.resolveSchemaContent=function(t,r,n){var i=this,o=t.errors.slice(0),s=t.schema;if(s.$schema){var u=It(s.$schema);if(u==="http://json-schema.org/draft-03/schema")return this.promise.resolve(new Gc({},[Dt("json.schema.draft03.notsupported","Draft-03 schemas are not supported.")]));u==="https://json-schema.org/draft/2019-09/schema"&&o.push(Dt("json.schema.draft201909.notsupported","Draft 2019-09 schemas are not yet fully supported."))}var l=this.contextService,f=function(y,x){if(!x)return y;var T=y;return x[0]==="/"&&(x=x.substr(1)),x.split("/").some(function(C){return T=T[C],!T}),T},a=function(y,x,T,C){var p=C?decodeURIComponent(C):void 0,h=f(x,p);if(h)for(var g in h)h.hasOwnProperty(g)&&!y.hasOwnProperty(g)&&(y[g]=h[g]);else o.push(Dt("json.schema.invalidref","$ref '{0}' in '{1}' can not be resolved.",p,T))},c=function(y,x,T,C,p){l&&!/^\w+:\/\/.*/.test(x)&&(x=l.resolveRelativePath(x,C)),x=It(x);var h=i.getOrAddSchemaHandle(x);return h.getUnresolvedSchema().then(function(g){if(p[x]=!0,g.errors.length){var O=T?x+"#"+T:x;o.push(Dt("json.schema.problemloadingref","Problems loading reference '{0}': {1}",O,g.errors[0]))}return delete y.$ref,a(y,g.schema,x,T),m(y,g.schema,x,h.dependencies)})},m=function(y,x,T,C){if(!y||typeof y!="object")return Promise.resolve(null);for(var p=[y],h=[],g=[],O=function(){for(var v=[],w=0;w0){g.push(c(v,F[0],F[1],T,C));return}else delete v.$ref,w.indexOf(R)===-1&&(a(v,x,T,F[1]),w.push(R))}O(v.items,v.additionalItems,v.additionalProperties,v.not,v.contains,v.propertyNames,v.if,v.then,v.else),q(v.definitions,v.properties,v.patternProperties,v.dependencies),D(v.anyOf,v.allOf,v.oneOf,v.items)};p.length;){var b=p.pop();h.indexOf(b)>=0||(h.push(b),_(b))}return i.promise.all(g)};return m(s,s,r,n).then(function(y){return new Gc(s,o)})},e.prototype.getSchemaForResource=function(t,r){if(r&&r.root&&r.root.type==="object"){var n=r.root.properties.filter(function(p){return p.keyNode.value==="$schema"&&p.valueNode&&p.valueNode.type==="string"});if(n.length>0){var i=n[0].valueNode;if(i&&i.type==="string"){var o=ut(i);if(o&&jc(o,".")&&this.contextService&&(o=this.contextService.resolveRelativePath(o,t)),o){var s=It(o);return this.getOrAddSchemaHandle(s).getResolvedSchema()}}}}if(this.cachedSchemaForResource&&this.cachedSchemaForResource.resource===t)return this.cachedSchemaForResource.resolvedSchema;for(var u=Object.create(null),l=[],f=Fg(t),a=0,c=this.filePatternAssociations;a0?this.createCombinedSchema(t,l).getResolvedSchema():this.promise.resolve(void 0);return this.cachedSchemaForResource={resource:t,resolvedSchema:C},C},e.prototype.createCombinedSchema=function(t,r){if(r.length===1)return this.getOrAddSchemaHandle(r[0]);var n="schemaservice://combinedSchema/"+encodeURIComponent(t),i={allOf:r.map(function(o){return{$ref:o}})};return this.addSchemaHandle(n,i)},e.prototype.getMatchingSchemas=function(t,r,n){if(n){var i=n.id||"schemaservice://untitled/matchingSchemas/"+Ng++;return this.resolveSchemaContent(new Mt(n),i,{}).then(function(o){return r.getMatchingSchemas(o.schema).filter(function(s){return!s.inverted})})}return this.getSchemaForResource(t.uri,r).then(function(o){return o?r.getMatchingSchemas(o.schema).filter(function(s){return!s.inverted}):[]})},e}();var Ng=0;function It(e){try{return lt.parse(e).toString()}catch(t){return e}}function Fg(e){try{return lt.parse(e).with({fragment:null,query:null}).toString()}catch(t){return e}}function ei(e){try{var t=lt.parse(e);if(t.scheme==="file")return t.fsPath}catch(r){}return e}var Yc=Ke(Or());var qg=Yc.loadMessageBundle(),Kc=function(){function e(t,r){this.jsonSchemaService=t,this.promise=r,this.validationEnabled=!0}return e.prototype.configure=function(t){t&&(this.validationEnabled=t.validate!==!1,this.commentSeverity=t.allowComments?void 0:k.DiagnosticSeverity.Error)},e.prototype.doValidation=function(t,r,n,i){var o=this;if(!this.validationEnabled)return this.promise.resolve([]);var s=[],u={},l=function(c){var m=c.range.start.line+" "+c.range.start.character+" "+c.message;u[m]||(u[m]=!0,s.push(c))},f=function(c){var m=n?ti(n.trailingCommas):k.DiagnosticSeverity.Error,y=n?ti(n.comments):o.commentSeverity,x=(n==null?void 0:n.schemaValidation)?ti(n.schemaValidation):k.DiagnosticSeverity.Warning,T=(n==null?void 0:n.schemaRequest)?ti(n.schemaRequest):k.DiagnosticSeverity.Warning;if(c){if(c.errors.length&&r.root&&T){var C=r.root,p=C.type==="object"?C.properties[0]:void 0;if(p&&p.keyNode.value==="$schema"){var h=p.valueNode||p,g=k.Range.create(t.positionAt(h.offset),t.positionAt(h.offset+h.length));l(k.Diagnostic.create(g,c.errors[0],T,X.SchemaResolveError))}else{var g=k.Range.create(t.positionAt(C.offset),t.positionAt(C.offset+1));l(k.Diagnostic.create(g,c.errors[0],T,X.SchemaResolveError))}}else if(x){var O=r.validate(t,c.schema,x);O&&O.forEach(l)}Zc(c.schema)&&(y=void 0),Qc(c.schema)&&(m=void 0)}for(var q=0,D=r.syntaxErrors;q=ri&&e<=Mg?e-ri+10:0)}function tl(e){if(e[0]==="#")switch(e.length){case 4:return{red:ge(e.charCodeAt(1))*17/255,green:ge(e.charCodeAt(2))*17/255,blue:ge(e.charCodeAt(3))*17/255,alpha:1};case 5:return{red:ge(e.charCodeAt(1))*17/255,green:ge(e.charCodeAt(2))*17/255,blue:ge(e.charCodeAt(3))*17/255,alpha:ge(e.charCodeAt(4))*17/255};case 7:return{red:(ge(e.charCodeAt(1))*16+ge(e.charCodeAt(2)))/255,green:(ge(e.charCodeAt(3))*16+ge(e.charCodeAt(4)))/255,blue:(ge(e.charCodeAt(5))*16+ge(e.charCodeAt(6)))/255,alpha:1};case 9:return{red:(ge(e.charCodeAt(1))*16+ge(e.charCodeAt(2)))/255,green:(ge(e.charCodeAt(3))*16+ge(e.charCodeAt(4)))/255,blue:(ge(e.charCodeAt(5))*16+ge(e.charCodeAt(6)))/255,alpha:(ge(e.charCodeAt(7))*16+ge(e.charCodeAt(8)))/255}}}var rl=function(){function e(t){this.schemaService=t}return e.prototype.findDocumentSymbols=function(t,r,n){var i=this;n===void 0&&(n={resultLimit:Number.MAX_VALUE});var o=r.root;if(!o)return[];var s=n.resultLimit||Number.MAX_VALUE,u=t.uri;if((u==="vscode://defaultsettings/keybindings.json"||jt(u.toLowerCase(),"/user/keybindings.json"))&&o.type==="array"){for(var l=[],f=0,a=o.items;f0){s--;var w=k.Location.create(t.uri,Lt(t,b)),R=_?_+"."+b.keyNode.value:b.keyNode.value;g.push({name:i.getKeyLabel(b),kind:i.getSymbolKind(v.type),location:w,containerName:_}),C.push({node:v,containerName:R})}else h=!0})};p0){s--;var R=Lt(t,v),F=R,L=String(w),$={name:L,kind:i.getSymbolKind(v.type),range:R,selectionRange:F,children:[]};b.push($),h.push({result:$.children,node:v})}else O=!0}):_.type==="object"&&_.properties.forEach(function(v){var w=v.valueNode;if(w)if(s>0){s--;var R=Lt(t,v),F=Lt(t,v.keyNode),L=[],$={name:i.getKeyLabel(v),kind:i.getSymbolKind(w.type),range:R,selectionRange:F,children:L,detail:i.getDetail(w)};b.push($),h.push({result:L,node:w})}else O=!0})};g0&&i[i.length-1].kind===c){var a=i.pop(),m=e.positionAt(s.getTokenOffset()).line;a&&m>a.startLine+1&&o!==a.startLine&&(a.endLine=m-1,l(a),o=a.startLine)}break}case 13:{var f=e.positionAt(s.getTokenOffset()).line,y=e.positionAt(s.getTokenOffset()+s.getTokenLength()).line;s.getTokenError()===1&&f+1=0&&i[C].kind!==k.FoldingRangeKind.Region;)C--;if(C>=0){var a=i[C];i.length=C,m>a.startLine&&o!==a.startLine&&(a.endLine=m,l(a),o=a.startLine)}}}break}}u=s.scan()}var p=t&&t.rangeLimit;if(typeof p!="number"||r.length<=p)return r;t&&t.onRangeLimitExceeded&&t.onRangeLimitExceeded(e.uri);for(var h=[],g=0,O=n;gp){_=C;break}D+=b}}for(var v=[],C=0;C=c&&l<=m&&a.push(i(c,m)),a.push(i(f.offset,f.offset+f.length));break;case"number":case"boolean":case"null":case"property":a.push(i(f.offset,f.offset+f.length));break}if(f.type==="property"||f.parent&&f.parent.type==="array"){var y=s(f.offset+f.length,5);y!==-1&&a.push(i(f.offset,y))}f=f.parent}for(var x=void 0,T=a.length-1;T>=0;T--)x=k.SelectionRange.create(a[T],x);return x||(x=k.SelectionRange.create(k.Range.create(u,u))),x}function i(u,l){return k.Range.create(e.positionAt(u),e.positionAt(l))}var o=ht(e.getText(),!0);function s(u,l){o.setPosition(u);var f=o.scan();return f===l?o.getTokenOffset()+o.getTokenLength():-1}return t.map(n)}function sl(e,t){var r=[];return t.visit(function(n){var i;if(n.type==="property"&&n.keyNode.value==="$ref"&&((i=n.valueNode)===null||i===void 0?void 0:i.type)==="string"){var o=n.valueNode.value,s=$g(t,o);if(s){var u=e.positionAt(s.offset);r.push({target:e.uri+"#"+(u.line+1)+","+(u.character+1),range:Wg(e,n.valueNode)})}}return!0}),Promise.resolve(r)}function Wg(e,t){return k.Range.create(e.positionAt(t.offset+1),e.positionAt(t.offset+t.length-1))}function $g(e,t){var r=Vg(t);return r?_s(r,e.root):null}function _s(e,t){if(!t)return null;if(e.length===0)return t;var r=e.shift();if(t&&t.type==="object"){var n=t.properties.find(function(s){return s.keyNode.value===r});return n?_s(e,n.valueNode):null}else if(t&&t.type==="array"&&r.match(/^(0|[1-9][0-9]*)$/)){var i=Number.parseInt(r),o=t.items[i];return o?_s(e,o):null}return null}function Vg(e){return e==="#"?[]:e[0]!=="#"||e[1]!=="/"?null:e.substring(2).split(/\//).map(Hg)}function Hg(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ps(e){var t=e.promiseConstructor||Promise,r=new Xc(e.schemaRequestService,e.workspaceContext,t);r.setSchemaContributions(ni);var n=new Ic(r,e.contributions,t,e.clientCapabilities),i=new Lc(r,e.contributions,t),o=new rl(r),s=new Kc(r,t);return{configure:function(u){r.clearExternalSchemas(),u.schemas&&u.schemas.forEach(function(l){r.registerExternalSchema(l.uri,l.fileMatch,l.schema)}),s.configure(u)},resetSchema:function(u){return r.onResourceChange(u)},doValidation:s.doValidation.bind(s),parseJSONDocument:function(u){return Ac(u,{collectComments:!0})},newJSONDocument:function(u,l){return qc(u,l)},getMatchingSchemas:r.getMatchingSchemas.bind(r),doResolve:n.doResolve.bind(n),doComplete:n.doComplete.bind(n),findDocumentSymbols:o.findDocumentSymbols.bind(o),findDocumentSymbols2:o.findDocumentSymbols2.bind(o),findColorSymbols:function(u,l){return o.findDocumentColors(u,l).then(function(f){return f.map(function(a){return a.range})})},findDocumentColors:o.findDocumentColors.bind(o),getColorPresentations:o.getColorPresentations.bind(o),doHover:i.doHover.bind(i),getFoldingRanges:il,getSelectionRanges:ol,findDefinition:function(){return Promise.resolve([])},findLinks:sl,format:function(u,l,f){var a=void 0;if(l){var c=u.offsetAt(l.start),m=u.offsetAt(l.end)-c;a={offset:c,length:m}}var y={tabSize:f?f.tabSize:4,insertSpaces:(f==null?void 0:f.insertSpaces)===!0,insertFinalNewline:(f==null?void 0:f.insertFinalNewline)===!0,eol:` +`};return vc(u.getText(),a,y).map(function(x){return k.TextEdit.replace(k.Range.create(u.positionAt(x.offset),u.positionAt(x.offset+x.length)),x.content)})}}}function al(e,t,r){let n={},i=0,o;return t>0&&(o=setInterval(()=>{let s=Date.now()-t*1e3,u=Object.keys(n);for(let l of u)n[l].cTime1&&e[e.length-1].length===0&&t.push("");let r=t.join("/");return e[0].length===0&&(r="/"+r),r}function Jg(e,...t){let r=lt.parse(e),n=r.path.split("/");for(let i of t)n.push(...i.split("/"));return r.with({path:cl(n)}).toString()}var Es;(function(t){t.type=new je.NotificationType("json/schemaAssociations")})(Es||(Es={}));var Os;(function(t){t.type=new je.RequestType("vscode/content")})(Os||(Os={}));var Ns;(function(t){t.type=new je.NotificationType("json/schemaContent")})(Ns||(Ns={}));var Fs;(function(t){t.type=new je.NotificationType("json/resultLimitReached")})(Fs||(Fs={}));var qs;(function(t){t.type=new je.RequestType("json/validate")})(qs||(qs={}));var fl={resolveRelativePath:(e,t)=>{let r=t.substr(0,t.lastIndexOf("/")+1);return ll(r,e)}};function dl(e,t){function r(b=["https","http","file"]){let v={};for(let w of b)w==="file"?v[w]=t.file:(w==="http"||w==="https")&&(v[w]=t.http);return w=>{let R=w.substr(0,w.indexOf(":")),F=v[R];return F?F.getContent(w):e.sendRequest(Os.type,w).then(L=>L,L=>Promise.reject(L.message))}}let n=Ps({workspaceContext:fl,contributions:[],clientCapabilities:Yn.LATEST}),i=new je.TextDocuments(Rr);i.listen(e);let o=!1,s=!1,u=!1,l=Number.MAX_VALUE,f=Number.MAX_VALUE,a=Number.MAX_VALUE,c=Number.MAX_VALUE;e.onInitialize(b=>{var F,L,$,ne,K;let v=(F=b.initializationOptions)==null?void 0:F.handledSchemaProtocols;n=Ps({schemaRequestService:r(v),workspaceContext:fl,contributions:[],clientCapabilities:b.capabilities});function w(Pe,Me){let Se=Pe.split("."),we=b.capabilities;for(let se=0;we&&se{let F=b[v];if(F){if(!F.timeout)return;F.features[R]=R,F.timeout.refresh()}else F={features:{[R]:R}},F.timeout=setTimeout(()=>{e.sendNotification(Fs.type,`${ul(v)}: For performance reasons, ${Object.keys(F.features).join(" and ")} have been limited to ${w} items.`),F.timeout=void 0},2e3),b[v]=F}}}}(),y,x,T=null;e.onDidChangeConfiguration(b=>{let v=b.settings;t.configureHttpRequests&&t.configureHttpRequests(v.http&&v.http.proxy,v.http&&v.http.proxyStrictSSL),y=v.json&&v.json.schemas,C(),f=Math.trunc(Math.max(v.json&&v.json.resultLimit||l,0)),a=Math.trunc(Math.max(v.json&&v.json.resultLimit||Number.MAX_VALUE,0)),s&&(v&&v.json&&v.json.format&&v.json.format.enable?T||(T=e.client.register(je.DocumentRangeFormattingRequest.type,{documentSelector:[{language:"json"},{language:"jsonc"}]})):T&&(T.then(R=>R.dispose()),T=null))}),e.onNotification(Es.type,b=>{x=b,C()}),e.onNotification(Ns.type,b=>{n.resetSchema(b)}),e.onRequest(qs.type,b=>new Promise(v=>{let w=i.get(b);w?(C(),q(w,R=>{v(R)})):v([])}));function C(){let b={validate:!0,allowComments:!0,schemas:new Array};if(x)if(Array.isArray(x))Array.prototype.push.apply(b.schemas,x);else for(let v in x){let w=x[v];Array.isArray(w)&&w.forEach(R=>{b.schemas.push({uri:R,fileMatch:[v]})})}y&&y.forEach((v,w)=>{let R=v.url;!R&&v.schema&&(R=v.schema.id||`vscode://schemas/custom/${w}`),R&&b.schemas.push({uri:R,fileMatch:v.fileMatch,schema:v.schema})}),n.configure(b),i.all().forEach(O)}i.onDidChangeContent(b=>{m.cancel(b.document.uri),O(b.document)}),i.onDidClose(b=>{m.cancel(b.document.uri),g(b.document),e.sendDiagnostics({uri:b.document.uri,diagnostics:[]})});let p={},h=300;function g(b){let v=p[b.uri];v&&(clearTimeout(v),delete p[b.uri])}function O(b){g(b),p[b.uri]=setTimeout(()=>{delete p[b.uri],q(b)},h)}function q(b,v){let w=$=>{e.sendDiagnostics({uri:b.uri,diagnostics:$}),v&&v($)};if(b.getText().length===0){w([]);return}let R=_(b),F=b.version,L=b.languageId==="jsonc"?{comments:"ignore",trailingCommas:"warning"}:{comments:"error",trailingCommas:"error"};n.doValidation(b,R,L).then($=>{setImmediate(()=>{let ne=i.get(b.uri);ne&&ne.version===F&&w($)})},$=>{e.console.error(Sr(`Error while validating ${b.uri}`,$))})}e.onDidChangeWatchedFiles(b=>{let v=!1;b.changes.forEach(w=>{n.resetSchema(w.uri)&&(v=!0)}),v&&i.all().forEach(O)});let D=al(10,60,b=>n.parseJSONDocument(b));i.onDidClose(b=>{D.onDocumentRemoved(b.document)}),e.onShutdown(()=>{D.dispose()});function _(b){return D.get(b)}e.onCompletion((b,v)=>nn(async()=>{let w=i.get(b.textDocument.uri);if(w){let R=_(w);return n.doComplete(w,b.position,R)}return null},null,`Error while computing completions for ${b.textDocument.uri}`,v)),e.onHover((b,v)=>nn(async()=>{let w=i.get(b.textDocument.uri);if(w){let R=_(w);return n.doHover(w,b.position,R)}return null},null,`Error while computing hover for ${b.textDocument.uri}`,v)),e.onDocumentSymbol((b,v)=>Tr(()=>{let w=i.get(b.textDocument.uri);if(w){let R=_(w),F=m.onResultLimitExceeded(w.uri,a,"document symbols");return u?n.findDocumentSymbols2(w,R,{resultLimit:a,onResultLimitExceeded:F}):n.findDocumentSymbols(w,R,{resultLimit:a,onResultLimitExceeded:F})}return[]},[],`Error while computing document symbols for ${b.textDocument.uri}`,v)),e.onDocumentRangeFormatting((b,v)=>Tr(()=>{let w=i.get(b.textDocument.uri);if(w){let R=n.format(w,b.range,b.options);if(R.length>c){let F=Rr.applyEdits(w,R);return[je.TextEdit.replace(k.Range.create(k.Position.create(0,0),w.positionAt(w.getText().length)),F)]}return R}return[]},[],`Error while formatting range for ${b.textDocument.uri}`,v)),e.onDocumentColor((b,v)=>nn(async()=>{let w=i.get(b.textDocument.uri);if(w){let R=m.onResultLimitExceeded(w.uri,a,"document colors"),F=_(w);return n.findDocumentColors(w,F,{resultLimit:a,onResultLimitExceeded:R})}return[]},[],`Error while computing document colors for ${b.textDocument.uri}`,v)),e.onColorPresentation((b,v)=>Tr(()=>{let w=i.get(b.textDocument.uri);if(w){let R=_(w);return n.getColorPresentations(w,R,b.color,b.range)}return[]},[],`Error while computing color presentations for ${b.textDocument.uri}`,v)),e.onFoldingRanges((b,v)=>Tr(()=>{let w=i.get(b.textDocument.uri);if(w){let R=m.onResultLimitExceeded(w.uri,f,"folding ranges");return n.getFoldingRanges(w,{rangeLimit:f,onRangeLimitExceeded:R})}return null},null,`Error while computing folding ranges for ${b.textDocument.uri}`,v)),e.onSelectionRanges((b,v)=>Tr(()=>{let w=i.get(b.textDocument.uri);if(w){let R=_(w);return n.getSelectionRanges(w,b.positions,R)}return[]},[],`Error while computing selection ranges for ${b.textDocument.uri}`,v)),e.onDefinition((b,v)=>nn(async()=>{let w=i.get(b.textDocument.uri);if(w){let R=_(w);return n.findDefinition(w,b.position,R)}return[]},[],`Error while computing definitions for ${b.textDocument.uri}`,v)),e.listen()}ff(); +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version v4.2.8+1e68dce6 + */ +//# sourceMappingURL=server.js.map diff --git a/coc/extensions/node_modules/coc-json/package.json b/coc/extensions/node_modules/coc-json/package.json new file mode 100644 index 0000000..f0f41d5 --- /dev/null +++ b/coc/extensions/node_modules/coc-json/package.json @@ -0,0 +1,119 @@ +{ + "name": "coc-json", + "version": "1.3.4", + "description": "Json extension for coc.nvim", + "main": "lib/index.js", + "publisher": "chemzqm", + "keywords": [ + "coc.nvim", + "json" + ], + "engines": { + "coc": ">= 0.0.80" + }, + "scripts": { + "prepare": "node esbuild.js" + }, + "activationEvents": [ + "onLanguage:json", + "onLanguage:jsonc" + ], + "contributes": { + "configuration": { + "type": "object", + "title": "Json", + "properties": { + "json.enable": { + "type": "boolean", + "default": true, + "description": "Enable json server" + }, + "json.trace.server": { + "type": "string", + "default": "off", + "enum": [ + "off", + "messages", + "verbose" + ] + }, + "json.execArgv": { + "type": "array", + "default": [], + "items": { + "type": "string" + } + }, + "json.format.enable": { + "type": "boolean", + "default": true, + "description": "Enable format for json server" + }, + "json.maxItemsComputed": { + "type": "number", + "default": 5000, + "description": "The maximum number of outline symbols and folding regions computed (limited for performance reasons)." + }, + "json.schemaDownload.enable": { + "type": "boolean", + "default": true, + "description": "When enabled, JSON schemas can be fetched from http and https locations.", + "tags": [ + "usesOnlineServices" + ] + }, + "json.schemas": { + "type": "array", + "scope": "resource", + "description": "Schemas associations for json files", + "default": [], + "items": { + "type": "object", + "default": { + "fileMatch": [ + "/my-file" + ], + "url": "schemaURL" + }, + "properties": { + "url": { + "type": "string", + "default": "/user.schema.json" + }, + "fileMatch": { + "type": "array", + "items": { + "type": "string", + "default": "MyFile.json" + }, + "minItems": 1, + "description": "File pattern to match." + }, + "schema": { + "$ref": "http://json-schema.org/draft-04/schema#", + "description": "Url of json schema, support file/url protocol." + } + } + } + } + } + } + }, + "author": "chemzqm@gmail.com", + "license": "MIT", + "devDependencies": { + "@chemzqm/tsconfig": "^0.0.3", + "@types/node": "^10.12.0", + "esbuild": "^0.8.29", + "coc.nvim": "^0.0.80", + "request-light": "^0.4.0", + "rimraf": "^3.0.2", + "strip-bom": "^4.0.0", + "typescript": "^4.1.3", + "vscode-json-languageservice": "^3.8.3", + "vscode-languageserver": "7.0.0-next.3", + "vscode-languageserver-protocol": "^3.15.3", + "vscode-uri": "^2.1.2" + }, + "dependencies": {} +} diff --git a/coc/extensions/node_modules/coc-json/sync.sh b/coc/extensions/node_modules/coc-json/sync.sh new file mode 100755 index 0000000..06c8989 --- /dev/null +++ b/coc/extensions/node_modules/coc-json/sync.sh @@ -0,0 +1,6 @@ +#! /bin/bash + +curl https://raw.githubusercontent.com/qiu8310/minapp/master/schema/app.json > ./data/app.json +curl https://raw.githubusercontent.com/qiu8310/minapp/master/schema/page.json > ./data/page.json +curl https://raw.githubusercontent.com/qiu8310/minapp/master/schema/component.json > ./data/component.json +curl https://schemastore.azurewebsites.net/api/json/catalog.json > ./src/catalog.json diff --git a/coc/extensions/node_modules/coc-yaml/.github/FUNDING.yml b/coc/extensions/node_modules/coc-yaml/.github/FUNDING.yml new file mode 100644 index 0000000..ecdd06b --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/.github/FUNDING.yml @@ -0,0 +1,4 @@ +# These are supported funding model platforms + +patreon: chemzqm +custom: https://paypal.me/chezqm diff --git a/coc/extensions/node_modules/coc-yaml/Readme.md b/coc/extensions/node_modules/coc-yaml/Readme.md new file mode 100644 index 0000000..7e6bf71 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/Readme.md @@ -0,0 +1,172 @@ +# coc-yaml + +Fork of [vscode-yaml](https://github.com/redhat-developer/vscode-yaml) that +works with [coc.nvim](https://github.com/neoclide/coc.nvim) + +## Supporting + +If you like my work, consider supporting me on Patreon or PayPal: + +Patreon donate button +PayPal donate button + +## Install + +In your vim/neovim, run command: + +``` +:CocInstall coc-yaml +``` + +## Features + +![screencast](https://raw.githubusercontent.com/redhat-developer/vscode-yaml/master/images/demo.gif) + +1. YAML validation: + - Detects whether the entire file is valid yaml + - Detects errors such as: + - Node is not found + - Node has an invalid key node type + - Node has an invalid type + - Node is not a valid child node +2. Document Outlining (Ctrl + Shift + O): + - Provides the document outlining of all completed nodes in the file +3. Auto completion (Ctrl + Space): + - Auto completes on all commands + - Scalar nodes autocomplete to schema's defaults if they exist +4. Hover support: + - Hovering over a node shows description _if provided by schema_ +5. Formatter: + - Allows for formatting the current file + +_Auto completion and hover support are provided by the schema. Please refer to Language Server Settings to setup a schema_ + +# Language Server Settings + +The following settings are supported: + +- `yaml.format.enable` (default: `false`): Enable/disable default YAML formatter (requires restart) +- `yaml.format.singleQuote` (default: `false`): Use single quotes instead of double quotes +- `yaml.format.bracketSpacing` (default: `true`): Print spaces between brackets in objects +- `yaml.format.proseWrap` (default: `"preserve"`): `"always"`: wrap prose if it exeeds the print width, `"never"`: never wrap the prose, `"preserve"`: wrap prose as-is +- `yaml.format.printWidth`: Specify the line length that the printer will wrap on +- `yaml.validate` (default: `true`): Enable/disable validation feature +- `yaml.hover` (default: `true`): Enable/disable hover +- `yaml.completion` (default: `true`): Enable/disable autocompletion +- `yaml.schemas` (default: `{}`): Helps you associate schemas with files in a glob pattern +- `yaml.schemaStore.enable`: When set to true the YAML language server will pull in all available schemas from [JSON Schema Store](http://schemastore.org/json/) +- `yaml.customTags` (default: `[]`): Array of custom tags that the parser will validate against. It has two ways to be used. Either an item in the array is a custom tag such as "!Ref" or you can specify the type of the object !Ref should be by doing "!Ref Scalar". For example: ["!Ref", "!Some-Tag Scalar"]. The type of object can be one of Scalar, Sequence, Mapping, Map. +- `[yaml]`: VSCode-YAML adds default configuration for all yaml files. More specifically it converts tabs to spaces to ensure valid yaml, sets the tab size, and allows live typing autocompletion. These settings can be modified via the corresponding settings inside the `[yaml]` section in the settings: + - `editor.insertSpaces` + - `editor.tabSize` + - `editor.quickSuggestions` + +**Note** `insertSpaces` and `tabSize` settings may not work, you need ensure `&shiftwidth` and `&expandtab` options of your yaml buffer. + +##### Adding custom tags + +In order to use the custom tags in your YAML file you need to first specify the custom tags in the setting of your code editor. For example, you can have the following custom tags: + +```YAML +"yaml.customTags": [ + "!Scalar-example scalar", + "!Seq-example sequence", + "!Mapping-example mapping" +] +``` + +The !Scalar-example would map to a scalar custom tag, the !Seq-example would map to a sequence custom tag, the !Mapping-example would map to a mapping custom tag. + +You can then use the newly defined custom tags inside the YAML file: + +```YAML +some_key: !Scalar-example some_value +some_sequence: !Seq-example + - some_seq_key_1: some_seq_value_1 + - some_seq_key_2: some_seq_value_2 +some_mapping: !Mapping-example + some_mapping_key_1: some_mapping_value_1 + some_mapping_key_2: some_mapping_value_2 +``` + +##### Associating a schema to a glob pattern via yaml.schemas: + +yaml.schemas applies a schema to a file. In other words, the schema (placed on the left) is applied to the glob pattern on the right. Your schema can be local or online. Your schema must be a relative path and not an absolute path. + +When associating a schema it should follow the format below + +```JSON +"yaml.schemas": { + "url": "globPattern", + "Kubernetes": "globPattern" +} +``` + +e.g. + +```JSON +"yaml.schemas": { + "http://json.schemastore.org/composer": ["/*"], + "file:///home/johnd/some-schema.json": ["some.yaml"], + "../relative/path/schema.json": ["/config*.yaml"], + "/Users/johnd/some-schema.json": ["some.yaml"], +} +``` + +e.g. + +```JSON +"yaml.schemas": { + "kubernetes": ["/myYamlFile.yaml"] +} +``` + +e.g. + +```JSON +"yaml.schemas": { + "http://json.schemastore.org/composer": ["/*"], + "kubernetes": ["/myYamlFile.yaml"] +} +``` + +Since `0.11.0` YAML Schemas can be used for validation: + +```json +"/home/user/custom_schema.yaml": "someFilePattern.yaml" +``` + +- The entrance point for `yaml.schemas` is location in [user and workspace settings](https://code.visualstudio.com/docs/getstarted/settings#_creating-user-and-workspace-settings) +- Supports schemas through [schema store](http://schemastore.org/json/) as well as any other schema url +- Supports 'yamlValidation' point which allows you to contribute a schema for a specific type of yaml file (Similar to [jsonValidation](https://code.visualstudio.com/docs/extensionAPI/extension-points#_contributesjsonvalidation)) + e.g. + +```JSON +{ + "contributes": { + "yamlValidation": [ + { + "fileMatch": "yourfile.yml", + "url": "./schema.json" + } + ] + } +} +``` + +This extension allows you to specify json schemas that you want to validate against the yaml that you write. In the vscode user and workspace preferences you can set a url and a glob pattern that you want to validate against the schema. Kubernetes is an optional field. They do not require a url as the language server will provide that. You just need the keyword kubernetes and a glob pattern. + +## Debug + +Add `"yaml.trace.server": "verbose"` to your `coc-settings.json` to get verbose +output of LSP communication. + +Open output channel by command: + +``` +:CocCommand workspace.showOutput yaml +``` + +## License + +MIT diff --git a/coc/extensions/node_modules/coc-yaml/esbuild.js b/coc/extensions/node_modules/coc-yaml/esbuild.js new file mode 100644 index 0000000..8cfec00 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/esbuild.js @@ -0,0 +1,18 @@ + +async function start() { + await require('esbuild').build({ + entryPoints: ['src/index.ts'], + bundle: true, + minify: process.env.NODE_ENV === 'production', + sourcemap: process.env.NODE_ENV === 'development', + mainFields: ['module', 'main'], + external: ['coc.nvim'], + platform: 'node', + target: 'node10.12', + outfile: 'lib/index.js' + }) +} + +start().catch(e => { + console.error(e) +}) diff --git a/coc/extensions/node_modules/coc-yaml/lib/index.js b/coc/extensions/node_modules/coc-yaml/lib/index.js new file mode 100644 index 0000000..a67cff2 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/lib/index.js @@ -0,0 +1,247 @@ +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __markAsModule = (target) => __defProp(target, "__esModule", {value: true}); +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, {get: all[name], enumerable: true}); +}; +var __exportStar = (target, module2, desc) => { + if (module2 && typeof module2 === "object" || typeof module2 === "function") { + for (let key of __getOwnPropNames(module2)) + if (!__hasOwnProp.call(target, key) && key !== "default") + __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable}); + } + return target; +}; +var __toModule = (module2) => { + if (module2 && module2.__esModule) + return module2; + return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", {value: module2, enumerable: true})), module2); +}; + +// src/index.ts +__markAsModule(exports); +__export(exports, { + activate: () => activate +}); +var import_path = __toModule(require("path")); +var import_coc2 = __toModule(require("coc.nvim")); + +// src/schema-extension-api.ts +var import_coc = __toModule(require("coc.nvim")); +var MODIFICATION_ACTIONS; +(function(MODIFICATION_ACTIONS2) { + MODIFICATION_ACTIONS2[MODIFICATION_ACTIONS2["delete"] = 0] = "delete"; + MODIFICATION_ACTIONS2[MODIFICATION_ACTIONS2["add"] = 1] = "add"; +})(MODIFICATION_ACTIONS || (MODIFICATION_ACTIONS = {})); +var SchemaModificationNotification; +(function(SchemaModificationNotification2) { + SchemaModificationNotification2.type = new import_coc.RequestType("json/schema/modify"); +})(SchemaModificationNotification || (SchemaModificationNotification = {})); +var SchemaExtensionAPI = class { + constructor(client2) { + this._customSchemaContributors = {}; + this._yamlClient = client2; + } + registerContributor(schema, requestSchema, requestSchemaContent, label) { + if (this._customSchemaContributors[schema]) { + return false; + } + if (!requestSchema) { + throw new Error("Illegal parameter for requestSchema."); + } + if (label) { + const [first, second] = label.split(":"); + if (first && second) { + label = second.trim(); + label = label.replace(".", "\\."); + label = `${first}:[ ]+${label}`; + } + } + this._customSchemaContributors[schema] = { + requestSchema, + requestSchemaContent, + label + }; + return true; + } + requestCustomSchema(resource) { + const matches = []; + for (const customKey of Object.keys(this._customSchemaContributors)) { + try { + const contributor = this._customSchemaContributors[customKey]; + let uri; + if (contributor.label && import_coc.workspace.textDocuments) { + const labelRegexp = new RegExp(contributor.label, "g"); + for (const doc of import_coc.workspace.textDocuments) { + if (doc.uri.toString() === resource) { + if (labelRegexp.test(doc.getText())) { + uri = contributor.requestSchema(resource); + return [uri]; + } + } + } + } + uri = contributor.requestSchema(resource); + if (uri) { + matches.push(uri); + } + } catch (error) { + this._yamlClient.outputChannel.appendLine(`Error thrown while requesting schema "${error}" when calling the registered contributor "${customKey}"`); + } + } + return matches; + } + requestCustomSchemaContent(uri) { + if (uri) { + const _uri = import_coc.Uri.parse(uri); + if (_uri.scheme && this._customSchemaContributors[_uri.scheme] && this._customSchemaContributors[_uri.scheme].requestSchemaContent) { + return this._customSchemaContributors[_uri.scheme].requestSchemaContent(uri); + } + } + } + async modifySchemaContent(schemaModifications) { + return this._yamlClient.sendRequest(SchemaModificationNotification.type, schemaModifications); + } +}; +var CUSTOM_SCHEMA_REQUEST = "custom/schema/request"; +var CUSTOM_CONTENT_REQUEST = "custom/schema/content"; + +// src/paths.ts +var Dot = ".".charCodeAt(0); +function normalizePath(parts) { + const newParts = []; + for (const part of parts) { + if (part.length === 0 || part.length === 1 && part.charCodeAt(0) === Dot) { + } else if (part.length === 2 && part.charCodeAt(0) === Dot && part.charCodeAt(1) === Dot) { + newParts.pop(); + } else { + newParts.push(part); + } + } + if (parts.length > 1 && parts[parts.length - 1].length === 0) { + newParts.push(""); + } + let res = newParts.join("/"); + if (parts[0].length === 0) { + res = "/" + res; + } + return res; +} +function joinPath(uri, ...paths) { + const parts = uri.path.split("/"); + for (const path2 of paths) { + parts.push(...path2.split("/")); + } + return uri.with({path: normalizePath(parts)}); +} + +// src/index.ts +var SchemaAssociationNotification; +(function(SchemaAssociationNotification2) { + SchemaAssociationNotification2.type = new import_coc2.NotificationType("json/schemaAssociations"); +})(SchemaAssociationNotification || (SchemaAssociationNotification = {})); +var VSCodeContentRequestRegistration; +(function(VSCodeContentRequestRegistration2) { + VSCodeContentRequestRegistration2.type = new import_coc2.NotificationType("yaml/registerVSCodeContentRequest"); +})(VSCodeContentRequestRegistration || (VSCodeContentRequestRegistration = {})); +var VSCodeContentRequest; +(function(VSCodeContentRequest2) { + VSCodeContentRequest2.type = new import_coc2.RequestType("vscode/content"); +})(VSCodeContentRequest || (VSCodeContentRequest = {})); +var DynamicCustomSchemaRequestRegistration; +(function(DynamicCustomSchemaRequestRegistration2) { + DynamicCustomSchemaRequestRegistration2.type = new import_coc2.NotificationType("yaml/registerCustomSchemaRequest"); +})(DynamicCustomSchemaRequestRegistration || (DynamicCustomSchemaRequestRegistration = {})); +var client; +function activate(context) { + const serverModule = context.asAbsolutePath(import_path.default.join("node_modules", "yaml-language-server", "out", "server", "src", "server.js")); + const debugOptions = {execArgv: ["--nolazy", "--inspect=6009"]}; + const serverOptions = { + run: {module: serverModule, transport: import_coc2.TransportKind.ipc}, + debug: {module: serverModule, transport: import_coc2.TransportKind.ipc, options: debugOptions} + }; + const clientOptions = { + documentSelector: [{language: "yaml"}], + synchronize: { + configurationSection: ["yaml", "http.proxy", "http.proxyStrictSSL", "editor.tabSize", "[yaml]"], + fileEvents: [import_coc2.workspace.createFileSystemWatcher("**/*.?(e)y?(a)ml"), import_coc2.workspace.createFileSystemWatcher("**/*.json")] + }, + revealOutputChannelOn: import_coc2.RevealOutputChannelOn.Never + }; + client = new import_coc2.LanguageClient("yaml", "YAML Support", serverOptions, clientOptions); + const disposable = client.start(); + const schemaExtensionAPI = new SchemaExtensionAPI(client); + context.subscriptions.push(disposable); + client.onReady().then(() => { + client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociations()); + import_coc2.extensions.onDidActiveExtension(() => { + client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociations()); + }); + import_coc2.extensions.onDidUnloadExtension(() => { + client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociations()); + }); + client.sendNotification(DynamicCustomSchemaRequestRegistration.type); + client.sendNotification(VSCodeContentRequestRegistration.type); + client.onRequest(CUSTOM_SCHEMA_REQUEST, (resource) => { + return schemaExtensionAPI.requestCustomSchema(resource); + }); + client.onRequest(CUSTOM_CONTENT_REQUEST, (uri) => { + return schemaExtensionAPI.requestCustomSchemaContent(uri); + }); + client.onRequest(VSCodeContentRequest.type, (uri) => { + return import_coc2.fetch(uri, { + headers: {"Accept-Encoding": "gzip, deflate"} + }).then((res) => { + if (typeof res === "string") + return res; + if (Buffer.isBuffer(res)) + return res.toString(); + return JSON.stringify(res); + }, (err) => { + return Promise.reject(err); + }); + }); + }); + return schemaExtensionAPI; +} +function getSchemaAssociations() { + const associations = []; + import_coc2.extensions.all.forEach((extension) => { + const packageJSON = extension.packageJSON; + if (packageJSON && packageJSON.contributes && packageJSON.contributes.yamlValidation) { + const yamlValidation = packageJSON.contributes.yamlValidation; + if (Array.isArray(yamlValidation)) { + yamlValidation.forEach((jv) => { + let {fileMatch, url} = jv; + if (typeof fileMatch === "string") { + fileMatch = [fileMatch]; + } + if (Array.isArray(fileMatch) && typeof url === "string") { + let uri = url; + if (uri[0] === "." && uri[1] === "/") { + uri = joinPath(import_coc2.Uri.file(extension.extensionPath), uri).toString(); + } + fileMatch = fileMatch.map((fm) => { + if (fm[0] === "%") { + fm = fm.replace(/%APP_SETTINGS_HOME%/, "/User"); + fm = fm.replace(/%MACHINE_SETTINGS_HOME%/, "/Machine"); + fm = fm.replace(/%APP_WORKSPACES_HOME%/, "/Workspaces"); + } else if (!fm.match(/^(\w+:\/\/|\/|!)/)) { + fm = "/" + fm; + } + return fm; + }); + associations.push({fileMatch, uri}); + } + }); + } + } + }); + return associations; +} +//# sourceMappingURL=index.js.map diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/.bin/esparse b/coc/extensions/node_modules/coc-yaml/node_modules/.bin/esparse new file mode 120000 index 0000000..7423b18 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/.bin/esparse @@ -0,0 +1 @@ +../esprima/bin/esparse.js \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/.bin/esvalidate b/coc/extensions/node_modules/coc-yaml/node_modules/.bin/esvalidate new file mode 120000 index 0000000..16069ef --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/.bin/esvalidate @@ -0,0 +1 @@ +../esprima/bin/esvalidate.js \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/.bin/installServerIntoExtension b/coc/extensions/node_modules/coc-yaml/node_modules/.bin/installServerIntoExtension new file mode 120000 index 0000000..f6c17a3 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/.bin/installServerIntoExtension @@ -0,0 +1 @@ +../vscode-languageserver/bin/installServerIntoExtension \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/.bin/js-yaml b/coc/extensions/node_modules/coc-yaml/node_modules/.bin/js-yaml new file mode 120000 index 0000000..9dbd010 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/.bin/js-yaml @@ -0,0 +1 @@ +../js-yaml/bin/js-yaml.js \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/.bin/prettier b/coc/extensions/node_modules/coc-yaml/node_modules/.bin/prettier new file mode 120000 index 0000000..a478df3 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/.bin/prettier @@ -0,0 +1 @@ +../prettier/bin-prettier.js \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/.bin/yaml-language-server b/coc/extensions/node_modules/coc-yaml/node_modules/.bin/yaml-language-server new file mode 120000 index 0000000..d806d76 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/.bin/yaml-language-server @@ -0,0 +1 @@ +../yaml-language-server/bin/yaml-language-server \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/.package-lock.json b/coc/extensions/node_modules/coc-yaml/node_modules/.package-lock.json new file mode 100644 index 0000000..649ce0a --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/.package-lock.json @@ -0,0 +1,249 @@ +{ + "name": "coc-yaml", + "version": "1.3.1", + "lockfileVersion": 2, + "requires": true, + "packages": { + "node_modules/agent-base": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "dependencies": { + "es6-promisify": "^5.0.0" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "node_modules/es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dependencies": { + "es6-promise": "^4.0.3" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/http-proxy-agent": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", + "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", + "dependencies": { + "agent-base": "4", + "debug": "3.1.0" + }, + "engines": { + "node": ">= 4.5.0" + } + }, + "node_modules/https-proxy-agent": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", + "dependencies": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "engines": { + "node": ">= 4.5.0" + } + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsonc-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.1.tgz", + "integrity": "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==" + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node_modules/prettier": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", + "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/request-light": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/request-light/-/request-light-0.2.5.tgz", + "integrity": "sha512-eBEh+GzJAftUnex6tcL6eV2JCifY0+sZMIUpUPOVXbs2nV5hla4ZMmO3icYKGuGVuQ2zHE9evh4OrRcH4iyYYw==", + "dependencies": { + "http-proxy-agent": "^2.1.0", + "https-proxy-agent": "^2.2.3", + "vscode-nls": "^4.1.1" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, + "node_modules/vscode-json-languageservice": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-3.11.0.tgz", + "integrity": "sha512-QxI+qV97uD7HHOCjh3MrM1TfbdwmTXrMckri5Tus1/FQiG3baDZb2C9Y0y8QThs7PwHYBIQXcAc59ZveCRZKPA==", + "dependencies": { + "jsonc-parser": "^3.0.0", + "vscode-languageserver-textdocument": "^1.0.1", + "vscode-languageserver-types": "3.16.0-next.2", + "vscode-nls": "^5.0.0", + "vscode-uri": "^2.1.2" + } + }, + "node_modules/vscode-json-languageservice/node_modules/jsonc-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", + "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==" + }, + "node_modules/vscode-json-languageservice/node_modules/vscode-languageserver-types": { + "version": "3.16.0-next.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.2.tgz", + "integrity": "sha512-QjXB7CKIfFzKbiCJC4OWC8xUncLsxo19FzGVp/ADFvvi87PlmBSCAtZI5xwGjF5qE0xkLf0jjKUn3DzmpDP52Q==" + }, + "node_modules/vscode-json-languageservice/node_modules/vscode-nls": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.0.tgz", + "integrity": "sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==" + }, + "node_modules/vscode-jsonrpc": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz", + "integrity": "sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg==", + "engines": { + "node": ">=8.0.0 || >=10.0.0" + } + }, + "node_modules/vscode-languageserver": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-5.2.1.tgz", + "integrity": "sha512-GuayqdKZqAwwaCUjDvMTAVRPJOp/SLON3mJ07eGsx/Iq9HjRymhKWztX41rISqDKhHVVyFM+IywICyZDla6U3A==", + "dependencies": { + "vscode-languageserver-protocol": "3.14.1", + "vscode-uri": "^1.0.6" + }, + "bin": { + "installServerIntoExtension": "bin/installServerIntoExtension" + } + }, + "node_modules/vscode-languageserver-protocol": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz", + "integrity": "sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g==", + "dependencies": { + "vscode-jsonrpc": "^4.0.0", + "vscode-languageserver-types": "3.14.0" + } + }, + "node_modules/vscode-languageserver-protocol/node_modules/vscode-languageserver-types": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz", + "integrity": "sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A==" + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz", + "integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA==" + }, + "node_modules/vscode-languageserver-types": { + "version": "3.16.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz", + "integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==" + }, + "node_modules/vscode-languageserver/node_modules/vscode-uri": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.8.tgz", + "integrity": "sha512-obtSWTlbJ+a+TFRYGaUumtVwb+InIUVI0Lu0VBUAPmj2cU5JutEXg3xUE0c2J5Tcy7h2DEKVJBFi+Y9ZSFzzPQ==" + }, + "node_modules/vscode-nls": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-4.1.2.tgz", + "integrity": "sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==" + }, + "node_modules/vscode-uri": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.2.tgz", + "integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==" + }, + "node_modules/yaml-language-server": { + "version": "0.13.1-d0f9b44.0", + "resolved": "https://registry.npmjs.org/yaml-language-server/-/yaml-language-server-0.13.1-d0f9b44.0.tgz", + "integrity": "sha512-6q5NKJiCqB1ptEopsA6pQDNDBnpwQ5o3A6im9Mus9XdB1gM0TCaR2TT9XU13CFo6JoCgVZ6s3lgoUOsbN8Y5Qw==", + "dependencies": { + "js-yaml": "^3.13.1", + "jsonc-parser": "^2.2.1", + "prettier": "2.0.5", + "request-light": "^0.2.4", + "vscode-json-languageservice": "^3.10.0", + "vscode-languageserver": "^5.2.1", + "vscode-languageserver-types": "^3.15.1", + "vscode-nls": "^4.1.2", + "vscode-uri": "^2.1.1", + "yaml-language-server-parser": "next" + }, + "bin": { + "yaml-language-server": "bin/yaml-language-server" + }, + "engines": { + "node": "*" + }, + "optionalDependencies": { + "prettier": "2.0.5" + } + }, + "node_modules/yaml-language-server-parser": { + "version": "0.1.3-fa8245c.0", + "resolved": "https://registry.npmjs.org/yaml-language-server-parser/-/yaml-language-server-parser-0.1.3-fa8245c.0.tgz", + "integrity": "sha512-0QPUSsmMXHDpqj00xUrlMyqlEAwHHIAuz3wPMyprcCVYx7jh7oo91Z0nC/jhott4XAKp3iY3vjBsMxqszoZosA==" + } + } +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/.travis.yml b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/.travis.yml new file mode 100644 index 0000000..7620095 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/.travis.yml @@ -0,0 +1,24 @@ +sudo: false + +language: node_js + +node_js: + - "4" + - "5" + - "6" + - "7" + - "8" + - "9" + - "10" + +install: + - PATH="`npm bin`:`npm bin -g`:$PATH" + # Install dependencies and build + - npm install + +script: + # Output useful info for debugging + - node --version + - npm --version + # Run tests + - npm test diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/History.md b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/History.md new file mode 100644 index 0000000..80c88dc --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/History.md @@ -0,0 +1,113 @@ + +4.2.0 / 2018-01-15 +================== + + * Add support for returning an `http.Agent` instance + * Optimize promisifying logic + * Set `timeout` to null for proper cleanup + * Remove Node.js <= 0.11.3 special-casing from test case + +4.1.2 / 2017-11-20 +================== + + * test Node 9 on Travis + * ensure that `https.get()` uses the patched `https.request()` + +4.1.1 / 2017-07-20 +================== + + * Correct `https.request()` with a String (#9) + +4.1.0 / 2017-06-26 +================== + + * mix in Agent options into Request options + * throw when nothing is returned from agent-base callback + * do not modify the options object for https requests + +4.0.1 / 2017-06-13 +================== + + * add `this` context tests and fixes + +4.0.0 / 2017-06-06 +================== + + * drop support for Node.js < 4 + * drop old versions of Node.js from Travis-CI + * specify Node.js >= 4.0.0 in `engines.node` + * remove more old code + * remove "extend" dependency + * remove "semver" dependency + * make the Promise logic a bit cleaner + * add async function pseudo-example to README + * use direct return in README example + +3.0.0 / 2017-06-02 +================== + + * drop support for Node.js v0.8 and v0.10 + * add support for async, Promises, and direct return + * add a couple `options` test cases + * implement a `"timeout"` option + * rename main file to `index.js` + * test Node 8 on Travis + +2.1.1 / 2017-05-30 +================== + + * Revert [`fe2162e`](https://github.com/TooTallNate/node-agent-base/commit/fe2162e0ba18123f5b301cba4de1e9dd74e437cd) and [`270bdc9`](https://github.com/TooTallNate/node-agent-base/commit/270bdc92eb8e3bd0444d1e5266e8e9390aeb3095) (fixes #7) + +2.1.0 / 2017-05-26 +================== + + * unref is not supported for node < 0.9.1 (@pi0) + * add tests to dangling socket (@pi0) + * check unref() is supported (@pi0) + * fix dangling sockets problem (@pi0) + * add basic "ws" module tests + * make `Agent` be subclassable + * turn `addRequest()` into a named function + * test: Node.js v4 likes to call `cork` on the stream (#3, @tomhughes) + * travis: test node v4, v5, v6 and v7 + +2.0.1 / 2015-09-10 +================== + + * package: update "semver" to v5.0.1 for WebPack (#1, @vhpoet) + +2.0.0 / 2015-07-10 +================== + + * refactor to patch Node.js core for more consistent `opts` values + * ensure that HTTP(s) default port numbers are always given + * test: use ssl-cert-snakeoil SSL certs + * test: add tests for arbitrary options + * README: add API section + * README: make the Agent HTTP/HTTPS generic in the example + * README: use SVG for Travis-CI badge + +1.0.2 / 2015-06-27 +================== + + * agent: set `req._hadError` to true after emitting "error" + * package: update "mocha" to v2 + * test: add artificial HTTP GET request test + * test: add artificial data events test + * test: fix artifical GET response test on node > v0.11.3 + * test: use a real timeout for the async error test + +1.0.1 / 2013-09-09 +================== + + * Fix passing an "error" object to the callback function on the first tick + +1.0.0 / 2013-09-09 +================== + + * New API: now you pass a callback function directly + +0.0.1 / 2013-07-09 +================== + + * Initial release diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/README.md b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/README.md new file mode 100644 index 0000000..dbeceab --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/README.md @@ -0,0 +1,145 @@ +agent-base +========== +### Turn a function into an [`http.Agent`][http.Agent] instance +[![Build Status](https://travis-ci.org/TooTallNate/node-agent-base.svg?branch=master)](https://travis-ci.org/TooTallNate/node-agent-base) + +This module provides an `http.Agent` generator. That is, you pass it an async +callback function, and it returns a new `http.Agent` instance that will invoke the +given callback function when sending outbound HTTP requests. + +#### Some subclasses: + +Here's some more interesting uses of `agent-base`. +Send a pull request to list yours! + + * [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints + * [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints + * [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS + * [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS (v4a) proxy `http.Agent` implementation for HTTP and HTTPS + + +Installation +------------ + +Install with `npm`: + +``` bash +$ npm install agent-base +``` + + +Example +------- + +Here's a minimal example that creates a new `net.Socket` connection to the server +for every HTTP request (i.e. the equivalent of `agent: false` option): + +```js +var net = require('net'); +var tls = require('tls'); +var url = require('url'); +var http = require('http'); +var agent = require('agent-base'); + +var endpoint = 'http://nodejs.org/api/'; +var parsed = url.parse(endpoint); + +// This is the important part! +parsed.agent = agent(function (req, opts) { + var socket; + // `secureEndpoint` is true when using the https module + if (opts.secureEndpoint) { + socket = tls.connect(opts); + } else { + socket = net.connect(opts); + } + return socket; +}); + +// Everything else works just like normal... +http.get(parsed, function (res) { + console.log('"response" event!', res.headers); + res.pipe(process.stdout); +}); +``` + +Returning a Promise or using an `async` function is also supported: + +```js +agent(async function (req, opts) { + await sleep(1000); + // etc… +}); +``` + +Return another `http.Agent` instance to "pass through" the responsibility +for that HTTP request to that agent: + +```js +agent(function (req, opts) { + return opts.secureEndpoint ? https.globalAgent : http.globalAgent; +}); +``` + + +API +--- + +## Agent(Function callback[, Object options]) → [http.Agent][] + +Creates a base `http.Agent` that will execute the callback function `callback` +for every HTTP request that it is used as the `agent` for. The callback function +is responsible for creating a `stream.Duplex` instance of some kind that will be +used as the underlying socket in the HTTP request. + +The `options` object accepts the following properties: + + * `timeout` - Number - Timeout for the `callback()` function in milliseconds. Defaults to Infinity (optional). + +The callback function should have the following signature: + +### callback(http.ClientRequest req, Object options, Function cb) → undefined + +The ClientRequest `req` can be accessed to read request headers and +and the path, etc. The `options` object contains the options passed +to the `http.request()`/`https.request()` function call, and is formatted +to be directly passed to `net.connect()`/`tls.connect()`, or however +else you want a Socket to be created. Pass the created socket to +the callback function `cb` once created, and the HTTP request will +continue to proceed. + +If the `https` module is used to invoke the HTTP request, then the +`secureEndpoint` property on `options` _will be set to `true`_. + + +License +------- + +(The MIT License) + +Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net> + +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-proxy-agent]: https://github.com/TooTallNate/node-http-proxy-agent +[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent +[pac-proxy-agent]: https://github.com/TooTallNate/node-pac-proxy-agent +[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent +[http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/index.d.ts b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/index.d.ts new file mode 100644 index 0000000..ff6788b --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/index.d.ts @@ -0,0 +1,43 @@ +// Type definitions for agent-base 4.2.1 +// Project: https://github.com/TooTallNate/node-agent-base +// Definitions by: Christopher Quadflieg + +/// +import { EventEmitter } from 'events'; + +declare namespace Agent { + export type AgentCallback = ( + req?: any, + opts?: { + secureEndpoint: boolean; + } + ) => void; + + export interface AgentOptions { + timeout?: number; + host?: string; + port?: number; + [key: string]: any; + } + + export interface Agent extends EventEmitter { + _promisifiedCallback: boolean; + timeout: number | null; + options?: AgentOptions; + callback: AgentCallback; + addRequest: (req?: any, opts?: any) => void; + freeSocket: (socket: any, opts: any) => void; + } +} + +/** + * Base `http.Agent` implementation. + * No pooling/keep-alive is implemented by default. + */ +declare function Agent(opts?: Agent.AgentOptions): Agent.Agent; +declare function Agent( + callback: Agent.AgentCallback, + opts?: Agent.AgentOptions +): Agent.Agent; + +export = Agent; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/index.js b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/index.js new file mode 100644 index 0000000..0ee6b29 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/index.js @@ -0,0 +1,170 @@ +'use strict'; +require('./patch-core'); +const inherits = require('util').inherits; +const promisify = require('es6-promisify'); +const EventEmitter = require('events').EventEmitter; + +module.exports = Agent; + +function isAgent(v) { + return v && typeof v.addRequest === 'function'; +} + +/** + * Base `http.Agent` implementation. + * No pooling/keep-alive is implemented by default. + * + * @param {Function} callback + * @api public + */ +function Agent(callback, _opts) { + if (!(this instanceof Agent)) { + return new Agent(callback, _opts); + } + + EventEmitter.call(this); + + // The callback gets promisified if it has 3 parameters + // (i.e. it has a callback function) lazily + this._promisifiedCallback = false; + + let opts = _opts; + if ('function' === typeof callback) { + this.callback = callback; + } else if (callback) { + opts = callback; + } + + // timeout for the socket to be returned from the callback + this.timeout = (opts && opts.timeout) || null; + + this.options = opts; +} +inherits(Agent, EventEmitter); + +/** + * Override this function in your subclass! + */ +Agent.prototype.callback = function callback(req, opts) { + throw new Error( + '"agent-base" has no default implementation, you must subclass and override `callback()`' + ); +}; + +/** + * Called by node-core's "_http_client.js" module when creating + * a new HTTP request with this Agent instance. + * + * @api public + */ +Agent.prototype.addRequest = function addRequest(req, _opts) { + const ownOpts = Object.assign({}, _opts); + + // Set default `host` for HTTP to localhost + if (null == ownOpts.host) { + ownOpts.host = 'localhost'; + } + + // Set default `port` for HTTP if none was explicitly specified + if (null == ownOpts.port) { + ownOpts.port = ownOpts.secureEndpoint ? 443 : 80; + } + + const opts = Object.assign({}, this.options, ownOpts); + + if (opts.host && opts.path) { + // If both a `host` and `path` are specified then it's most likely the + // result of a `url.parse()` call... we need to remove the `path` portion so + // that `net.connect()` doesn't attempt to open that as a unix socket file. + delete opts.path; + } + + delete opts.agent; + delete opts.hostname; + delete opts._defaultAgent; + delete opts.defaultPort; + delete opts.createConnection; + + // Hint to use "Connection: close" + // XXX: non-documented `http` module API :( + req._last = true; + req.shouldKeepAlive = false; + + // Create the `stream.Duplex` instance + let timeout; + let timedOut = false; + const timeoutMs = this.timeout; + const freeSocket = this.freeSocket; + + function onerror(err) { + if (req._hadError) return; + req.emit('error', err); + // For Safety. Some additional errors might fire later on + // and we need to make sure we don't double-fire the error event. + req._hadError = true; + } + + function ontimeout() { + timeout = null; + timedOut = true; + const err = new Error( + 'A "socket" was not created for HTTP request before ' + timeoutMs + 'ms' + ); + err.code = 'ETIMEOUT'; + onerror(err); + } + + function callbackError(err) { + if (timedOut) return; + if (timeout != null) { + clearTimeout(timeout); + timeout = null; + } + onerror(err); + } + + function onsocket(socket) { + if (timedOut) return; + if (timeout != null) { + clearTimeout(timeout); + timeout = null; + } + if (isAgent(socket)) { + // `socket` is actually an http.Agent instance, so relinquish + // responsibility for this `req` to the Agent from here on + socket.addRequest(req, opts); + } else if (socket) { + function onfree() { + freeSocket(socket, opts); + } + socket.on('free', onfree); + req.onSocket(socket); + } else { + const err = new Error( + 'no Duplex stream was returned to agent-base for `' + req.method + ' ' + req.path + '`' + ); + onerror(err); + } + } + + if (!this._promisifiedCallback && this.callback.length >= 3) { + // Legacy callback function - convert to a Promise + this.callback = promisify(this.callback, this); + this._promisifiedCallback = true; + } + + if (timeoutMs > 0) { + timeout = setTimeout(ontimeout, timeoutMs); + } + + try { + Promise.resolve(this.callback(req, opts)).then(onsocket, callbackError); + } catch (err) { + Promise.reject(err).catch(callbackError); + } +}; + +Agent.prototype.freeSocket = function freeSocket(socket, opts) { + // TODO reuse sockets + socket.destroy(); +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/package.json b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/package.json new file mode 100644 index 0000000..9958cbc --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/package.json @@ -0,0 +1,37 @@ +{ + "name": "agent-base", + "version": "4.3.0", + "description": "Turn a function into an `http.Agent` instance", + "main": "./index.js", + "scripts": { + "test": "mocha --reporter spec" + }, + "repository": { + "type": "git", + "url": "git://github.com/TooTallNate/node-agent-base.git" + }, + "keywords": [ + "http", + "agent", + "base", + "barebones", + "https" + ], + "author": "Nathan Rajlich (http://n8.io/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/TooTallNate/node-agent-base/issues" + }, + "devDependencies": { + "@types/es6-promisify": "^5.0.0", + "@types/node": "^10.5.3", + "mocha": "^3.4.2", + "ws": "^3.0.0" + }, + "dependencies": { + "es6-promisify": "^5.0.0" + }, + "engines": { + "node": ">= 4.0.0" + } +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/patch-core.js b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/patch-core.js new file mode 100644 index 0000000..21cbbb6 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/patch-core.js @@ -0,0 +1,51 @@ +'use strict'; +const url = require('url'); +const https = require('https'); + +/** + * This currently needs to be applied to all Node.js versions + * in order to determine if the `req` is an HTTP or HTTPS request. + * + * There is currently no PR attempting to move this property upstream. + */ +const patchMarker = "__agent_base_https_request_patched__"; +if (!https.request[patchMarker]) { + https.request = (function(request) { + return function(_options, cb) { + let options; + if (typeof _options === 'string') { + options = url.parse(_options); + } else { + options = Object.assign({}, _options); + } + if (null == options.port) { + options.port = 443; + } + options.secureEndpoint = true; + return request.call(https, options, cb); + }; + })(https.request); + https.request[patchMarker] = true; +} + +/** + * This is needed for Node.js >= 9.0.0 to make sure `https.get()` uses the + * patched `https.request()`. + * + * Ref: https://github.com/nodejs/node/commit/5118f31 + */ +https.get = function (_url, _options, cb) { + let options; + if (typeof _url === 'string' && _options && typeof _options !== 'function') { + options = Object.assign({}, url.parse(_url), _options); + } else if (!_options && !cb) { + options = _url; + } else if (!cb) { + options = _url; + cb = _options; + } + + const req = https.request(options, cb); + req.end(); + return req; +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/test/ssl-cert-snakeoil.key b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/test/ssl-cert-snakeoil.key new file mode 100644 index 0000000..fd12501 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/test/ssl-cert-snakeoil.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICWwIBAAKBgQCzURxIqzer0ACAbX/lHdsn4Gd9PLKrf7EeDYfIdV0HZKPD8WDr +bBx2/fBu0OW2sjnzv/SVZbJ0DAuPE/p0+eT0qb2qC10iz9iTD7ribd7gxhirVb8y +b3fBjXsxc8V8p4Ny1LcvNSqCjwUbJqdRogfoJeTiqPM58z5sNzuv5iq7iwIDAQAB +AoGAPMQy4olrP0UotlzlJ36bowLP70ffgHCwU+/f4NWs5fF78c3du0oSx1w820Dd +Z7E0JF8bgnlJJTxjumPZz0RUCugrEHBKJmzEz3cxF5E3+7NvteZcjKn9D67RrM5x +1/uSZ9cqKE9cYvY4fSuHx18diyZ4axR/wB1Pea2utjjDM+ECQQDb9ZbmmaWMiRpQ +5Up+loxP7BZNPsEVsm+DVJmEFbaFgGfncWBqSIqnPNjMwTwj0OigTwCAEGPkfRVW +T0pbYWCxAkEA0LK7SCTwzyDmhASUalk0x+3uCAA6ryFdwJf/wd8TRAvVOmkTEldX +uJ7ldLvfrONYO3v56uKTU/SoNdZYzKtO+wJAX2KM4ctXYy5BXztPpr2acz4qHa1N +Bh+vBAC34fOYhyQ76r3b1btHhWZ5jbFuZwm9F2erC94Ps5IaoqcX07DSwQJAPKGw +h2U0EPkd/3zVIZCJJQya+vgWFIs9EZcXVtvYXQyTBkVApTN66MhBIYjzkub5205J +bVQmOV37AKklY1DhwQJAA1wos0cYxro02edzatxd0DIR2r4qqOqLkw6BhYHhq6HJ +ZvIcQkHqdSXzdETFc01I1znDGGIrJHcnvKWgBPoEUg== +-----END RSA PRIVATE KEY----- diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/test/ssl-cert-snakeoil.pem b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/test/ssl-cert-snakeoil.pem new file mode 100644 index 0000000..b115a5e --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/test/ssl-cert-snakeoil.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB1TCCAT4CCQDV5mPlzm9+izANBgkqhkiG9w0BAQUFADAvMS0wKwYDVQQDEyQ3 +NTI3YmQ3Ny1hYjNlLTQ3NGItYWNlNy1lZWQ2MDUzOTMxZTcwHhcNMTUwNzA2MjI0 +NTA3WhcNMjUwNzAzMjI0NTA3WjAvMS0wKwYDVQQDEyQ3NTI3YmQ3Ny1hYjNlLTQ3 +NGItYWNlNy1lZWQ2MDUzOTMxZTcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB +ALNRHEirN6vQAIBtf+Ud2yfgZ308sqt/sR4Nh8h1XQdko8PxYOtsHHb98G7Q5bay +OfO/9JVlsnQMC48T+nT55PSpvaoLXSLP2JMPuuJt3uDGGKtVvzJvd8GNezFzxXyn +g3LUty81KoKPBRsmp1GiB+gl5OKo8znzPmw3O6/mKruLAgMBAAEwDQYJKoZIhvcN +AQEFBQADgYEACzoHUF8UV2Z6541Q2wKEA0UFUzmUjf/E1XwBO+1P15ZZ64uw34B4 +1RwMPtAo9RY/PmICTWtNxWGxkzwb2JtDWtnxVER/lF8k2XcXPE76fxTHJF/BKk9J +QU8OTD1dd9gHCBviQB9TqntRZ5X7axjtuWjb2umY+owBYzAHZkp1HKI= +-----END CERTIFICATE----- diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/test/test.js b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/test/test.js new file mode 100644 index 0000000..0f372c0 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/agent-base/test/test.js @@ -0,0 +1,728 @@ +/** + * Module dependencies. + */ + +var fs = require('fs'); +var url = require('url'); +var net = require('net'); +var tls = require('tls'); +var http = require('http'); +var https = require('https'); +var WebSocket = require('ws'); +var assert = require('assert'); +var events = require('events'); +var inherits = require('util').inherits; +var Agent = require('../'); + +var PassthroughAgent = Agent(function(req, opts) { + return opts.secureEndpoint ? https.globalAgent : http.globalAgent; +}); + +describe('Agent', function() { + describe('subclass', function() { + it('should be subclassable', function(done) { + function MyAgent() { + Agent.call(this); + } + inherits(MyAgent, Agent); + + MyAgent.prototype.callback = function(req, opts, fn) { + assert.equal(req.path, '/foo'); + assert.equal(req.getHeader('host'), '127.0.0.1:1234'); + assert.equal(opts.secureEndpoint, true); + done(); + }; + + var info = url.parse('https://127.0.0.1:1234/foo'); + info.agent = new MyAgent(); + https.get(info); + }); + }); + describe('options', function() { + it('should support an options Object as first argument', function() { + var agent = new Agent({ timeout: 1000 }); + assert.equal(1000, agent.timeout); + }); + it('should support an options Object as second argument', function() { + var agent = new Agent(function() {}, { timeout: 1000 }); + assert.equal(1000, agent.timeout); + }); + it('should be mixed in with HTTP request options', function(done) { + var agent = new Agent({ + host: 'my-proxy.com', + port: 3128, + foo: 'bar' + }); + agent.callback = function(req, opts, fn) { + assert.equal('bar', opts.foo); + assert.equal('a', opts.b); + + // `host` and `port` are special-cases, and should always be + // overwritten in the request `opts` inside the agent-base callback + assert.equal('localhost', opts.host); + assert.equal(80, opts.port); + done(); + }; + var opts = { + b: 'a', + agent: agent + }; + http.get(opts); + }); + }); + describe('`this` context', function() { + it('should be the Agent instance', function(done) { + var called = false; + var agent = new Agent(); + agent.callback = function() { + called = true; + assert.equal(this, agent); + }; + var info = url.parse('http://127.0.0.1/foo'); + info.agent = agent; + var req = http.get(info); + req.on('error', function(err) { + assert(/no Duplex stream was returned/.test(err.message)); + done(); + }); + }); + it('should be the Agent instance with callback signature', function(done) { + var called = false; + var agent = new Agent(); + agent.callback = function(req, opts, fn) { + called = true; + assert.equal(this, agent); + fn(); + }; + var info = url.parse('http://127.0.0.1/foo'); + info.agent = agent; + var req = http.get(info); + req.on('error', function(err) { + assert(/no Duplex stream was returned/.test(err.message)); + done(); + }); + }); + }); + describe('"error" event', function() { + it('should be invoked on `http.ClientRequest` instance if `callback()` has not been defined', function( + done + ) { + var agent = new Agent(); + var info = url.parse('http://127.0.0.1/foo'); + info.agent = agent; + var req = http.get(info); + req.on('error', function(err) { + assert.equal( + '"agent-base" has no default implementation, you must subclass and override `callback()`', + err.message + ); + done(); + }); + }); + it('should be invoked on `http.ClientRequest` instance if Error passed to callback function on the first tick', function( + done + ) { + var agent = new Agent(function(req, opts, fn) { + fn(new Error('is this caught?')); + }); + var info = url.parse('http://127.0.0.1/foo'); + info.agent = agent; + var req = http.get(info); + req.on('error', function(err) { + assert.equal('is this caught?', err.message); + done(); + }); + }); + it('should be invoked on `http.ClientRequest` instance if Error passed to callback function after the first tick', function( + done + ) { + var agent = new Agent(function(req, opts, fn) { + setTimeout(function() { + fn(new Error('is this caught?')); + }, 10); + }); + var info = url.parse('http://127.0.0.1/foo'); + info.agent = agent; + var req = http.get(info); + req.on('error', function(err) { + assert.equal('is this caught?', err.message); + done(); + }); + }); + }); + describe('artificial "streams"', function() { + it('should send a GET request', function(done) { + var stream = new events.EventEmitter(); + + // needed for the `http` module to call .write() on the stream + stream.writable = true; + + stream.write = function(str) { + assert(0 == str.indexOf('GET / HTTP/1.1')); + done(); + }; + + // needed for `http` module in Node.js 4 + stream.cork = function() {}; + + var opts = { + method: 'GET', + host: '127.0.0.1', + path: '/', + port: 80, + agent: new Agent(function(req, opts, fn) { + fn(null, stream); + }) + }; + var req = http.request(opts); + req.end(); + }); + it('should receive a GET response', function(done) { + var stream = new events.EventEmitter(); + var opts = { + method: 'GET', + host: '127.0.0.1', + path: '/', + port: 80, + agent: new Agent(function(req, opts, fn) { + fn(null, stream); + }) + }; + var req = http.request(opts, function(res) { + assert.equal('1.0', res.httpVersion); + assert.equal(200, res.statusCode); + assert.equal('bar', res.headers.foo); + assert.deepEqual(['1', '2'], res.headers['set-cookie']); + done(); + }); + + // have to wait for the "socket" event since `http.ClientRequest` + // doesn't *actually* attach the listeners to the "stream" until + // this happens + req.once('socket', function() { + var buf = Buffer.from( + 'HTTP/1.0 200\r\n' + + 'Foo: bar\r\n' + + 'Set-Cookie: 1\r\n' + + 'Set-Cookie: 2\r\n\r\n' + ); + stream.emit('data', buf); + }); + + req.end(); + }); + }); +}); + +describe('"http" module', function() { + var server; + var port; + + // setup test HTTP server + before(function(done) { + server = http.createServer(); + server.listen(0, function() { + port = server.address().port; + done(); + }); + }); + + // shut down test HTTP server + after(function(done) { + server.once('close', function() { + done(); + }); + server.close(); + }); + + it('should work for basic HTTP requests', function(done) { + var called = false; + var agent = new Agent(function(req, opts, fn) { + called = true; + var socket = net.connect(opts); + fn(null, socket); + }); + + // add HTTP server "request" listener + var gotReq = false; + server.once('request', function(req, res) { + gotReq = true; + res.setHeader('X-Foo', 'bar'); + res.setHeader('X-Url', req.url); + res.end(); + }); + + var info = url.parse('http://127.0.0.1:' + port + '/foo'); + info.agent = agent; + http.get(info, function(res) { + assert.equal('bar', res.headers['x-foo']); + assert.equal('/foo', res.headers['x-url']); + assert(gotReq); + assert(called); + done(); + }); + }); + + it('should support direct return in `connect()`', function(done) { + var called = false; + var agent = new Agent(function(req, opts) { + called = true; + return net.connect(opts); + }); + + // add HTTP server "request" listener + var gotReq = false; + server.once('request', function(req, res) { + gotReq = true; + res.setHeader('X-Foo', 'bar'); + res.setHeader('X-Url', req.url); + res.end(); + }); + + var info = url.parse('http://127.0.0.1:' + port + '/foo'); + info.agent = agent; + http.get(info, function(res) { + assert.equal('bar', res.headers['x-foo']); + assert.equal('/foo', res.headers['x-url']); + assert(gotReq); + assert(called); + done(); + }); + }); + + it('should support returning a Promise in `connect()`', function(done) { + var called = false; + var agent = new Agent(function(req, opts) { + return new Promise(function(resolve, reject) { + called = true; + resolve(net.connect(opts)); + }); + }); + + // add HTTP server "request" listener + var gotReq = false; + server.once('request', function(req, res) { + gotReq = true; + res.setHeader('X-Foo', 'bar'); + res.setHeader('X-Url', req.url); + res.end(); + }); + + var info = url.parse('http://127.0.0.1:' + port + '/foo'); + info.agent = agent; + http.get(info, function(res) { + assert.equal('bar', res.headers['x-foo']); + assert.equal('/foo', res.headers['x-url']); + assert(gotReq); + assert(called); + done(); + }); + }); + + it('should set the `Connection: close` response header', function(done) { + var called = false; + var agent = new Agent(function(req, opts, fn) { + called = true; + var socket = net.connect(opts); + fn(null, socket); + }); + + // add HTTP server "request" listener + var gotReq = false; + server.once('request', function(req, res) { + gotReq = true; + res.setHeader('X-Url', req.url); + assert.equal('close', req.headers.connection); + res.end(); + }); + + var info = url.parse('http://127.0.0.1:' + port + '/bar'); + info.agent = agent; + http.get(info, function(res) { + assert.equal('/bar', res.headers['x-url']); + assert.equal('close', res.headers.connection); + assert(gotReq); + assert(called); + done(); + }); + }); + + it('should pass through options from `http.request()`', function(done) { + var agent = new Agent(function(req, opts, fn) { + assert.equal('google.com', opts.host); + assert.equal('bar', opts.foo); + done(); + }); + + http.get({ + host: 'google.com', + foo: 'bar', + agent: agent + }); + }); + + it('should default to port 80', function(done) { + var agent = new Agent(function(req, opts, fn) { + assert.equal(80, opts.port); + done(); + }); + + // (probably) not hitting a real HTTP server here, + // so no need to add a httpServer request listener + http.get({ + host: '127.0.0.1', + path: '/foo', + agent: agent + }); + }); + + it('should support the "timeout" option', function(done) { + // ensure we timeout after the "error" event had a chance to trigger + this.timeout(1000); + this.slow(800); + + var agent = new Agent( + function(req, opts, fn) { + // this function will time out + }, + { timeout: 100 } + ); + + var opts = url.parse('http://nodejs.org'); + opts.agent = agent; + + var req = http.get(opts); + req.once('error', function(err) { + assert.equal('ETIMEOUT', err.code); + req.abort(); + done(); + }); + }); + + it('should free sockets after use', function(done) { + var agent = new Agent(function(req, opts, fn) { + var socket = net.connect(opts); + fn(null, socket); + }); + + // add HTTP server "request" listener + var gotReq = false; + server.once('request', function(req, res) { + gotReq = true; + res.end(); + }); + + var info = url.parse('http://127.0.0.1:' + port + '/foo'); + info.agent = agent; + http.get(info, function(res) { + res.socket.emit('free'); + assert.equal(true, res.socket.destroyed); + assert(gotReq); + done(); + }); + }); + + + describe('PassthroughAgent', function() { + it('should pass through to `http.globalAgent`', function(done) { + // add HTTP server "request" listener + var gotReq = false; + server.once('request', function(req, res) { + gotReq = true; + res.setHeader('X-Foo', 'bar'); + res.setHeader('X-Url', req.url); + res.end(); + }); + + var info = url.parse('http://127.0.0.1:' + port + '/foo'); + info.agent = PassthroughAgent; + http.get(info, function(res) { + assert.equal('bar', res.headers['x-foo']); + assert.equal('/foo', res.headers['x-url']); + assert(gotReq); + done(); + }); + }); + }); +}); + +describe('"https" module', function() { + var server; + var port; + + // setup test HTTPS server + before(function(done) { + var options = { + key: fs.readFileSync(__dirname + '/ssl-cert-snakeoil.key'), + cert: fs.readFileSync(__dirname + '/ssl-cert-snakeoil.pem') + }; + server = https.createServer(options); + server.listen(0, function() { + port = server.address().port; + done(); + }); + }); + + // shut down test HTTP server + after(function(done) { + server.once('close', function() { + done(); + }); + server.close(); + }); + + it('should not modify the passed in Options object', function(done) { + var called = false; + var agent = new Agent(function(req, opts, fn) { + called = true; + assert.equal(true, opts.secureEndpoint); + assert.equal(443, opts.port); + assert.equal('localhost', opts.host); + }); + var opts = { agent: agent }; + var req = https.request(opts); + assert.equal(true, called); + assert.equal(false, 'secureEndpoint' in opts); + assert.equal(false, 'port' in opts); + done(); + }); + + it('should work with a String URL', function(done) { + var endpoint = 'https://127.0.0.1:' + port; + var req = https.get(endpoint); + + // it's gonna error out since `rejectUnauthorized` is not being passed in + req.on('error', function(err) { + assert.equal(err.code, 'DEPTH_ZERO_SELF_SIGNED_CERT'); + done(); + }); + }); + + it('should work for basic HTTPS requests', function(done) { + var called = false; + var agent = new Agent(function(req, opts, fn) { + called = true; + assert(opts.secureEndpoint); + var socket = tls.connect(opts); + fn(null, socket); + }); + + // add HTTPS server "request" listener + var gotReq = false; + server.once('request', function(req, res) { + gotReq = true; + res.setHeader('X-Foo', 'bar'); + res.setHeader('X-Url', req.url); + res.end(); + }); + + var info = url.parse('https://127.0.0.1:' + port + '/foo'); + info.agent = agent; + info.rejectUnauthorized = false; + https.get(info, function(res) { + assert.equal('bar', res.headers['x-foo']); + assert.equal('/foo', res.headers['x-url']); + assert(gotReq); + assert(called); + done(); + }); + }); + + it('should pass through options from `https.request()`', function(done) { + var agent = new Agent(function(req, opts, fn) { + assert.equal('google.com', opts.host); + assert.equal('bar', opts.foo); + done(); + }); + + https.get({ + host: 'google.com', + foo: 'bar', + agent: agent + }); + }); + + it('should support the 3-argument `https.get()`', function(done) { + var agent = new Agent(function(req, opts, fn) { + assert.equal('google.com', opts.host); + assert.equal('/q', opts.pathname || opts.path); + assert.equal('881', opts.port); + assert.equal('bar', opts.foo); + done(); + }); + + https.get( + 'https://google.com:881/q', + { + host: 'google.com', + foo: 'bar', + agent: agent + } + ); + }); + + it('should default to port 443', function(done) { + var agent = new Agent(function(req, opts, fn) { + assert.equal(true, opts.secureEndpoint); + assert.equal(false, opts.rejectUnauthorized); + assert.equal(443, opts.port); + done(); + }); + + // (probably) not hitting a real HTTPS server here, + // so no need to add a httpsServer request listener + https.get({ + host: '127.0.0.1', + path: '/foo', + agent: agent, + rejectUnauthorized: false + }); + }); + + it('should not re-patch https.request', () => { + var patchModulePath = "../patch-core"; + var patchedRequest = https.request; + + delete require.cache[require.resolve(patchModulePath)]; + require(patchModulePath); + + assert.equal(patchedRequest, https.request); + assert.equal(true, https.request.__agent_base_https_request_patched__); + }); + + describe('PassthroughAgent', function() { + it('should pass through to `https.globalAgent`', function(done) { + // add HTTP server "request" listener + var gotReq = false; + server.once('request', function(req, res) { + gotReq = true; + res.setHeader('X-Foo', 'bar'); + res.setHeader('X-Url', req.url); + res.end(); + }); + + var info = url.parse('https://127.0.0.1:' + port + '/foo'); + info.agent = PassthroughAgent; + info.rejectUnauthorized = false; + https.get(info, function(res) { + assert.equal('bar', res.headers['x-foo']); + assert.equal('/foo', res.headers['x-url']); + assert(gotReq); + done(); + }); + }); + }); +}); + +describe('"ws" server', function() { + var wss; + var server; + var port; + + // setup test HTTP server + before(function(done) { + server = http.createServer(); + wss = new WebSocket.Server({ server: server }); + server.listen(0, function() { + port = server.address().port; + done(); + }); + }); + + // shut down test HTTP server + after(function(done) { + server.once('close', function() { + done(); + }); + server.close(); + }); + + it('should work for basic WebSocket connections', function(done) { + function onconnection(ws) { + ws.on('message', function(data) { + assert.equal('ping', data); + ws.send('pong'); + }); + } + wss.on('connection', onconnection); + + var agent = new Agent(function(req, opts, fn) { + var socket = net.connect(opts); + fn(null, socket); + }); + + var client = new WebSocket('ws://127.0.0.1:' + port + '/', { + agent: agent + }); + + client.on('open', function() { + client.send('ping'); + }); + + client.on('message', function(data) { + assert.equal('pong', data); + client.close(); + wss.removeListener('connection', onconnection); + done(); + }); + }); +}); + +describe('"wss" server', function() { + var wss; + var server; + var port; + + // setup test HTTP server + before(function(done) { + var options = { + key: fs.readFileSync(__dirname + '/ssl-cert-snakeoil.key'), + cert: fs.readFileSync(__dirname + '/ssl-cert-snakeoil.pem') + }; + server = https.createServer(options); + wss = new WebSocket.Server({ server: server }); + server.listen(0, function() { + port = server.address().port; + done(); + }); + }); + + // shut down test HTTP server + after(function(done) { + server.once('close', function() { + done(); + }); + server.close(); + }); + + it('should work for secure WebSocket connections', function(done) { + function onconnection(ws) { + ws.on('message', function(data) { + assert.equal('ping', data); + ws.send('pong'); + }); + } + wss.on('connection', onconnection); + + var agent = new Agent(function(req, opts, fn) { + var socket = tls.connect(opts); + fn(null, socket); + }); + + var client = new WebSocket('wss://127.0.0.1:' + port + '/', { + agent: agent, + rejectUnauthorized: false + }); + + client.on('open', function() { + client.send('ping'); + }); + + client.on('message', function(data) { + assert.equal('pong', data); + client.close(); + wss.removeListener('connection', onconnection); + done(); + }); + }); +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/CHANGELOG.md b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/CHANGELOG.md new file mode 100644 index 0000000..a43c628 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/CHANGELOG.md @@ -0,0 +1,185 @@ +1.0.10 / 2018-02-15 +------------------ + +- Use .concat instead of + for arrays, #122. + + +1.0.9 / 2016-09-29 +------------------ + +- Rerelease after 1.0.8 - deps cleanup. + + +1.0.8 / 2016-09-29 +------------------ + +- Maintenance (deps bump, fix node 6.5+ tests, coverage report). + + +1.0.7 / 2016-03-17 +------------------ + +- Teach `addArgument` to accept string arg names. #97, @tomxtobin. + + +1.0.6 / 2016-02-06 +------------------ + +- Maintenance: moved to eslint & updated CS. + + +1.0.5 / 2016-02-05 +------------------ + +- Removed lodash dependency to significantly reduce install size. + Thanks to @mourner. + + +1.0.4 / 2016-01-17 +------------------ + +- Maintenance: lodash update to 4.0.0. + + +1.0.3 / 2015-10-27 +------------------ + +- Fix parse `=` in args: `--examplepath="C:\myfolder\env=x64"`. #84, @CatWithApple. + + +1.0.2 / 2015-03-22 +------------------ + +- Relaxed lodash version dependency. + + +1.0.1 / 2015-02-20 +------------------ + +- Changed dependencies to be compatible with ancient nodejs. + + +1.0.0 / 2015-02-19 +------------------ + +- Maintenance release. +- Replaced `underscore` with `lodash`. +- Bumped version to 1.0.0 to better reflect semver meaning. +- HISTORY.md -> CHANGELOG.md + + +0.1.16 / 2013-12-01 +------------------- + +- Maintenance release. Updated dependencies and docs. + + +0.1.15 / 2013-05-13 +------------------- + +- Fixed #55, @trebor89 + + +0.1.14 / 2013-05-12 +------------------- + +- Fixed #62, @maxtaco + + +0.1.13 / 2013-04-08 +------------------- + +- Added `.npmignore` to reduce package size + + +0.1.12 / 2013-02-10 +------------------- + +- Fixed conflictHandler (#46), @hpaulj + + +0.1.11 / 2013-02-07 +------------------- + +- Multiple bugfixes, @hpaulj +- Added 70+ tests (ported from python), @hpaulj +- Added conflictHandler, @applepicke +- Added fromfilePrefixChar, @hpaulj + + +0.1.10 / 2012-12-30 +------------------- + +- Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion) + support, thanks to @hpaulj +- Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj + + +0.1.9 / 2012-12-27 +------------------ + +- Fixed option dest interferens with other options (issue #23), thanks to @hpaulj +- Fixed default value behavior with `*` positionals, thanks to @hpaulj +- Improve `getDefault()` behavior, thanks to @hpaulj +- Imrove negative argument parsing, thanks to @hpaulj + + +0.1.8 / 2012-12-01 +------------------ + +- Fixed parser parents (issue #19), thanks to @hpaulj +- Fixed negative argument parse (issue #20), thanks to @hpaulj + + +0.1.7 / 2012-10-14 +------------------ + +- Fixed 'choices' argument parse (issue #16) +- Fixed stderr output (issue #15) + + +0.1.6 / 2012-09-09 +------------------ + +- Fixed check for conflict of options (thanks to @tomxtobin) + + +0.1.5 / 2012-09-03 +------------------ + +- Fix parser #setDefaults method (thanks to @tomxtobin) + + +0.1.4 / 2012-07-30 +------------------ + +- Fixed pseudo-argument support (thanks to @CGamesPlay) +- Fixed addHelp default (should be true), if not set (thanks to @benblank) + + +0.1.3 / 2012-06-27 +------------------ + +- Fixed formatter api name: Formatter -> HelpFormatter + + +0.1.2 / 2012-05-29 +------------------ + +- Added basic tests +- Removed excess whitespace in help +- Fixed error reporting, when parcer with subcommands + called with empty arguments + + +0.1.1 / 2012-05-23 +------------------ + +- Fixed line wrapping in help formatter +- Added better error reporting on invalid arguments + + +0.1.0 / 2012-05-16 +------------------ + +- First release. diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/LICENSE b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/LICENSE new file mode 100644 index 0000000..1afdae5 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (C) 2012 by Vitaly Puzrin + +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/coc/extensions/node_modules/coc-yaml/node_modules/argparse/README.md b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/README.md new file mode 100644 index 0000000..7fa6c40 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/README.md @@ -0,0 +1,257 @@ +argparse +======== + +[![Build Status](https://secure.travis-ci.org/nodeca/argparse.svg?branch=master)](http://travis-ci.org/nodeca/argparse) +[![NPM version](https://img.shields.io/npm/v/argparse.svg)](https://www.npmjs.org/package/argparse) + +CLI arguments parser for node.js. Javascript port of python's +[argparse](http://docs.python.org/dev/library/argparse.html) module +(original version 3.2). That's a full port, except some very rare options, +recorded in issue tracker. + +**NB. Difference with original.** + +- Method names changed to camelCase. See [generated docs](http://nodeca.github.com/argparse/). +- Use `defaultValue` instead of `default`. +- Use `argparse.Const.REMAINDER` instead of `argparse.REMAINDER`, and + similarly for constant values `OPTIONAL`, `ZERO_OR_MORE`, and `ONE_OR_MORE` + (aliases for `nargs` values `'?'`, `'*'`, `'+'`, respectively), and + `SUPPRESS`. + + +Example +======= + +test.js file: + +```javascript +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp:true, + description: 'Argparse example' +}); +parser.addArgument( + [ '-f', '--foo' ], + { + help: 'foo bar' + } +); +parser.addArgument( + [ '-b', '--bar' ], + { + help: 'bar foo' + } +); +parser.addArgument( + '--baz', + { + help: 'baz bar' + } +); +var args = parser.parseArgs(); +console.dir(args); +``` + +Display help: + +``` +$ ./test.js -h +usage: example.js [-h] [-v] [-f FOO] [-b BAR] [--baz BAZ] + +Argparse example + +Optional arguments: + -h, --help Show this help message and exit. + -v, --version Show program's version number and exit. + -f FOO, --foo FOO foo bar + -b BAR, --bar BAR bar foo + --baz BAZ baz bar +``` + +Parse arguments: + +``` +$ ./test.js -f=3 --bar=4 --baz 5 +{ foo: '3', bar: '4', baz: '5' } +``` + +More [examples](https://github.com/nodeca/argparse/tree/master/examples). + + +ArgumentParser objects +====================== + +``` +new ArgumentParser({parameters hash}); +``` + +Creates a new ArgumentParser object. + +**Supported params:** + +- ```description``` - Text to display before the argument help. +- ```epilog``` - Text to display after the argument help. +- ```addHelp``` - Add a -h/–help option to the parser. (default: true) +- ```argumentDefault``` - Set the global default value for arguments. (default: null) +- ```parents``` - A list of ArgumentParser objects whose arguments should also be included. +- ```prefixChars``` - The set of characters that prefix optional arguments. (default: ‘-‘) +- ```formatterClass``` - A class for customizing the help output. +- ```prog``` - The name of the program (default: `path.basename(process.argv[1])`) +- ```usage``` - The string describing the program usage (default: generated) +- ```conflictHandler``` - Usually unnecessary, defines strategy for resolving conflicting optionals. + +**Not supported yet** + +- ```fromfilePrefixChars``` - The set of characters that prefix files from which additional arguments should be read. + + +Details in [original ArgumentParser guide](http://docs.python.org/dev/library/argparse.html#argumentparser-objects) + + +addArgument() method +==================== + +``` +ArgumentParser.addArgument(name or flag or [name] or [flags...], {options}) +``` + +Defines how a single command-line argument should be parsed. + +- ```name or flag or [name] or [flags...]``` - Either a positional name + (e.g., `'foo'`), a single option (e.g., `'-f'` or `'--foo'`), an array + of a single positional name (e.g., `['foo']`), or an array of options + (e.g., `['-f', '--foo']`). + +Options: + +- ```action``` - The basic type of action to be taken when this argument is encountered at the command line. +- ```nargs```- The number of command-line arguments that should be consumed. +- ```constant``` - A constant value required by some action and nargs selections. +- ```defaultValue``` - The value produced if the argument is absent from the command line. +- ```type``` - The type to which the command-line argument should be converted. +- ```choices``` - A container of the allowable values for the argument. +- ```required``` - Whether or not the command-line option may be omitted (optionals only). +- ```help``` - A brief description of what the argument does. +- ```metavar``` - A name for the argument in usage messages. +- ```dest``` - The name of the attribute to be added to the object returned by parseArgs(). + +Details in [original add_argument guide](http://docs.python.org/dev/library/argparse.html#the-add-argument-method) + + +Action (some details) +================ + +ArgumentParser objects associate command-line arguments with actions. +These actions can do just about anything with the command-line arguments associated +with them, though most actions simply add an attribute to the object returned by +parseArgs(). The action keyword argument specifies how the command-line arguments +should be handled. The supported actions are: + +- ```store``` - Just stores the argument’s value. This is the default action. +- ```storeConst``` - Stores value, specified by the const keyword argument. + (Note that the const keyword argument defaults to the rather unhelpful None.) + The 'storeConst' action is most commonly used with optional arguments, that + specify some sort of flag. +- ```storeTrue``` and ```storeFalse``` - Stores values True and False + respectively. These are special cases of 'storeConst'. +- ```append``` - Stores a list, and appends each argument value to the list. + This is useful to allow an option to be specified multiple times. +- ```appendConst``` - Stores a list, and appends value, specified by the + const keyword argument to the list. (Note, that the const keyword argument defaults + is None.) The 'appendConst' action is typically used when multiple arguments need + to store constants to the same list. +- ```count``` - Counts the number of times a keyword argument occurs. For example, + used for increasing verbosity levels. +- ```help``` - Prints a complete help message for all the options in the current + parser and then exits. By default a help action is automatically added to the parser. + See ArgumentParser for details of how the output is created. +- ```version``` - Prints version information and exit. Expects a `version=` + keyword argument in the addArgument() call. + +Details in [original action guide](http://docs.python.org/dev/library/argparse.html#action) + + +Sub-commands +============ + +ArgumentParser.addSubparsers() + +Many programs split their functionality into a number of sub-commands, for +example, the svn program can invoke sub-commands like `svn checkout`, `svn update`, +and `svn commit`. Splitting up functionality this way can be a particularly good +idea when a program performs several different functions which require different +kinds of command-line arguments. `ArgumentParser` supports creation of such +sub-commands with `addSubparsers()` method. The `addSubparsers()` method is +normally called with no arguments and returns an special action object. +This object has a single method `addParser()`, which takes a command name and +any `ArgumentParser` constructor arguments, and returns an `ArgumentParser` object +that can be modified as usual. + +Example: + +sub_commands.js +```javascript +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp:true, + description: 'Argparse examples: sub-commands', +}); + +var subparsers = parser.addSubparsers({ + title:'subcommands', + dest:"subcommand_name" +}); + +var bar = subparsers.addParser('c1', {addHelp:true}); +bar.addArgument( + [ '-f', '--foo' ], + { + action: 'store', + help: 'foo3 bar3' + } +); +var bar = subparsers.addParser( + 'c2', + {aliases:['co'], addHelp:true} +); +bar.addArgument( + [ '-b', '--bar' ], + { + action: 'store', + type: 'int', + help: 'foo3 bar3' + } +); + +var args = parser.parseArgs(); +console.dir(args); + +``` + +Details in [original sub-commands guide](http://docs.python.org/dev/library/argparse.html#sub-commands) + + +Contributors +============ + +- [Eugene Shkuropat](https://github.com/shkuropat) +- [Paul Jacobson](https://github.com/hpaulj) + +[others](https://github.com/nodeca/argparse/graphs/contributors) + +License +======= + +Copyright (c) 2012 [Vitaly Puzrin](https://github.com/puzrin). +Released under the MIT license. See +[LICENSE](https://github.com/nodeca/argparse/blob/master/LICENSE) for details. + + diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/index.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/index.js new file mode 100644 index 0000000..3bbc143 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/argparse'); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action.js new file mode 100644 index 0000000..1483c79 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action.js @@ -0,0 +1,146 @@ +/** + * class Action + * + * Base class for all actions + * Do not call in your code, use this class only for inherits your own action + * + * Information about how to convert command line strings to Javascript objects. + * Action objects are used by an ArgumentParser to represent the information + * needed to parse a single argument from one or more strings from the command + * line. The keyword arguments to the Action constructor are also all attributes + * of Action instances. + * + * ##### Allowed keywords: + * + * - `store` + * - `storeConstant` + * - `storeTrue` + * - `storeFalse` + * - `append` + * - `appendConstant` + * - `count` + * - `help` + * - `version` + * + * Information about action options see [[Action.new]] + * + * See also [original guide](http://docs.python.org/dev/library/argparse.html#action) + * + **/ + +'use strict'; + + +// Constants +var c = require('./const'); + + +/** + * new Action(options) + * + * Base class for all actions. Used only for inherits + * + * + * ##### Options: + * + * - `optionStrings` A list of command-line option strings for the action. + * - `dest` Attribute to hold the created object(s) + * - `nargs` The number of command-line arguments that should be consumed. + * By default, one argument will be consumed and a single value will be + * produced. + * - `constant` Default value for an action with no value. + * - `defaultValue` The value to be produced if the option is not specified. + * - `type` Cast to 'string'|'int'|'float'|'complex'|function (string). If + * None, 'string'. + * - `choices` The choices available. + * - `required` True if the action must always be specified at the command + * line. + * - `help` The help describing the argument. + * - `metavar` The name to be used for the option's argument with the help + * string. If None, the 'dest' value will be used as the name. + * + * ##### nargs supported values: + * + * - `N` (an integer) consumes N arguments (and produces a list) + * - `?` consumes zero or one arguments + * - `*` consumes zero or more arguments (and produces a list) + * - `+` consumes one or more arguments (and produces a list) + * + * Note: that the difference between the default and nargs=1 is that with the + * default, a single value will be produced, while with nargs=1, a list + * containing a single value will be produced. + **/ +var Action = module.exports = function Action(options) { + options = options || {}; + this.optionStrings = options.optionStrings || []; + this.dest = options.dest; + this.nargs = typeof options.nargs !== 'undefined' ? options.nargs : null; + this.constant = typeof options.constant !== 'undefined' ? options.constant : null; + this.defaultValue = options.defaultValue; + this.type = typeof options.type !== 'undefined' ? options.type : null; + this.choices = typeof options.choices !== 'undefined' ? options.choices : null; + this.required = typeof options.required !== 'undefined' ? options.required : false; + this.help = typeof options.help !== 'undefined' ? options.help : null; + this.metavar = typeof options.metavar !== 'undefined' ? options.metavar : null; + + if (!(this.optionStrings instanceof Array)) { + throw new Error('optionStrings should be an array'); + } + if (typeof this.required !== 'undefined' && typeof this.required !== 'boolean') { + throw new Error('required should be a boolean'); + } +}; + +/** + * Action#getName -> String + * + * Tells action name + **/ +Action.prototype.getName = function () { + if (this.optionStrings.length > 0) { + return this.optionStrings.join('/'); + } else if (this.metavar !== null && this.metavar !== c.SUPPRESS) { + return this.metavar; + } else if (typeof this.dest !== 'undefined' && this.dest !== c.SUPPRESS) { + return this.dest; + } + return null; +}; + +/** + * Action#isOptional -> Boolean + * + * Return true if optional + **/ +Action.prototype.isOptional = function () { + return !this.isPositional(); +}; + +/** + * Action#isPositional -> Boolean + * + * Return true if positional + **/ +Action.prototype.isPositional = function () { + return (this.optionStrings.length === 0); +}; + +/** + * Action#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Should be implemented in inherited classes + * + * ##### Example + * + * ActionCount.prototype.call = function (parser, namespace, values, optionString) { + * namespace.set(this.dest, (namespace[this.dest] || 0) + 1); + * }; + * + **/ +Action.prototype.call = function () { + throw new Error('.call() not defined');// Not Implemented error +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/append.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/append.js new file mode 100644 index 0000000..b5da0de --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/append.js @@ -0,0 +1,53 @@ +/*:nodoc:* + * class ActionAppend + * + * This action stores a list, and appends each argument value to the list. + * This is useful to allow an option to be specified multiple times. + * This class inherided from [[Action]] + * + **/ + +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +// Constants +var c = require('../const'); + +/*:nodoc:* + * new ActionAppend(options) + * - options (object): options hash see [[Action.new]] + * + * Note: options.nargs should be optional for constants + * and more then zero for other + **/ +var ActionAppend = module.exports = function ActionAppend(options) { + options = options || {}; + if (this.nargs <= 0) { + throw new Error('nargs for append actions must be > 0; if arg ' + + 'strings are not supplying the value to append, ' + + 'the append const action may be more appropriate'); + } + if (!!this.constant && this.nargs !== c.OPTIONAL) { + throw new Error('nargs must be OPTIONAL to supply const'); + } + Action.call(this, options); +}; +util.inherits(ActionAppend, Action); + +/*:nodoc:* + * ActionAppend#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionAppend.prototype.call = function (parser, namespace, values) { + var items = (namespace[this.dest] || []).slice(); + items.push(values); + namespace.set(this.dest, items); +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/append/constant.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/append/constant.js new file mode 100644 index 0000000..313f5d2 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/append/constant.js @@ -0,0 +1,47 @@ +/*:nodoc:* + * class ActionAppendConstant + * + * This stores a list, and appends the value specified by + * the const keyword argument to the list. + * (Note that the const keyword argument defaults to null.) + * The 'appendConst' action is typically useful when multiple + * arguments need to store constants to the same list. + * + * This class inherited from [[Action]] + **/ + +'use strict'; + +var util = require('util'); + +var Action = require('../../action'); + +/*:nodoc:* + * new ActionAppendConstant(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionAppendConstant = module.exports = function ActionAppendConstant(options) { + options = options || {}; + options.nargs = 0; + if (typeof options.constant === 'undefined') { + throw new Error('constant option is required for appendAction'); + } + Action.call(this, options); +}; +util.inherits(ActionAppendConstant, Action); + +/*:nodoc:* + * ActionAppendConstant#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionAppendConstant.prototype.call = function (parser, namespace) { + var items = [].concat(namespace[this.dest] || []); + items.push(this.constant); + namespace.set(this.dest, items); +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/count.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/count.js new file mode 100644 index 0000000..d6a5899 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/count.js @@ -0,0 +1,40 @@ +/*:nodoc:* + * class ActionCount + * + * This counts the number of times a keyword argument occurs. + * For example, this is useful for increasing verbosity levels + * + * This class inherided from [[Action]] + * + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +/*:nodoc:* + * new ActionCount(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionCount = module.exports = function ActionCount(options) { + options = options || {}; + options.nargs = 0; + + Action.call(this, options); +}; +util.inherits(ActionCount, Action); + +/*:nodoc:* + * ActionCount#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionCount.prototype.call = function (parser, namespace) { + namespace.set(this.dest, (namespace[this.dest] || 0) + 1); +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/help.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/help.js new file mode 100644 index 0000000..b40e05a --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/help.js @@ -0,0 +1,47 @@ +/*:nodoc:* + * class ActionHelp + * + * Support action for printing help + * This class inherided from [[Action]] + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +// Constants +var c = require('../const'); + +/*:nodoc:* + * new ActionHelp(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionHelp = module.exports = function ActionHelp(options) { + options = options || {}; + if (options.defaultValue !== null) { + options.defaultValue = options.defaultValue; + } else { + options.defaultValue = c.SUPPRESS; + } + options.dest = (options.dest !== null ? options.dest : c.SUPPRESS); + options.nargs = 0; + Action.call(this, options); + +}; +util.inherits(ActionHelp, Action); + +/*:nodoc:* + * ActionHelp#call(parser, namespace, values, optionString) + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Print help and exit + **/ +ActionHelp.prototype.call = function (parser) { + parser.printHelp(); + parser.exit(); +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store.js new file mode 100644 index 0000000..283b860 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store.js @@ -0,0 +1,50 @@ +/*:nodoc:* + * class ActionStore + * + * This action just stores the argument’s value. This is the default action. + * + * This class inherited from [[Action]] + * + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +// Constants +var c = require('../const'); + + +/*:nodoc:* + * new ActionStore(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionStore = module.exports = function ActionStore(options) { + options = options || {}; + if (this.nargs <= 0) { + throw new Error('nargs for store actions must be > 0; if you ' + + 'have nothing to store, actions such as store ' + + 'true or store const may be more appropriate'); + + } + if (typeof this.constant !== 'undefined' && this.nargs !== c.OPTIONAL) { + throw new Error('nargs must be OPTIONAL to supply const'); + } + Action.call(this, options); +}; +util.inherits(ActionStore, Action); + +/*:nodoc:* + * ActionStore#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionStore.prototype.call = function (parser, namespace, values) { + namespace.set(this.dest, values); +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store/constant.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store/constant.js new file mode 100644 index 0000000..23caa89 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store/constant.js @@ -0,0 +1,43 @@ +/*:nodoc:* + * class ActionStoreConstant + * + * This action stores the value specified by the const keyword argument. + * (Note that the const keyword argument defaults to the rather unhelpful null.) + * The 'store_const' action is most commonly used with optional + * arguments that specify some sort of flag. + * + * This class inherited from [[Action]] + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../../action'); + +/*:nodoc:* + * new ActionStoreConstant(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionStoreConstant = module.exports = function ActionStoreConstant(options) { + options = options || {}; + options.nargs = 0; + if (typeof options.constant === 'undefined') { + throw new Error('constant option is required for storeAction'); + } + Action.call(this, options); +}; +util.inherits(ActionStoreConstant, Action); + +/*:nodoc:* + * ActionStoreConstant#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionStoreConstant.prototype.call = function (parser, namespace) { + namespace.set(this.dest, this.constant); +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store/false.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store/false.js new file mode 100644 index 0000000..9924f46 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store/false.js @@ -0,0 +1,27 @@ +/*:nodoc:* + * class ActionStoreFalse + * + * This action store the values False respectively. + * This is special cases of 'storeConst' + * + * This class inherited from [[Action]] + **/ + +'use strict'; + +var util = require('util'); + +var ActionStoreConstant = require('./constant'); + +/*:nodoc:* + * new ActionStoreFalse(options) + * - options (object): hash of options see [[Action.new]] + * + **/ +var ActionStoreFalse = module.exports = function ActionStoreFalse(options) { + options = options || {}; + options.constant = false; + options.defaultValue = options.defaultValue !== null ? options.defaultValue : true; + ActionStoreConstant.call(this, options); +}; +util.inherits(ActionStoreFalse, ActionStoreConstant); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store/true.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store/true.js new file mode 100644 index 0000000..9e22f7d --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/store/true.js @@ -0,0 +1,26 @@ +/*:nodoc:* + * class ActionStoreTrue + * + * This action store the values True respectively. + * This isspecial cases of 'storeConst' + * + * This class inherited from [[Action]] + **/ +'use strict'; + +var util = require('util'); + +var ActionStoreConstant = require('./constant'); + +/*:nodoc:* + * new ActionStoreTrue(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionStoreTrue = module.exports = function ActionStoreTrue(options) { + options = options || {}; + options.constant = true; + options.defaultValue = options.defaultValue !== null ? options.defaultValue : false; + ActionStoreConstant.call(this, options); +}; +util.inherits(ActionStoreTrue, ActionStoreConstant); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/subparsers.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/subparsers.js new file mode 100644 index 0000000..99dfedd --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/subparsers.js @@ -0,0 +1,149 @@ +/** internal + * class ActionSubparsers + * + * Support the creation of such sub-commands with the addSubparsers() + * + * This class inherited from [[Action]] + **/ +'use strict'; + +var util = require('util'); +var format = require('util').format; + + +var Action = require('../action'); + +// Constants +var c = require('../const'); + +// Errors +var argumentErrorHelper = require('../argument/error'); + + +/*:nodoc:* + * new ChoicesPseudoAction(name, help) + * + * Create pseudo action for correct help text + * + **/ +function ChoicesPseudoAction(name, help) { + var options = { + optionStrings: [], + dest: name, + help: help + }; + + Action.call(this, options); +} + +util.inherits(ChoicesPseudoAction, Action); + +/** + * new ActionSubparsers(options) + * - options (object): options hash see [[Action.new]] + * + **/ +function ActionSubparsers(options) { + options = options || {}; + options.dest = options.dest || c.SUPPRESS; + options.nargs = c.PARSER; + + this.debug = (options.debug === true); + + this._progPrefix = options.prog; + this._parserClass = options.parserClass; + this._nameParserMap = {}; + this._choicesActions = []; + + options.choices = this._nameParserMap; + Action.call(this, options); +} + +util.inherits(ActionSubparsers, Action); + +/*:nodoc:* + * ActionSubparsers#addParser(name, options) -> ArgumentParser + * - name (string): sub-command name + * - options (object): see [[ArgumentParser.new]] + * + * Note: + * addParser supports an additional aliases option, + * which allows multiple strings to refer to the same subparser. + * This example, like svn, aliases co as a shorthand for checkout + * + **/ +ActionSubparsers.prototype.addParser = function (name, options) { + var parser; + + var self = this; + + options = options || {}; + + options.debug = (this.debug === true); + + // set program from the existing prefix + if (!options.prog) { + options.prog = this._progPrefix + ' ' + name; + } + + var aliases = options.aliases || []; + + // create a pseudo-action to hold the choice help + if (!!options.help || typeof options.help === 'string') { + var help = options.help; + delete options.help; + + var choiceAction = new ChoicesPseudoAction(name, help); + this._choicesActions.push(choiceAction); + } + + // create the parser and add it to the map + parser = new this._parserClass(options); + this._nameParserMap[name] = parser; + + // make parser available under aliases also + aliases.forEach(function (alias) { + self._nameParserMap[alias] = parser; + }); + + return parser; +}; + +ActionSubparsers.prototype._getSubactions = function () { + return this._choicesActions; +}; + +/*:nodoc:* + * ActionSubparsers#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Parse input aguments + **/ +ActionSubparsers.prototype.call = function (parser, namespace, values) { + var parserName = values[0]; + var argStrings = values.slice(1); + + // set the parser name if requested + if (this.dest !== c.SUPPRESS) { + namespace[this.dest] = parserName; + } + + // select the parser + if (this._nameParserMap[parserName]) { + parser = this._nameParserMap[parserName]; + } else { + throw argumentErrorHelper(format( + 'Unknown parser "%s" (choices: [%s]).', + parserName, + Object.keys(this._nameParserMap).join(', ') + )); + } + + // parse all the remaining options into the namespace + parser.parseArgs(argStrings, namespace); +}; + +module.exports = ActionSubparsers; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/version.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/version.js new file mode 100644 index 0000000..8053328 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action/version.js @@ -0,0 +1,47 @@ +/*:nodoc:* + * class ActionVersion + * + * Support action for printing program version + * This class inherited from [[Action]] + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +// +// Constants +// +var c = require('../const'); + +/*:nodoc:* + * new ActionVersion(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionVersion = module.exports = function ActionVersion(options) { + options = options || {}; + options.defaultValue = (options.defaultValue ? options.defaultValue : c.SUPPRESS); + options.dest = (options.dest || c.SUPPRESS); + options.nargs = 0; + this.version = options.version; + Action.call(this, options); +}; +util.inherits(ActionVersion, Action); + +/*:nodoc:* + * ActionVersion#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Print version and exit + **/ +ActionVersion.prototype.call = function (parser) { + var version = this.version || parser.version; + var formatter = parser._getFormatter(); + formatter.addText(version); + parser.exit(0, formatter.formatHelp()); +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action_container.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action_container.js new file mode 100644 index 0000000..6f1237b --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/action_container.js @@ -0,0 +1,482 @@ +/** internal + * class ActionContainer + * + * Action container. Parent for [[ArgumentParser]] and [[ArgumentGroup]] + **/ + +'use strict'; + +var format = require('util').format; + +// Constants +var c = require('./const'); + +var $$ = require('./utils'); + +//Actions +var ActionHelp = require('./action/help'); +var ActionAppend = require('./action/append'); +var ActionAppendConstant = require('./action/append/constant'); +var ActionCount = require('./action/count'); +var ActionStore = require('./action/store'); +var ActionStoreConstant = require('./action/store/constant'); +var ActionStoreTrue = require('./action/store/true'); +var ActionStoreFalse = require('./action/store/false'); +var ActionVersion = require('./action/version'); +var ActionSubparsers = require('./action/subparsers'); + +// Errors +var argumentErrorHelper = require('./argument/error'); + +/** + * new ActionContainer(options) + * + * Action container. Parent for [[ArgumentParser]] and [[ArgumentGroup]] + * + * ##### Options: + * + * - `description` -- A description of what the program does + * - `prefixChars` -- Characters that prefix optional arguments + * - `argumentDefault` -- The default value for all arguments + * - `conflictHandler` -- The conflict handler to use for duplicate arguments + **/ +var ActionContainer = module.exports = function ActionContainer(options) { + options = options || {}; + + this.description = options.description; + this.argumentDefault = options.argumentDefault; + this.prefixChars = options.prefixChars || ''; + this.conflictHandler = options.conflictHandler; + + // set up registries + this._registries = {}; + + // register actions + this.register('action', null, ActionStore); + this.register('action', 'store', ActionStore); + this.register('action', 'storeConst', ActionStoreConstant); + this.register('action', 'storeTrue', ActionStoreTrue); + this.register('action', 'storeFalse', ActionStoreFalse); + this.register('action', 'append', ActionAppend); + this.register('action', 'appendConst', ActionAppendConstant); + this.register('action', 'count', ActionCount); + this.register('action', 'help', ActionHelp); + this.register('action', 'version', ActionVersion); + this.register('action', 'parsers', ActionSubparsers); + + // raise an exception if the conflict handler is invalid + this._getHandler(); + + // action storage + this._actions = []; + this._optionStringActions = {}; + + // groups + this._actionGroups = []; + this._mutuallyExclusiveGroups = []; + + // defaults storage + this._defaults = {}; + + // determines whether an "option" looks like a negative number + // -1, -1.5 -5e+4 + this._regexpNegativeNumber = new RegExp('^[-]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$'); + + // whether or not there are any optionals that look like negative + // numbers -- uses a list so it can be shared and edited + this._hasNegativeNumberOptionals = []; +}; + +// Groups must be required, then ActionContainer already defined +var ArgumentGroup = require('./argument/group'); +var MutuallyExclusiveGroup = require('./argument/exclusive'); + +// +// Registration methods +// + +/** + * ActionContainer#register(registryName, value, object) -> Void + * - registryName (String) : object type action|type + * - value (string) : keyword + * - object (Object|Function) : handler + * + * Register handlers + **/ +ActionContainer.prototype.register = function (registryName, value, object) { + this._registries[registryName] = this._registries[registryName] || {}; + this._registries[registryName][value] = object; +}; + +ActionContainer.prototype._registryGet = function (registryName, value, defaultValue) { + if (arguments.length < 3) { + defaultValue = null; + } + return this._registries[registryName][value] || defaultValue; +}; + +// +// Namespace default accessor methods +// + +/** + * ActionContainer#setDefaults(options) -> Void + * - options (object):hash of options see [[Action.new]] + * + * Set defaults + **/ +ActionContainer.prototype.setDefaults = function (options) { + options = options || {}; + for (var property in options) { + if ($$.has(options, property)) { + this._defaults[property] = options[property]; + } + } + + // if these defaults match any existing arguments, replace the previous + // default on the object with the new one + this._actions.forEach(function (action) { + if ($$.has(options, action.dest)) { + action.defaultValue = options[action.dest]; + } + }); +}; + +/** + * ActionContainer#getDefault(dest) -> Mixed + * - dest (string): action destination + * + * Return action default value + **/ +ActionContainer.prototype.getDefault = function (dest) { + var result = $$.has(this._defaults, dest) ? this._defaults[dest] : null; + + this._actions.forEach(function (action) { + if (action.dest === dest && $$.has(action, 'defaultValue')) { + result = action.defaultValue; + } + }); + + return result; +}; +// +// Adding argument actions +// + +/** + * ActionContainer#addArgument(args, options) -> Object + * - args (String|Array): argument key, or array of argument keys + * - options (Object): action objects see [[Action.new]] + * + * #### Examples + * - addArgument([ '-f', '--foo' ], { action: 'store', defaultValue: 1, ... }) + * - addArgument([ 'bar' ], { action: 'store', nargs: 1, ... }) + * - addArgument('--baz', { action: 'store', nargs: 1, ... }) + **/ +ActionContainer.prototype.addArgument = function (args, options) { + args = args; + options = options || {}; + + if (typeof args === 'string') { + args = [ args ]; + } + if (!Array.isArray(args)) { + throw new TypeError('addArgument first argument should be a string or an array'); + } + if (typeof options !== 'object' || Array.isArray(options)) { + throw new TypeError('addArgument second argument should be a hash'); + } + + // if no positional args are supplied or only one is supplied and + // it doesn't look like an option string, parse a positional argument + if (!args || args.length === 1 && this.prefixChars.indexOf(args[0][0]) < 0) { + if (args && !!options.dest) { + throw new Error('dest supplied twice for positional argument'); + } + options = this._getPositional(args, options); + + // otherwise, we're adding an optional argument + } else { + options = this._getOptional(args, options); + } + + // if no default was supplied, use the parser-level default + if (typeof options.defaultValue === 'undefined') { + var dest = options.dest; + if ($$.has(this._defaults, dest)) { + options.defaultValue = this._defaults[dest]; + } else if (typeof this.argumentDefault !== 'undefined') { + options.defaultValue = this.argumentDefault; + } + } + + // create the action object, and add it to the parser + var ActionClass = this._popActionClass(options); + if (typeof ActionClass !== 'function') { + throw new Error(format('Unknown action "%s".', ActionClass)); + } + var action = new ActionClass(options); + + // throw an error if the action type is not callable + var typeFunction = this._registryGet('type', action.type, action.type); + if (typeof typeFunction !== 'function') { + throw new Error(format('"%s" is not callable', typeFunction)); + } + + return this._addAction(action); +}; + +/** + * ActionContainer#addArgumentGroup(options) -> ArgumentGroup + * - options (Object): hash of options see [[ArgumentGroup.new]] + * + * Create new arguments groups + **/ +ActionContainer.prototype.addArgumentGroup = function (options) { + var group = new ArgumentGroup(this, options); + this._actionGroups.push(group); + return group; +}; + +/** + * ActionContainer#addMutuallyExclusiveGroup(options) -> ArgumentGroup + * - options (Object): {required: false} + * + * Create new mutual exclusive groups + **/ +ActionContainer.prototype.addMutuallyExclusiveGroup = function (options) { + var group = new MutuallyExclusiveGroup(this, options); + this._mutuallyExclusiveGroups.push(group); + return group; +}; + +ActionContainer.prototype._addAction = function (action) { + var self = this; + + // resolve any conflicts + this._checkConflict(action); + + // add to actions list + this._actions.push(action); + action.container = this; + + // index the action by any option strings it has + action.optionStrings.forEach(function (optionString) { + self._optionStringActions[optionString] = action; + }); + + // set the flag if any option strings look like negative numbers + action.optionStrings.forEach(function (optionString) { + if (optionString.match(self._regexpNegativeNumber)) { + if (!self._hasNegativeNumberOptionals.some(Boolean)) { + self._hasNegativeNumberOptionals.push(true); + } + } + }); + + // return the created action + return action; +}; + +ActionContainer.prototype._removeAction = function (action) { + var actionIndex = this._actions.indexOf(action); + if (actionIndex >= 0) { + this._actions.splice(actionIndex, 1); + } +}; + +ActionContainer.prototype._addContainerActions = function (container) { + // collect groups by titles + var titleGroupMap = {}; + this._actionGroups.forEach(function (group) { + if (titleGroupMap[group.title]) { + throw new Error(format('Cannot merge actions - two groups are named "%s".', group.title)); + } + titleGroupMap[group.title] = group; + }); + + // map each action to its group + var groupMap = {}; + function actionHash(action) { + // unique (hopefully?) string suitable as dictionary key + return action.getName(); + } + container._actionGroups.forEach(function (group) { + // if a group with the title exists, use that, otherwise + // create a new group matching the container's group + if (!titleGroupMap[group.title]) { + titleGroupMap[group.title] = this.addArgumentGroup({ + title: group.title, + description: group.description + }); + } + + // map the actions to their new group + group._groupActions.forEach(function (action) { + groupMap[actionHash(action)] = titleGroupMap[group.title]; + }); + }, this); + + // add container's mutually exclusive groups + // NOTE: if add_mutually_exclusive_group ever gains title= and + // description= then this code will need to be expanded as above + var mutexGroup; + container._mutuallyExclusiveGroups.forEach(function (group) { + mutexGroup = this.addMutuallyExclusiveGroup({ + required: group.required + }); + // map the actions to their new mutex group + group._groupActions.forEach(function (action) { + groupMap[actionHash(action)] = mutexGroup; + }); + }, this); // forEach takes a 'this' argument + + // add all actions to this container or their group + container._actions.forEach(function (action) { + var key = actionHash(action); + if (groupMap[key]) { + groupMap[key]._addAction(action); + } else { + this._addAction(action); + } + }); +}; + +ActionContainer.prototype._getPositional = function (dest, options) { + if (Array.isArray(dest)) { + dest = dest[0]; + } + // make sure required is not specified + if (options.required) { + throw new Error('"required" is an invalid argument for positionals.'); + } + + // mark positional arguments as required if at least one is + // always required + if (options.nargs !== c.OPTIONAL && options.nargs !== c.ZERO_OR_MORE) { + options.required = true; + } + if (options.nargs === c.ZERO_OR_MORE && typeof options.defaultValue === 'undefined') { + options.required = true; + } + + // return the keyword arguments with no option strings + options.dest = dest; + options.optionStrings = []; + return options; +}; + +ActionContainer.prototype._getOptional = function (args, options) { + var prefixChars = this.prefixChars; + var optionStrings = []; + var optionStringsLong = []; + + // determine short and long option strings + args.forEach(function (optionString) { + // error on strings that don't start with an appropriate prefix + if (prefixChars.indexOf(optionString[0]) < 0) { + throw new Error(format('Invalid option string "%s": must start with a "%s".', + optionString, + prefixChars + )); + } + + // strings starting with two prefix characters are long options + optionStrings.push(optionString); + if (optionString.length > 1 && prefixChars.indexOf(optionString[1]) >= 0) { + optionStringsLong.push(optionString); + } + }); + + // infer dest, '--foo-bar' -> 'foo_bar' and '-x' -> 'x' + var dest = options.dest || null; + delete options.dest; + + if (!dest) { + var optionStringDest = optionStringsLong.length ? optionStringsLong[0] : optionStrings[0]; + dest = $$.trimChars(optionStringDest, this.prefixChars); + + if (dest.length === 0) { + throw new Error( + format('dest= is required for options like "%s"', optionStrings.join(', ')) + ); + } + dest = dest.replace(/-/g, '_'); + } + + // return the updated keyword arguments + options.dest = dest; + options.optionStrings = optionStrings; + + return options; +}; + +ActionContainer.prototype._popActionClass = function (options, defaultValue) { + defaultValue = defaultValue || null; + + var action = (options.action || defaultValue); + delete options.action; + + var actionClass = this._registryGet('action', action, action); + return actionClass; +}; + +ActionContainer.prototype._getHandler = function () { + var handlerString = this.conflictHandler; + var handlerFuncName = '_handleConflict' + $$.capitalize(handlerString); + var func = this[handlerFuncName]; + if (typeof func === 'undefined') { + var msg = 'invalid conflict resolution value: ' + handlerString; + throw new Error(msg); + } else { + return func; + } +}; + +ActionContainer.prototype._checkConflict = function (action) { + var optionStringActions = this._optionStringActions; + var conflictOptionals = []; + + // find all options that conflict with this option + // collect pairs, the string, and an existing action that it conflicts with + action.optionStrings.forEach(function (optionString) { + var conflOptional = optionStringActions[optionString]; + if (typeof conflOptional !== 'undefined') { + conflictOptionals.push([ optionString, conflOptional ]); + } + }); + + if (conflictOptionals.length > 0) { + var conflictHandler = this._getHandler(); + conflictHandler.call(this, action, conflictOptionals); + } +}; + +ActionContainer.prototype._handleConflictError = function (action, conflOptionals) { + var conflicts = conflOptionals.map(function (pair) { return pair[0]; }); + conflicts = conflicts.join(', '); + throw argumentErrorHelper( + action, + format('Conflicting option string(s): %s', conflicts) + ); +}; + +ActionContainer.prototype._handleConflictResolve = function (action, conflOptionals) { + // remove all conflicting options + var self = this; + conflOptionals.forEach(function (pair) { + var optionString = pair[0]; + var conflictingAction = pair[1]; + // remove the conflicting option string + var i = conflictingAction.optionStrings.indexOf(optionString); + if (i >= 0) { + conflictingAction.optionStrings.splice(i, 1); + } + delete self._optionStringActions[optionString]; + // if the option now has no option string, remove it from the + // container holding it + if (conflictingAction.optionStrings.length === 0) { + conflictingAction.container._removeAction(conflictingAction); + } + }); +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argparse.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argparse.js new file mode 100644 index 0000000..f2a2c51 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argparse.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports.ArgumentParser = require('./argument_parser.js'); +module.exports.Namespace = require('./namespace'); +module.exports.Action = require('./action'); +module.exports.HelpFormatter = require('./help/formatter.js'); +module.exports.Const = require('./const.js'); + +module.exports.ArgumentDefaultsHelpFormatter = + require('./help/added_formatters.js').ArgumentDefaultsHelpFormatter; +module.exports.RawDescriptionHelpFormatter = + require('./help/added_formatters.js').RawDescriptionHelpFormatter; +module.exports.RawTextHelpFormatter = + require('./help/added_formatters.js').RawTextHelpFormatter; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument/error.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument/error.js new file mode 100644 index 0000000..c8a02a0 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument/error.js @@ -0,0 +1,50 @@ +'use strict'; + + +var format = require('util').format; + + +var ERR_CODE = 'ARGError'; + +/*:nodoc:* + * argumentError(argument, message) -> TypeError + * - argument (Object): action with broken argument + * - message (String): error message + * + * Error format helper. An error from creating or using an argument + * (optional or positional). The string value of this exception + * is the message, augmented with information + * about the argument that caused it. + * + * #####Example + * + * var argumentErrorHelper = require('./argument/error'); + * if (conflictOptionals.length > 0) { + * throw argumentErrorHelper( + * action, + * format('Conflicting option string(s): %s', conflictOptionals.join(', ')) + * ); + * } + * + **/ +module.exports = function (argument, message) { + var argumentName = null; + var errMessage; + var err; + + if (argument.getName) { + argumentName = argument.getName(); + } else { + argumentName = '' + argument; + } + + if (!argumentName) { + errMessage = message; + } else { + errMessage = format('argument "%s": %s', argumentName, message); + } + + err = new TypeError(errMessage); + err.code = ERR_CODE; + return err; +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument/exclusive.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument/exclusive.js new file mode 100644 index 0000000..8287e00 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument/exclusive.js @@ -0,0 +1,54 @@ +/** internal + * class MutuallyExclusiveGroup + * + * Group arguments. + * By default, ArgumentParser groups command-line arguments + * into “positional arguments” and “optional arguments” + * when displaying help messages. When there is a better + * conceptual grouping of arguments than this default one, + * appropriate groups can be created using the addArgumentGroup() method + * + * This class inherited from [[ArgumentContainer]] + **/ +'use strict'; + +var util = require('util'); + +var ArgumentGroup = require('./group'); + +/** + * new MutuallyExclusiveGroup(container, options) + * - container (object): main container + * - options (object): options.required -> true/false + * + * `required` could be an argument itself, but making it a property of + * the options argument is more consistent with the JS adaptation of the Python) + **/ +var MutuallyExclusiveGroup = module.exports = function MutuallyExclusiveGroup(container, options) { + var required; + options = options || {}; + required = options.required || false; + ArgumentGroup.call(this, container); + this.required = required; + +}; +util.inherits(MutuallyExclusiveGroup, ArgumentGroup); + + +MutuallyExclusiveGroup.prototype._addAction = function (action) { + var msg; + if (action.required) { + msg = 'mutually exclusive arguments must be optional'; + throw new Error(msg); + } + action = this._container._addAction(action); + this._groupActions.push(action); + return action; +}; + + +MutuallyExclusiveGroup.prototype._removeAction = function (action) { + this._container._removeAction(action); + this._groupActions.remove(action); +}; + diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument/group.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument/group.js new file mode 100644 index 0000000..58b271f --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument/group.js @@ -0,0 +1,75 @@ +/** internal + * class ArgumentGroup + * + * Group arguments. + * By default, ArgumentParser groups command-line arguments + * into “positional arguments” and “optional arguments” + * when displaying help messages. When there is a better + * conceptual grouping of arguments than this default one, + * appropriate groups can be created using the addArgumentGroup() method + * + * This class inherited from [[ArgumentContainer]] + **/ +'use strict'; + +var util = require('util'); + +var ActionContainer = require('../action_container'); + + +/** + * new ArgumentGroup(container, options) + * - container (object): main container + * - options (object): hash of group options + * + * #### options + * - **prefixChars** group name prefix + * - **argumentDefault** default argument value + * - **title** group title + * - **description** group description + * + **/ +var ArgumentGroup = module.exports = function ArgumentGroup(container, options) { + + options = options || {}; + + // add any missing keyword arguments by checking the container + options.conflictHandler = (options.conflictHandler || container.conflictHandler); + options.prefixChars = (options.prefixChars || container.prefixChars); + options.argumentDefault = (options.argumentDefault || container.argumentDefault); + + ActionContainer.call(this, options); + + // group attributes + this.title = options.title; + this._groupActions = []; + + // share most attributes with the container + this._container = container; + this._registries = container._registries; + this._actions = container._actions; + this._optionStringActions = container._optionStringActions; + this._defaults = container._defaults; + this._hasNegativeNumberOptionals = container._hasNegativeNumberOptionals; + this._mutuallyExclusiveGroups = container._mutuallyExclusiveGroups; +}; +util.inherits(ArgumentGroup, ActionContainer); + + +ArgumentGroup.prototype._addAction = function (action) { + // Parent add action + action = ActionContainer.prototype._addAction.call(this, action); + this._groupActions.push(action); + return action; +}; + + +ArgumentGroup.prototype._removeAction = function (action) { + // Parent remove action + ActionContainer.prototype._removeAction.call(this, action); + var actionIndex = this._groupActions.indexOf(action); + if (actionIndex >= 0) { + this._groupActions.splice(actionIndex, 1); + } +}; + diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument_parser.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument_parser.js new file mode 100644 index 0000000..bd9a59a --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/argument_parser.js @@ -0,0 +1,1161 @@ +/** + * class ArgumentParser + * + * Object for parsing command line strings into js objects. + * + * Inherited from [[ActionContainer]] + **/ +'use strict'; + +var util = require('util'); +var format = require('util').format; +var Path = require('path'); +var sprintf = require('sprintf-js').sprintf; + +// Constants +var c = require('./const'); + +var $$ = require('./utils'); + +var ActionContainer = require('./action_container'); + +// Errors +var argumentErrorHelper = require('./argument/error'); + +var HelpFormatter = require('./help/formatter'); + +var Namespace = require('./namespace'); + + +/** + * new ArgumentParser(options) + * + * Create a new ArgumentParser object. + * + * ##### Options: + * - `prog` The name of the program (default: Path.basename(process.argv[1])) + * - `usage` A usage message (default: auto-generated from arguments) + * - `description` A description of what the program does + * - `epilog` Text following the argument descriptions + * - `parents` Parsers whose arguments should be copied into this one + * - `formatterClass` HelpFormatter class for printing help messages + * - `prefixChars` Characters that prefix optional arguments + * - `fromfilePrefixChars` Characters that prefix files containing additional arguments + * - `argumentDefault` The default value for all arguments + * - `addHelp` Add a -h/-help option + * - `conflictHandler` Specifies how to handle conflicting argument names + * - `debug` Enable debug mode. Argument errors throw exception in + * debug mode and process.exit in normal. Used for development and + * testing (default: false) + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#argumentparser-objects + **/ +function ArgumentParser(options) { + if (!(this instanceof ArgumentParser)) { + return new ArgumentParser(options); + } + var self = this; + options = options || {}; + + options.description = (options.description || null); + options.argumentDefault = (options.argumentDefault || null); + options.prefixChars = (options.prefixChars || '-'); + options.conflictHandler = (options.conflictHandler || 'error'); + ActionContainer.call(this, options); + + options.addHelp = typeof options.addHelp === 'undefined' || !!options.addHelp; + options.parents = options.parents || []; + // default program name + options.prog = (options.prog || Path.basename(process.argv[1])); + this.prog = options.prog; + this.usage = options.usage; + this.epilog = options.epilog; + this.version = options.version; + + this.debug = (options.debug === true); + + this.formatterClass = (options.formatterClass || HelpFormatter); + this.fromfilePrefixChars = options.fromfilePrefixChars || null; + this._positionals = this.addArgumentGroup({ title: 'Positional arguments' }); + this._optionals = this.addArgumentGroup({ title: 'Optional arguments' }); + this._subparsers = null; + + // register types + function FUNCTION_IDENTITY(o) { + return o; + } + this.register('type', 'auto', FUNCTION_IDENTITY); + this.register('type', null, FUNCTION_IDENTITY); + this.register('type', 'int', function (x) { + var result = parseInt(x, 10); + if (isNaN(result)) { + throw new Error(x + ' is not a valid integer.'); + } + return result; + }); + this.register('type', 'float', function (x) { + var result = parseFloat(x); + if (isNaN(result)) { + throw new Error(x + ' is not a valid float.'); + } + return result; + }); + this.register('type', 'string', function (x) { + return '' + x; + }); + + // add help and version arguments if necessary + var defaultPrefix = (this.prefixChars.indexOf('-') > -1) ? '-' : this.prefixChars[0]; + if (options.addHelp) { + this.addArgument( + [ defaultPrefix + 'h', defaultPrefix + defaultPrefix + 'help' ], + { + action: 'help', + defaultValue: c.SUPPRESS, + help: 'Show this help message and exit.' + } + ); + } + if (typeof this.version !== 'undefined') { + this.addArgument( + [ defaultPrefix + 'v', defaultPrefix + defaultPrefix + 'version' ], + { + action: 'version', + version: this.version, + defaultValue: c.SUPPRESS, + help: "Show program's version number and exit." + } + ); + } + + // add parent arguments and defaults + options.parents.forEach(function (parent) { + self._addContainerActions(parent); + if (typeof parent._defaults !== 'undefined') { + for (var defaultKey in parent._defaults) { + if (parent._defaults.hasOwnProperty(defaultKey)) { + self._defaults[defaultKey] = parent._defaults[defaultKey]; + } + } + } + }); +} + +util.inherits(ArgumentParser, ActionContainer); + +/** + * ArgumentParser#addSubparsers(options) -> [[ActionSubparsers]] + * - options (object): hash of options see [[ActionSubparsers.new]] + * + * See also [subcommands][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#sub-commands + **/ +ArgumentParser.prototype.addSubparsers = function (options) { + if (this._subparsers) { + this.error('Cannot have multiple subparser arguments.'); + } + + options = options || {}; + options.debug = (this.debug === true); + options.optionStrings = []; + options.parserClass = (options.parserClass || ArgumentParser); + + + if (!!options.title || !!options.description) { + + this._subparsers = this.addArgumentGroup({ + title: (options.title || 'subcommands'), + description: options.description + }); + delete options.title; + delete options.description; + + } else { + this._subparsers = this._positionals; + } + + // prog defaults to the usage message of this parser, skipping + // optional arguments and with no "usage:" prefix + if (!options.prog) { + var formatter = this._getFormatter(); + var positionals = this._getPositionalActions(); + var groups = this._mutuallyExclusiveGroups; + formatter.addUsage(this.usage, positionals, groups, ''); + options.prog = formatter.formatHelp().trim(); + } + + // create the parsers action and add it to the positionals list + var ParsersClass = this._popActionClass(options, 'parsers'); + var action = new ParsersClass(options); + this._subparsers._addAction(action); + + // return the created parsers action + return action; +}; + +ArgumentParser.prototype._addAction = function (action) { + if (action.isOptional()) { + this._optionals._addAction(action); + } else { + this._positionals._addAction(action); + } + return action; +}; + +ArgumentParser.prototype._getOptionalActions = function () { + return this._actions.filter(function (action) { + return action.isOptional(); + }); +}; + +ArgumentParser.prototype._getPositionalActions = function () { + return this._actions.filter(function (action) { + return action.isPositional(); + }); +}; + + +/** + * ArgumentParser#parseArgs(args, namespace) -> Namespace|Object + * - args (array): input elements + * - namespace (Namespace|Object): result object + * + * Parsed args and throws error if some arguments are not recognized + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#the-parse-args-method + **/ +ArgumentParser.prototype.parseArgs = function (args, namespace) { + var argv; + var result = this.parseKnownArgs(args, namespace); + + args = result[0]; + argv = result[1]; + if (argv && argv.length > 0) { + this.error( + format('Unrecognized arguments: %s.', argv.join(' ')) + ); + } + return args; +}; + +/** + * ArgumentParser#parseKnownArgs(args, namespace) -> array + * - args (array): input options + * - namespace (Namespace|Object): result object + * + * Parse known arguments and return tuple of result object + * and unknown args + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#partial-parsing + **/ +ArgumentParser.prototype.parseKnownArgs = function (args, namespace) { + var self = this; + + // args default to the system args + args = args || process.argv.slice(2); + + // default Namespace built from parser defaults + namespace = namespace || new Namespace(); + + self._actions.forEach(function (action) { + if (action.dest !== c.SUPPRESS) { + if (!$$.has(namespace, action.dest)) { + if (action.defaultValue !== c.SUPPRESS) { + var defaultValue = action.defaultValue; + if (typeof action.defaultValue === 'string') { + defaultValue = self._getValue(action, defaultValue); + } + namespace[action.dest] = defaultValue; + } + } + } + }); + + Object.keys(self._defaults).forEach(function (dest) { + namespace[dest] = self._defaults[dest]; + }); + + // parse the arguments and exit if there are any errors + try { + var res = this._parseKnownArgs(args, namespace); + + namespace = res[0]; + args = res[1]; + if ($$.has(namespace, c._UNRECOGNIZED_ARGS_ATTR)) { + args = $$.arrayUnion(args, namespace[c._UNRECOGNIZED_ARGS_ATTR]); + delete namespace[c._UNRECOGNIZED_ARGS_ATTR]; + } + return [ namespace, args ]; + } catch (e) { + this.error(e); + } +}; + +ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) { + var self = this; + + var extras = []; + + // replace arg strings that are file references + if (this.fromfilePrefixChars !== null) { + argStrings = this._readArgsFromFiles(argStrings); + } + // map all mutually exclusive arguments to the other arguments + // they can't occur with + // Python has 'conflicts = action_conflicts.setdefault(mutex_action, [])' + // though I can't conceive of a way in which an action could be a member + // of two different mutually exclusive groups. + + function actionHash(action) { + // some sort of hashable key for this action + // action itself cannot be a key in actionConflicts + // I think getName() (join of optionStrings) is unique enough + return action.getName(); + } + + var conflicts, key; + var actionConflicts = {}; + + this._mutuallyExclusiveGroups.forEach(function (mutexGroup) { + mutexGroup._groupActions.forEach(function (mutexAction, i, groupActions) { + key = actionHash(mutexAction); + if (!$$.has(actionConflicts, key)) { + actionConflicts[key] = []; + } + conflicts = actionConflicts[key]; + conflicts.push.apply(conflicts, groupActions.slice(0, i)); + conflicts.push.apply(conflicts, groupActions.slice(i + 1)); + }); + }); + + // find all option indices, and determine the arg_string_pattern + // which has an 'O' if there is an option at an index, + // an 'A' if there is an argument, or a '-' if there is a '--' + var optionStringIndices = {}; + + var argStringPatternParts = []; + + argStrings.forEach(function (argString, argStringIndex) { + if (argString === '--') { + argStringPatternParts.push('-'); + while (argStringIndex < argStrings.length) { + argStringPatternParts.push('A'); + argStringIndex++; + } + } else { + // otherwise, add the arg to the arg strings + // and note the index if it was an option + var pattern; + var optionTuple = self._parseOptional(argString); + if (!optionTuple) { + pattern = 'A'; + } else { + optionStringIndices[argStringIndex] = optionTuple; + pattern = 'O'; + } + argStringPatternParts.push(pattern); + } + }); + var argStringsPattern = argStringPatternParts.join(''); + + var seenActions = []; + var seenNonDefaultActions = []; + + + function takeAction(action, argumentStrings, optionString) { + seenActions.push(action); + var argumentValues = self._getValues(action, argumentStrings); + + // error if this argument is not allowed with other previously + // seen arguments, assuming that actions that use the default + // value don't really count as "present" + if (argumentValues !== action.defaultValue) { + seenNonDefaultActions.push(action); + if (actionConflicts[actionHash(action)]) { + actionConflicts[actionHash(action)].forEach(function (actionConflict) { + if (seenNonDefaultActions.indexOf(actionConflict) >= 0) { + throw argumentErrorHelper( + action, + format('Not allowed with argument "%s".', actionConflict.getName()) + ); + } + }); + } + } + + if (argumentValues !== c.SUPPRESS) { + action.call(self, namespace, argumentValues, optionString); + } + } + + function consumeOptional(startIndex) { + // get the optional identified at this index + var optionTuple = optionStringIndices[startIndex]; + var action = optionTuple[0]; + var optionString = optionTuple[1]; + var explicitArg = optionTuple[2]; + + // identify additional optionals in the same arg string + // (e.g. -xyz is the same as -x -y -z if no args are required) + var actionTuples = []; + + var args, argCount, start, stop; + + for (;;) { + if (!action) { + extras.push(argStrings[startIndex]); + return startIndex + 1; + } + if (explicitArg) { + argCount = self._matchArgument(action, 'A'); + + // if the action is a single-dash option and takes no + // arguments, try to parse more single-dash options out + // of the tail of the option string + var chars = self.prefixChars; + if (argCount === 0 && chars.indexOf(optionString[1]) < 0) { + actionTuples.push([ action, [], optionString ]); + optionString = optionString[0] + explicitArg[0]; + var newExplicitArg = explicitArg.slice(1) || null; + var optionalsMap = self._optionStringActions; + + if (Object.keys(optionalsMap).indexOf(optionString) >= 0) { + action = optionalsMap[optionString]; + explicitArg = newExplicitArg; + } else { + throw argumentErrorHelper(action, sprintf('ignored explicit argument %r', explicitArg)); + } + } else if (argCount === 1) { + // if the action expect exactly one argument, we've + // successfully matched the option; exit the loop + stop = startIndex + 1; + args = [ explicitArg ]; + actionTuples.push([ action, args, optionString ]); + break; + } else { + // error if a double-dash option did not use the + // explicit argument + throw argumentErrorHelper(action, sprintf('ignored explicit argument %r', explicitArg)); + } + } else { + // if there is no explicit argument, try to match the + // optional's string arguments with the following strings + // if successful, exit the loop + + start = startIndex + 1; + var selectedPatterns = argStringsPattern.substr(start); + + argCount = self._matchArgument(action, selectedPatterns); + stop = start + argCount; + + + args = argStrings.slice(start, stop); + + actionTuples.push([ action, args, optionString ]); + break; + } + + } + + // add the Optional to the list and return the index at which + // the Optional's string args stopped + if (actionTuples.length < 1) { + throw new Error('length should be > 0'); + } + for (var i = 0; i < actionTuples.length; i++) { + takeAction.apply(self, actionTuples[i]); + } + return stop; + } + + // the list of Positionals left to be parsed; this is modified + // by consume_positionals() + var positionals = self._getPositionalActions(); + + function consumePositionals(startIndex) { + // match as many Positionals as possible + var selectedPattern = argStringsPattern.substr(startIndex); + var argCounts = self._matchArgumentsPartial(positionals, selectedPattern); + + // slice off the appropriate arg strings for each Positional + // and add the Positional and its args to the list + for (var i = 0; i < positionals.length; i++) { + var action = positionals[i]; + var argCount = argCounts[i]; + if (typeof argCount === 'undefined') { + continue; + } + var args = argStrings.slice(startIndex, startIndex + argCount); + + startIndex += argCount; + takeAction(action, args); + } + + // slice off the Positionals that we just parsed and return the + // index at which the Positionals' string args stopped + positionals = positionals.slice(argCounts.length); + return startIndex; + } + + // consume Positionals and Optionals alternately, until we have + // passed the last option string + var startIndex = 0; + var position; + + var maxOptionStringIndex = -1; + + Object.keys(optionStringIndices).forEach(function (position) { + maxOptionStringIndex = Math.max(maxOptionStringIndex, parseInt(position, 10)); + }); + + var positionalsEndIndex, nextOptionStringIndex; + + while (startIndex <= maxOptionStringIndex) { + // consume any Positionals preceding the next option + nextOptionStringIndex = null; + for (position in optionStringIndices) { + if (!optionStringIndices.hasOwnProperty(position)) { continue; } + + position = parseInt(position, 10); + if (position >= startIndex) { + if (nextOptionStringIndex !== null) { + nextOptionStringIndex = Math.min(nextOptionStringIndex, position); + } else { + nextOptionStringIndex = position; + } + } + } + + if (startIndex !== nextOptionStringIndex) { + positionalsEndIndex = consumePositionals(startIndex); + // only try to parse the next optional if we didn't consume + // the option string during the positionals parsing + if (positionalsEndIndex > startIndex) { + startIndex = positionalsEndIndex; + continue; + } else { + startIndex = positionalsEndIndex; + } + } + + // if we consumed all the positionals we could and we're not + // at the index of an option string, there were extra arguments + if (!optionStringIndices[startIndex]) { + var strings = argStrings.slice(startIndex, nextOptionStringIndex); + extras = extras.concat(strings); + startIndex = nextOptionStringIndex; + } + // consume the next optional and any arguments for it + startIndex = consumeOptional(startIndex); + } + + // consume any positionals following the last Optional + var stopIndex = consumePositionals(startIndex); + + // if we didn't consume all the argument strings, there were extras + extras = extras.concat(argStrings.slice(stopIndex)); + + // if we didn't use all the Positional objects, there were too few + // arg strings supplied. + if (positionals.length > 0) { + self.error('too few arguments'); + } + + // make sure all required actions were present + self._actions.forEach(function (action) { + if (action.required) { + if (seenActions.indexOf(action) < 0) { + self.error(format('Argument "%s" is required', action.getName())); + } + } + }); + + // make sure all required groups have one option present + var actionUsed = false; + self._mutuallyExclusiveGroups.forEach(function (group) { + if (group.required) { + actionUsed = group._groupActions.some(function (action) { + return seenNonDefaultActions.indexOf(action) !== -1; + }); + + // if no actions were used, report the error + if (!actionUsed) { + var names = []; + group._groupActions.forEach(function (action) { + if (action.help !== c.SUPPRESS) { + names.push(action.getName()); + } + }); + names = names.join(' '); + var msg = 'one of the arguments ' + names + ' is required'; + self.error(msg); + } + } + }); + + // return the updated namespace and the extra arguments + return [ namespace, extras ]; +}; + +ArgumentParser.prototype._readArgsFromFiles = function (argStrings) { + // expand arguments referencing files + var self = this; + var fs = require('fs'); + var newArgStrings = []; + argStrings.forEach(function (argString) { + if (self.fromfilePrefixChars.indexOf(argString[0]) < 0) { + // for regular arguments, just add them back into the list + newArgStrings.push(argString); + } else { + // replace arguments referencing files with the file content + try { + var argstrs = []; + var filename = argString.slice(1); + var content = fs.readFileSync(filename, 'utf8'); + content = content.trim().split('\n'); + content.forEach(function (argLine) { + self.convertArgLineToArgs(argLine).forEach(function (arg) { + argstrs.push(arg); + }); + argstrs = self._readArgsFromFiles(argstrs); + }); + newArgStrings.push.apply(newArgStrings, argstrs); + } catch (error) { + return self.error(error.message); + } + } + }); + return newArgStrings; +}; + +ArgumentParser.prototype.convertArgLineToArgs = function (argLine) { + return [ argLine ]; +}; + +ArgumentParser.prototype._matchArgument = function (action, regexpArgStrings) { + + // match the pattern for this action to the arg strings + var regexpNargs = new RegExp('^' + this._getNargsPattern(action)); + var matches = regexpArgStrings.match(regexpNargs); + var message; + + // throw an exception if we weren't able to find a match + if (!matches) { + switch (action.nargs) { + /*eslint-disable no-undefined*/ + case undefined: + case null: + message = 'Expected one argument.'; + break; + case c.OPTIONAL: + message = 'Expected at most one argument.'; + break; + case c.ONE_OR_MORE: + message = 'Expected at least one argument.'; + break; + default: + message = 'Expected %s argument(s)'; + } + + throw argumentErrorHelper( + action, + format(message, action.nargs) + ); + } + // return the number of arguments matched + return matches[1].length; +}; + +ArgumentParser.prototype._matchArgumentsPartial = function (actions, regexpArgStrings) { + // progressively shorten the actions list by slicing off the + // final actions until we find a match + var self = this; + var result = []; + var actionSlice, pattern, matches; + var i, j; + + function getLength(string) { + return string.length; + } + + for (i = actions.length; i > 0; i--) { + pattern = ''; + actionSlice = actions.slice(0, i); + for (j = 0; j < actionSlice.length; j++) { + pattern += self._getNargsPattern(actionSlice[j]); + } + + pattern = new RegExp('^' + pattern); + matches = regexpArgStrings.match(pattern); + + if (matches && matches.length > 0) { + // need only groups + matches = matches.splice(1); + result = result.concat(matches.map(getLength)); + break; + } + } + + // return the list of arg string counts + return result; +}; + +ArgumentParser.prototype._parseOptional = function (argString) { + var action, optionString, argExplicit, optionTuples; + + // if it's an empty string, it was meant to be a positional + if (!argString) { + return null; + } + + // if it doesn't start with a prefix, it was meant to be positional + if (this.prefixChars.indexOf(argString[0]) < 0) { + return null; + } + + // if the option string is present in the parser, return the action + if (this._optionStringActions[argString]) { + return [ this._optionStringActions[argString], argString, null ]; + } + + // if it's just a single character, it was meant to be positional + if (argString.length === 1) { + return null; + } + + // if the option string before the "=" is present, return the action + if (argString.indexOf('=') >= 0) { + optionString = argString.split('=', 1)[0]; + argExplicit = argString.slice(optionString.length + 1); + + if (this._optionStringActions[optionString]) { + action = this._optionStringActions[optionString]; + return [ action, optionString, argExplicit ]; + } + } + + // search through all possible prefixes of the option string + // and all actions in the parser for possible interpretations + optionTuples = this._getOptionTuples(argString); + + // if multiple actions match, the option string was ambiguous + if (optionTuples.length > 1) { + var optionStrings = optionTuples.map(function (optionTuple) { + return optionTuple[1]; + }); + this.error(format( + 'Ambiguous option: "%s" could match %s.', + argString, optionStrings.join(', ') + )); + // if exactly one action matched, this segmentation is good, + // so return the parsed action + } else if (optionTuples.length === 1) { + return optionTuples[0]; + } + + // if it was not found as an option, but it looks like a negative + // number, it was meant to be positional + // unless there are negative-number-like options + if (argString.match(this._regexpNegativeNumber)) { + if (!this._hasNegativeNumberOptionals.some(Boolean)) { + return null; + } + } + // if it contains a space, it was meant to be a positional + if (argString.search(' ') >= 0) { + return null; + } + + // it was meant to be an optional but there is no such option + // in this parser (though it might be a valid option in a subparser) + return [ null, argString, null ]; +}; + +ArgumentParser.prototype._getOptionTuples = function (optionString) { + var result = []; + var chars = this.prefixChars; + var optionPrefix; + var argExplicit; + var action; + var actionOptionString; + + // option strings starting with two prefix characters are only split at + // the '=' + if (chars.indexOf(optionString[0]) >= 0 && chars.indexOf(optionString[1]) >= 0) { + if (optionString.indexOf('=') >= 0) { + var optionStringSplit = optionString.split('=', 1); + + optionPrefix = optionStringSplit[0]; + argExplicit = optionStringSplit[1]; + } else { + optionPrefix = optionString; + argExplicit = null; + } + + for (actionOptionString in this._optionStringActions) { + if (actionOptionString.substr(0, optionPrefix.length) === optionPrefix) { + action = this._optionStringActions[actionOptionString]; + result.push([ action, actionOptionString, argExplicit ]); + } + } + + // single character options can be concatenated with their arguments + // but multiple character options always have to have their argument + // separate + } else if (chars.indexOf(optionString[0]) >= 0 && chars.indexOf(optionString[1]) < 0) { + optionPrefix = optionString; + argExplicit = null; + var optionPrefixShort = optionString.substr(0, 2); + var argExplicitShort = optionString.substr(2); + + for (actionOptionString in this._optionStringActions) { + if (!$$.has(this._optionStringActions, actionOptionString)) continue; + + action = this._optionStringActions[actionOptionString]; + if (actionOptionString === optionPrefixShort) { + result.push([ action, actionOptionString, argExplicitShort ]); + } else if (actionOptionString.substr(0, optionPrefix.length) === optionPrefix) { + result.push([ action, actionOptionString, argExplicit ]); + } + } + + // shouldn't ever get here + } else { + throw new Error(format('Unexpected option string: %s.', optionString)); + } + // return the collected option tuples + return result; +}; + +ArgumentParser.prototype._getNargsPattern = function (action) { + // in all examples below, we have to allow for '--' args + // which are represented as '-' in the pattern + var regexpNargs; + + switch (action.nargs) { + // the default (null) is assumed to be a single argument + case undefined: + case null: + regexpNargs = '(-*A-*)'; + break; + // allow zero or more arguments + case c.OPTIONAL: + regexpNargs = '(-*A?-*)'; + break; + // allow zero or more arguments + case c.ZERO_OR_MORE: + regexpNargs = '(-*[A-]*)'; + break; + // allow one or more arguments + case c.ONE_OR_MORE: + regexpNargs = '(-*A[A-]*)'; + break; + // allow any number of options or arguments + case c.REMAINDER: + regexpNargs = '([-AO]*)'; + break; + // allow one argument followed by any number of options or arguments + case c.PARSER: + regexpNargs = '(-*A[-AO]*)'; + break; + // all others should be integers + default: + regexpNargs = '(-*' + $$.repeat('-*A', action.nargs) + '-*)'; + } + + // if this is an optional action, -- is not allowed + if (action.isOptional()) { + regexpNargs = regexpNargs.replace(/-\*/g, ''); + regexpNargs = regexpNargs.replace(/-/g, ''); + } + + // return the pattern + return regexpNargs; +}; + +// +// Value conversion methods +// + +ArgumentParser.prototype._getValues = function (action, argStrings) { + var self = this; + + // for everything but PARSER args, strip out '--' + if (action.nargs !== c.PARSER && action.nargs !== c.REMAINDER) { + argStrings = argStrings.filter(function (arrayElement) { + return arrayElement !== '--'; + }); + } + + var value, argString; + + // optional argument produces a default when not present + if (argStrings.length === 0 && action.nargs === c.OPTIONAL) { + + value = (action.isOptional()) ? action.constant : action.defaultValue; + + if (typeof (value) === 'string') { + value = this._getValue(action, value); + this._checkValue(action, value); + } + + // when nargs='*' on a positional, if there were no command-line + // args, use the default if it is anything other than None + } else if (argStrings.length === 0 && action.nargs === c.ZERO_OR_MORE && + action.optionStrings.length === 0) { + + value = (action.defaultValue || argStrings); + this._checkValue(action, value); + + // single argument or optional argument produces a single value + } else if (argStrings.length === 1 && + (!action.nargs || action.nargs === c.OPTIONAL)) { + + argString = argStrings[0]; + value = this._getValue(action, argString); + this._checkValue(action, value); + + // REMAINDER arguments convert all values, checking none + } else if (action.nargs === c.REMAINDER) { + value = argStrings.map(function (v) { + return self._getValue(action, v); + }); + + // PARSER arguments convert all values, but check only the first + } else if (action.nargs === c.PARSER) { + value = argStrings.map(function (v) { + return self._getValue(action, v); + }); + this._checkValue(action, value[0]); + + // all other types of nargs produce a list + } else { + value = argStrings.map(function (v) { + return self._getValue(action, v); + }); + value.forEach(function (v) { + self._checkValue(action, v); + }); + } + + // return the converted value + return value; +}; + +ArgumentParser.prototype._getValue = function (action, argString) { + var result; + + var typeFunction = this._registryGet('type', action.type, action.type); + if (typeof typeFunction !== 'function') { + var message = format('%s is not callable', typeFunction); + throw argumentErrorHelper(action, message); + } + + // convert the value to the appropriate type + try { + result = typeFunction(argString); + + // ArgumentTypeErrors indicate errors + // If action.type is not a registered string, it is a function + // Try to deduce its name for inclusion in the error message + // Failing that, include the error message it raised. + } catch (e) { + var name = null; + if (typeof action.type === 'string') { + name = action.type; + } else { + name = action.type.name || action.type.displayName || ''; + } + var msg = format('Invalid %s value: %s', name, argString); + if (name === '') { msg += '\n' + e.message; } + throw argumentErrorHelper(action, msg); + } + // return the converted value + return result; +}; + +ArgumentParser.prototype._checkValue = function (action, value) { + // converted value must be one of the choices (if specified) + var choices = action.choices; + if (choices) { + // choise for argument can by array or string + if ((typeof choices === 'string' || Array.isArray(choices)) && + choices.indexOf(value) !== -1) { + return; + } + // choise for subparsers can by only hash + if (typeof choices === 'object' && !Array.isArray(choices) && choices[value]) { + return; + } + + if (typeof choices === 'string') { + choices = choices.split('').join(', '); + } else if (Array.isArray(choices)) { + choices = choices.join(', '); + } else { + choices = Object.keys(choices).join(', '); + } + var message = format('Invalid choice: %s (choose from [%s])', value, choices); + throw argumentErrorHelper(action, message); + } +}; + +// +// Help formatting methods +// + +/** + * ArgumentParser#formatUsage -> string + * + * Return usage string + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#printing-help + **/ +ArgumentParser.prototype.formatUsage = function () { + var formatter = this._getFormatter(); + formatter.addUsage(this.usage, this._actions, this._mutuallyExclusiveGroups); + return formatter.formatHelp(); +}; + +/** + * ArgumentParser#formatHelp -> string + * + * Return help + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#printing-help + **/ +ArgumentParser.prototype.formatHelp = function () { + var formatter = this._getFormatter(); + + // usage + formatter.addUsage(this.usage, this._actions, this._mutuallyExclusiveGroups); + + // description + formatter.addText(this.description); + + // positionals, optionals and user-defined groups + this._actionGroups.forEach(function (actionGroup) { + formatter.startSection(actionGroup.title); + formatter.addText(actionGroup.description); + formatter.addArguments(actionGroup._groupActions); + formatter.endSection(); + }); + + // epilog + formatter.addText(this.epilog); + + // determine help from format above + return formatter.formatHelp(); +}; + +ArgumentParser.prototype._getFormatter = function () { + var FormatterClass = this.formatterClass; + var formatter = new FormatterClass({ prog: this.prog }); + return formatter; +}; + +// +// Print functions +// + +/** + * ArgumentParser#printUsage() -> Void + * + * Print usage + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#printing-help + **/ +ArgumentParser.prototype.printUsage = function () { + this._printMessage(this.formatUsage()); +}; + +/** + * ArgumentParser#printHelp() -> Void + * + * Print help + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#printing-help + **/ +ArgumentParser.prototype.printHelp = function () { + this._printMessage(this.formatHelp()); +}; + +ArgumentParser.prototype._printMessage = function (message, stream) { + if (!stream) { + stream = process.stdout; + } + if (message) { + stream.write('' + message); + } +}; + +// +// Exit functions +// + +/** + * ArgumentParser#exit(status=0, message) -> Void + * - status (int): exit status + * - message (string): message + * + * Print message in stderr/stdout and exit program + **/ +ArgumentParser.prototype.exit = function (status, message) { + if (message) { + if (status === 0) { + this._printMessage(message); + } else { + this._printMessage(message, process.stderr); + } + } + + process.exit(status); +}; + +/** + * ArgumentParser#error(message) -> Void + * - err (Error|string): message + * + * Error method Prints a usage message incorporating the message to stderr and + * exits. If you override this in a subclass, + * it should not return -- it should + * either exit or throw an exception. + * + **/ +ArgumentParser.prototype.error = function (err) { + var message; + if (err instanceof Error) { + if (this.debug === true) { + throw err; + } + message = err.message; + } else { + message = err; + } + var msg = format('%s: error: %s', this.prog, message) + c.EOL; + + if (this.debug === true) { + throw new Error(msg); + } + + this.printUsage(process.stderr); + + return this.exit(2, msg); +}; + +module.exports = ArgumentParser; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/const.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/const.js new file mode 100644 index 0000000..b1fd4ce --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/const.js @@ -0,0 +1,21 @@ +// +// Constants +// + +'use strict'; + +module.exports.EOL = '\n'; + +module.exports.SUPPRESS = '==SUPPRESS=='; + +module.exports.OPTIONAL = '?'; + +module.exports.ZERO_OR_MORE = '*'; + +module.exports.ONE_OR_MORE = '+'; + +module.exports.PARSER = 'A...'; + +module.exports.REMAINDER = '...'; + +module.exports._UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args'; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/help/added_formatters.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/help/added_formatters.js new file mode 100644 index 0000000..f8e4299 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/help/added_formatters.js @@ -0,0 +1,87 @@ +'use strict'; + +var util = require('util'); + +// Constants +var c = require('../const'); + +var $$ = require('../utils'); +var HelpFormatter = require('./formatter.js'); + +/** + * new RawDescriptionHelpFormatter(options) + * new ArgumentParser({formatterClass: argparse.RawDescriptionHelpFormatter, ...}) + * + * Help message formatter which adds default values to argument help. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + **/ + +function ArgumentDefaultsHelpFormatter(options) { + HelpFormatter.call(this, options); +} + +util.inherits(ArgumentDefaultsHelpFormatter, HelpFormatter); + +ArgumentDefaultsHelpFormatter.prototype._getHelpString = function (action) { + var help = action.help; + if (action.help.indexOf('%(defaultValue)s') === -1) { + if (action.defaultValue !== c.SUPPRESS) { + var defaulting_nargs = [ c.OPTIONAL, c.ZERO_OR_MORE ]; + if (action.isOptional() || (defaulting_nargs.indexOf(action.nargs) >= 0)) { + help += ' (default: %(defaultValue)s)'; + } + } + } + return help; +}; + +module.exports.ArgumentDefaultsHelpFormatter = ArgumentDefaultsHelpFormatter; + +/** + * new RawDescriptionHelpFormatter(options) + * new ArgumentParser({formatterClass: argparse.RawDescriptionHelpFormatter, ...}) + * + * Help message formatter which retains any formatting in descriptions. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + **/ + +function RawDescriptionHelpFormatter(options) { + HelpFormatter.call(this, options); +} + +util.inherits(RawDescriptionHelpFormatter, HelpFormatter); + +RawDescriptionHelpFormatter.prototype._fillText = function (text, width, indent) { + var lines = text.split('\n'); + lines = lines.map(function (line) { + return $$.trimEnd(indent + line); + }); + return lines.join('\n'); +}; +module.exports.RawDescriptionHelpFormatter = RawDescriptionHelpFormatter; + +/** + * new RawTextHelpFormatter(options) + * new ArgumentParser({formatterClass: argparse.RawTextHelpFormatter, ...}) + * + * Help message formatter which retains formatting of all help text. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + **/ + +function RawTextHelpFormatter(options) { + RawDescriptionHelpFormatter.call(this, options); +} + +util.inherits(RawTextHelpFormatter, RawDescriptionHelpFormatter); + +RawTextHelpFormatter.prototype._splitLines = function (text) { + return text.split('\n'); +}; + +module.exports.RawTextHelpFormatter = RawTextHelpFormatter; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/help/formatter.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/help/formatter.js new file mode 100644 index 0000000..29036c1 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/help/formatter.js @@ -0,0 +1,795 @@ +/** + * class HelpFormatter + * + * Formatter for generating usage messages and argument help strings. Only the + * name of this class is considered a public API. All the methods provided by + * the class are considered an implementation detail. + * + * Do not call in your code, use this class only for inherits your own forvatter + * + * ToDo add [additonal formatters][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#formatter-class + **/ +'use strict'; + +var sprintf = require('sprintf-js').sprintf; + +// Constants +var c = require('../const'); + +var $$ = require('../utils'); + + +/*:nodoc:* internal + * new Support(parent, heding) + * - parent (object): parent section + * - heading (string): header string + * + **/ +function Section(parent, heading) { + this._parent = parent; + this._heading = heading; + this._items = []; +} + +/*:nodoc:* internal + * Section#addItem(callback) -> Void + * - callback (array): tuple with function and args + * + * Add function for single element + **/ +Section.prototype.addItem = function (callback) { + this._items.push(callback); +}; + +/*:nodoc:* internal + * Section#formatHelp(formatter) -> string + * - formatter (HelpFormatter): current formatter + * + * Form help section string + * + **/ +Section.prototype.formatHelp = function (formatter) { + var itemHelp, heading; + + // format the indented section + if (this._parent) { + formatter._indent(); + } + + itemHelp = this._items.map(function (item) { + var obj, func, args; + + obj = formatter; + func = item[0]; + args = item[1]; + return func.apply(obj, args); + }); + itemHelp = formatter._joinParts(itemHelp); + + if (this._parent) { + formatter._dedent(); + } + + // return nothing if the section was empty + if (!itemHelp) { + return ''; + } + + // add the heading if the section was non-empty + heading = ''; + if (this._heading && this._heading !== c.SUPPRESS) { + var currentIndent = formatter.currentIndent; + heading = $$.repeat(' ', currentIndent) + this._heading + ':' + c.EOL; + } + + // join the section-initialize newline, the heading and the help + return formatter._joinParts([ c.EOL, heading, itemHelp, c.EOL ]); +}; + +/** + * new HelpFormatter(options) + * + * #### Options: + * - `prog`: program name + * - `indentIncriment`: indent step, default value 2 + * - `maxHelpPosition`: max help position, default value = 24 + * - `width`: line width + * + **/ +var HelpFormatter = module.exports = function HelpFormatter(options) { + options = options || {}; + + this._prog = options.prog; + + this._maxHelpPosition = options.maxHelpPosition || 24; + this._width = (options.width || ((process.env.COLUMNS || 80) - 2)); + + this._currentIndent = 0; + this._indentIncriment = options.indentIncriment || 2; + this._level = 0; + this._actionMaxLength = 0; + + this._rootSection = new Section(null); + this._currentSection = this._rootSection; + + this._whitespaceMatcher = new RegExp('\\s+', 'g'); + this._longBreakMatcher = new RegExp(c.EOL + c.EOL + c.EOL + '+', 'g'); +}; + +HelpFormatter.prototype._indent = function () { + this._currentIndent += this._indentIncriment; + this._level += 1; +}; + +HelpFormatter.prototype._dedent = function () { + this._currentIndent -= this._indentIncriment; + this._level -= 1; + if (this._currentIndent < 0) { + throw new Error('Indent decreased below 0.'); + } +}; + +HelpFormatter.prototype._addItem = function (func, args) { + this._currentSection.addItem([ func, args ]); +}; + +// +// Message building methods +// + +/** + * HelpFormatter#startSection(heading) -> Void + * - heading (string): header string + * + * Start new help section + * + * See alse [code example][1] + * + * ##### Example + * + * formatter.startSection(actionGroup.title); + * formatter.addText(actionGroup.description); + * formatter.addArguments(actionGroup._groupActions); + * formatter.endSection(); + * + **/ +HelpFormatter.prototype.startSection = function (heading) { + this._indent(); + var section = new Section(this._currentSection, heading); + var func = section.formatHelp.bind(section); + this._addItem(func, [ this ]); + this._currentSection = section; +}; + +/** + * HelpFormatter#endSection -> Void + * + * End help section + * + * ##### Example + * + * formatter.startSection(actionGroup.title); + * formatter.addText(actionGroup.description); + * formatter.addArguments(actionGroup._groupActions); + * formatter.endSection(); + **/ +HelpFormatter.prototype.endSection = function () { + this._currentSection = this._currentSection._parent; + this._dedent(); +}; + +/** + * HelpFormatter#addText(text) -> Void + * - text (string): plain text + * + * Add plain text into current section + * + * ##### Example + * + * formatter.startSection(actionGroup.title); + * formatter.addText(actionGroup.description); + * formatter.addArguments(actionGroup._groupActions); + * formatter.endSection(); + * + **/ +HelpFormatter.prototype.addText = function (text) { + if (text && text !== c.SUPPRESS) { + this._addItem(this._formatText, [ text ]); + } +}; + +/** + * HelpFormatter#addUsage(usage, actions, groups, prefix) -> Void + * - usage (string): usage text + * - actions (array): actions list + * - groups (array): groups list + * - prefix (string): usage prefix + * + * Add usage data into current section + * + * ##### Example + * + * formatter.addUsage(this.usage, this._actions, []); + * return formatter.formatHelp(); + * + **/ +HelpFormatter.prototype.addUsage = function (usage, actions, groups, prefix) { + if (usage !== c.SUPPRESS) { + this._addItem(this._formatUsage, [ usage, actions, groups, prefix ]); + } +}; + +/** + * HelpFormatter#addArgument(action) -> Void + * - action (object): action + * + * Add argument into current section + * + * Single variant of [[HelpFormatter#addArguments]] + **/ +HelpFormatter.prototype.addArgument = function (action) { + if (action.help !== c.SUPPRESS) { + var self = this; + + // find all invocations + var invocations = [ this._formatActionInvocation(action) ]; + var invocationLength = invocations[0].length; + + var actionLength; + + if (action._getSubactions) { + this._indent(); + action._getSubactions().forEach(function (subaction) { + + var invocationNew = self._formatActionInvocation(subaction); + invocations.push(invocationNew); + invocationLength = Math.max(invocationLength, invocationNew.length); + + }); + this._dedent(); + } + + // update the maximum item length + actionLength = invocationLength + this._currentIndent; + this._actionMaxLength = Math.max(this._actionMaxLength, actionLength); + + // add the item to the list + this._addItem(this._formatAction, [ action ]); + } +}; + +/** + * HelpFormatter#addArguments(actions) -> Void + * - actions (array): actions list + * + * Mass add arguments into current section + * + * ##### Example + * + * formatter.startSection(actionGroup.title); + * formatter.addText(actionGroup.description); + * formatter.addArguments(actionGroup._groupActions); + * formatter.endSection(); + * + **/ +HelpFormatter.prototype.addArguments = function (actions) { + var self = this; + actions.forEach(function (action) { + self.addArgument(action); + }); +}; + +// +// Help-formatting methods +// + +/** + * HelpFormatter#formatHelp -> string + * + * Format help + * + * ##### Example + * + * formatter.addText(this.epilog); + * return formatter.formatHelp(); + * + **/ +HelpFormatter.prototype.formatHelp = function () { + var help = this._rootSection.formatHelp(this); + if (help) { + help = help.replace(this._longBreakMatcher, c.EOL + c.EOL); + help = $$.trimChars(help, c.EOL) + c.EOL; + } + return help; +}; + +HelpFormatter.prototype._joinParts = function (partStrings) { + return partStrings.filter(function (part) { + return (part && part !== c.SUPPRESS); + }).join(''); +}; + +HelpFormatter.prototype._formatUsage = function (usage, actions, groups, prefix) { + if (!prefix && typeof prefix !== 'string') { + prefix = 'usage: '; + } + + actions = actions || []; + groups = groups || []; + + + // if usage is specified, use that + if (usage) { + usage = sprintf(usage, { prog: this._prog }); + + // if no optionals or positionals are available, usage is just prog + } else if (!usage && actions.length === 0) { + usage = this._prog; + + // if optionals and positionals are available, calculate usage + } else if (!usage) { + var prog = this._prog; + var optionals = []; + var positionals = []; + var actionUsage; + var textWidth; + + // split optionals from positionals + actions.forEach(function (action) { + if (action.isOptional()) { + optionals.push(action); + } else { + positionals.push(action); + } + }); + + // build full usage string + actionUsage = this._formatActionsUsage([].concat(optionals, positionals), groups); + usage = [ prog, actionUsage ].join(' '); + + // wrap the usage parts if it's too long + textWidth = this._width - this._currentIndent; + if ((prefix.length + usage.length) > textWidth) { + + // break usage into wrappable parts + var regexpPart = new RegExp('\\(.*?\\)+|\\[.*?\\]+|\\S+', 'g'); + var optionalUsage = this._formatActionsUsage(optionals, groups); + var positionalUsage = this._formatActionsUsage(positionals, groups); + + + var optionalParts = optionalUsage.match(regexpPart); + var positionalParts = positionalUsage.match(regexpPart) || []; + + if (optionalParts.join(' ') !== optionalUsage) { + throw new Error('assert "optionalParts.join(\' \') === optionalUsage"'); + } + if (positionalParts.join(' ') !== positionalUsage) { + throw new Error('assert "positionalParts.join(\' \') === positionalUsage"'); + } + + // helper for wrapping lines + /*eslint-disable func-style*/ // node 0.10 compat + var _getLines = function (parts, indent, prefix) { + var lines = []; + var line = []; + + var lineLength = prefix ? prefix.length - 1 : indent.length - 1; + + parts.forEach(function (part) { + if (lineLength + 1 + part.length > textWidth) { + lines.push(indent + line.join(' ')); + line = []; + lineLength = indent.length - 1; + } + line.push(part); + lineLength += part.length + 1; + }); + + if (line) { + lines.push(indent + line.join(' ')); + } + if (prefix) { + lines[0] = lines[0].substr(indent.length); + } + return lines; + }; + + var lines, indent, parts; + // if prog is short, follow it with optionals or positionals + if (prefix.length + prog.length <= 0.75 * textWidth) { + indent = $$.repeat(' ', (prefix.length + prog.length + 1)); + if (optionalParts) { + lines = [].concat( + _getLines([ prog ].concat(optionalParts), indent, prefix), + _getLines(positionalParts, indent) + ); + } else if (positionalParts) { + lines = _getLines([ prog ].concat(positionalParts), indent, prefix); + } else { + lines = [ prog ]; + } + + // if prog is long, put it on its own line + } else { + indent = $$.repeat(' ', prefix.length); + parts = optionalParts.concat(positionalParts); + lines = _getLines(parts, indent); + if (lines.length > 1) { + lines = [].concat( + _getLines(optionalParts, indent), + _getLines(positionalParts, indent) + ); + } + lines = [ prog ].concat(lines); + } + // join lines into usage + usage = lines.join(c.EOL); + } + } + + // prefix with 'usage:' + return prefix + usage + c.EOL + c.EOL; +}; + +HelpFormatter.prototype._formatActionsUsage = function (actions, groups) { + // find group indices and identify actions in groups + var groupActions = []; + var inserts = []; + var self = this; + + groups.forEach(function (group) { + var end; + var i; + + var start = actions.indexOf(group._groupActions[0]); + if (start >= 0) { + end = start + group._groupActions.length; + + //if (actions.slice(start, end) === group._groupActions) { + if ($$.arrayEqual(actions.slice(start, end), group._groupActions)) { + group._groupActions.forEach(function (action) { + groupActions.push(action); + }); + + if (!group.required) { + if (inserts[start]) { + inserts[start] += ' ['; + } else { + inserts[start] = '['; + } + inserts[end] = ']'; + } else { + if (inserts[start]) { + inserts[start] += ' ('; + } else { + inserts[start] = '('; + } + inserts[end] = ')'; + } + for (i = start + 1; i < end; i += 1) { + inserts[i] = '|'; + } + } + } + }); + + // collect all actions format strings + var parts = []; + + actions.forEach(function (action, actionIndex) { + var part; + var optionString; + var argsDefault; + var argsString; + + // suppressed arguments are marked with None + // remove | separators for suppressed arguments + if (action.help === c.SUPPRESS) { + parts.push(null); + if (inserts[actionIndex] === '|') { + inserts.splice(actionIndex, actionIndex); + } else if (inserts[actionIndex + 1] === '|') { + inserts.splice(actionIndex + 1, actionIndex + 1); + } + + // produce all arg strings + } else if (!action.isOptional()) { + part = self._formatArgs(action, action.dest); + + // if it's in a group, strip the outer [] + if (groupActions.indexOf(action) >= 0) { + if (part[0] === '[' && part[part.length - 1] === ']') { + part = part.slice(1, -1); + } + } + // add the action string to the list + parts.push(part); + + // produce the first way to invoke the option in brackets + } else { + optionString = action.optionStrings[0]; + + // if the Optional doesn't take a value, format is: -s or --long + if (action.nargs === 0) { + part = '' + optionString; + + // if the Optional takes a value, format is: -s ARGS or --long ARGS + } else { + argsDefault = action.dest.toUpperCase(); + argsString = self._formatArgs(action, argsDefault); + part = optionString + ' ' + argsString; + } + // make it look optional if it's not required or in a group + if (!action.required && groupActions.indexOf(action) < 0) { + part = '[' + part + ']'; + } + // add the action string to the list + parts.push(part); + } + }); + + // insert things at the necessary indices + for (var i = inserts.length - 1; i >= 0; --i) { + if (inserts[i] !== null) { + parts.splice(i, 0, inserts[i]); + } + } + + // join all the action items with spaces + var text = parts.filter(function (part) { + return !!part; + }).join(' '); + + // clean up separators for mutually exclusive groups + text = text.replace(/([\[(]) /g, '$1'); // remove spaces + text = text.replace(/ ([\])])/g, '$1'); + text = text.replace(/\[ *\]/g, ''); // remove empty groups + text = text.replace(/\( *\)/g, ''); + text = text.replace(/\(([^|]*)\)/g, '$1'); // remove () from single action groups + + text = text.trim(); + + // return the text + return text; +}; + +HelpFormatter.prototype._formatText = function (text) { + text = sprintf(text, { prog: this._prog }); + var textWidth = this._width - this._currentIndent; + var indentIncriment = $$.repeat(' ', this._currentIndent); + return this._fillText(text, textWidth, indentIncriment) + c.EOL + c.EOL; +}; + +HelpFormatter.prototype._formatAction = function (action) { + var self = this; + + var helpText; + var helpLines; + var parts; + var indentFirst; + + // determine the required width and the entry label + var helpPosition = Math.min(this._actionMaxLength + 2, this._maxHelpPosition); + var helpWidth = this._width - helpPosition; + var actionWidth = helpPosition - this._currentIndent - 2; + var actionHeader = this._formatActionInvocation(action); + + // no help; start on same line and add a final newline + if (!action.help) { + actionHeader = $$.repeat(' ', this._currentIndent) + actionHeader + c.EOL; + + // short action name; start on the same line and pad two spaces + } else if (actionHeader.length <= actionWidth) { + actionHeader = $$.repeat(' ', this._currentIndent) + + actionHeader + + ' ' + + $$.repeat(' ', actionWidth - actionHeader.length); + indentFirst = 0; + + // long action name; start on the next line + } else { + actionHeader = $$.repeat(' ', this._currentIndent) + actionHeader + c.EOL; + indentFirst = helpPosition; + } + + // collect the pieces of the action help + parts = [ actionHeader ]; + + // if there was help for the action, add lines of help text + if (action.help) { + helpText = this._expandHelp(action); + helpLines = this._splitLines(helpText, helpWidth); + parts.push($$.repeat(' ', indentFirst) + helpLines[0] + c.EOL); + helpLines.slice(1).forEach(function (line) { + parts.push($$.repeat(' ', helpPosition) + line + c.EOL); + }); + + // or add a newline if the description doesn't end with one + } else if (actionHeader.charAt(actionHeader.length - 1) !== c.EOL) { + parts.push(c.EOL); + } + // if there are any sub-actions, add their help as well + if (action._getSubactions) { + this._indent(); + action._getSubactions().forEach(function (subaction) { + parts.push(self._formatAction(subaction)); + }); + this._dedent(); + } + // return a single string + return this._joinParts(parts); +}; + +HelpFormatter.prototype._formatActionInvocation = function (action) { + if (!action.isOptional()) { + var format_func = this._metavarFormatter(action, action.dest); + var metavars = format_func(1); + return metavars[0]; + } + + var parts = []; + var argsDefault; + var argsString; + + // if the Optional doesn't take a value, format is: -s, --long + if (action.nargs === 0) { + parts = parts.concat(action.optionStrings); + + // if the Optional takes a value, format is: -s ARGS, --long ARGS + } else { + argsDefault = action.dest.toUpperCase(); + argsString = this._formatArgs(action, argsDefault); + action.optionStrings.forEach(function (optionString) { + parts.push(optionString + ' ' + argsString); + }); + } + return parts.join(', '); +}; + +HelpFormatter.prototype._metavarFormatter = function (action, metavarDefault) { + var result; + + if (action.metavar || action.metavar === '') { + result = action.metavar; + } else if (action.choices) { + var choices = action.choices; + + if (typeof choices === 'string') { + choices = choices.split('').join(', '); + } else if (Array.isArray(choices)) { + choices = choices.join(','); + } else { + choices = Object.keys(choices).join(','); + } + result = '{' + choices + '}'; + } else { + result = metavarDefault; + } + + return function (size) { + if (Array.isArray(result)) { + return result; + } + + var metavars = []; + for (var i = 0; i < size; i += 1) { + metavars.push(result); + } + return metavars; + }; +}; + +HelpFormatter.prototype._formatArgs = function (action, metavarDefault) { + var result; + var metavars; + + var buildMetavar = this._metavarFormatter(action, metavarDefault); + + switch (action.nargs) { + /*eslint-disable no-undefined*/ + case undefined: + case null: + metavars = buildMetavar(1); + result = '' + metavars[0]; + break; + case c.OPTIONAL: + metavars = buildMetavar(1); + result = '[' + metavars[0] + ']'; + break; + case c.ZERO_OR_MORE: + metavars = buildMetavar(2); + result = '[' + metavars[0] + ' [' + metavars[1] + ' ...]]'; + break; + case c.ONE_OR_MORE: + metavars = buildMetavar(2); + result = '' + metavars[0] + ' [' + metavars[1] + ' ...]'; + break; + case c.REMAINDER: + result = '...'; + break; + case c.PARSER: + metavars = buildMetavar(1); + result = metavars[0] + ' ...'; + break; + default: + metavars = buildMetavar(action.nargs); + result = metavars.join(' '); + } + return result; +}; + +HelpFormatter.prototype._expandHelp = function (action) { + var params = { prog: this._prog }; + + Object.keys(action).forEach(function (actionProperty) { + var actionValue = action[actionProperty]; + + if (actionValue !== c.SUPPRESS) { + params[actionProperty] = actionValue; + } + }); + + if (params.choices) { + if (typeof params.choices === 'string') { + params.choices = params.choices.split('').join(', '); + } else if (Array.isArray(params.choices)) { + params.choices = params.choices.join(', '); + } else { + params.choices = Object.keys(params.choices).join(', '); + } + } + + return sprintf(this._getHelpString(action), params); +}; + +HelpFormatter.prototype._splitLines = function (text, width) { + var lines = []; + var delimiters = [ ' ', '.', ',', '!', '?' ]; + var re = new RegExp('[' + delimiters.join('') + '][^' + delimiters.join('') + ']*$'); + + text = text.replace(/[\n\|\t]/g, ' '); + + text = text.trim(); + text = text.replace(this._whitespaceMatcher, ' '); + + // Wraps the single paragraph in text (a string) so every line + // is at most width characters long. + text.split(c.EOL).forEach(function (line) { + if (width >= line.length) { + lines.push(line); + return; + } + + var wrapStart = 0; + var wrapEnd = width; + var delimiterIndex = 0; + while (wrapEnd <= line.length) { + if (wrapEnd !== line.length && delimiters.indexOf(line[wrapEnd] < -1)) { + delimiterIndex = (re.exec(line.substring(wrapStart, wrapEnd)) || {}).index; + wrapEnd = wrapStart + delimiterIndex + 1; + } + lines.push(line.substring(wrapStart, wrapEnd)); + wrapStart = wrapEnd; + wrapEnd += width; + } + if (wrapStart < line.length) { + lines.push(line.substring(wrapStart, wrapEnd)); + } + }); + + return lines; +}; + +HelpFormatter.prototype._fillText = function (text, width, indent) { + var lines = this._splitLines(text, width); + lines = lines.map(function (line) { + return indent + line; + }); + return lines.join(c.EOL); +}; + +HelpFormatter.prototype._getHelpString = function (action) { + return action.help; +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/namespace.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/namespace.js new file mode 100644 index 0000000..a860de9 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/namespace.js @@ -0,0 +1,76 @@ +/** + * class Namespace + * + * Simple object for storing attributes. Implements equality by attribute names + * and values, and provides a simple string representation. + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#the-namespace-object + **/ +'use strict'; + +var $$ = require('./utils'); + +/** + * new Namespace(options) + * - options(object): predefined propertis for result object + * + **/ +var Namespace = module.exports = function Namespace(options) { + $$.extend(this, options); +}; + +/** + * Namespace#isset(key) -> Boolean + * - key (string|number): property name + * + * Tells whenever `namespace` contains given `key` or not. + **/ +Namespace.prototype.isset = function (key) { + return $$.has(this, key); +}; + +/** + * Namespace#set(key, value) -> self + * -key (string|number|object): propery name + * -value (mixed): new property value + * + * Set the property named key with value. + * If key object then set all key properties to namespace object + **/ +Namespace.prototype.set = function (key, value) { + if (typeof (key) === 'object') { + $$.extend(this, key); + } else { + this[key] = value; + } + return this; +}; + +/** + * Namespace#get(key, defaultValue) -> mixed + * - key (string|number): property name + * - defaultValue (mixed): default value + * + * Return the property key or defaulValue if not set + **/ +Namespace.prototype.get = function (key, defaultValue) { + return !this[key] ? defaultValue : this[key]; +}; + +/** + * Namespace#unset(key, defaultValue) -> mixed + * - key (string|number): property name + * - defaultValue (mixed): default value + * + * Return data[key](and delete it) or defaultValue + **/ +Namespace.prototype.unset = function (key, defaultValue) { + var value = this[key]; + if (value !== null) { + delete this[key]; + return value; + } + return defaultValue; +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/utils.js b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/utils.js new file mode 100644 index 0000000..4a9cf3e --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/lib/utils.js @@ -0,0 +1,57 @@ +'use strict'; + +exports.repeat = function (str, num) { + var result = ''; + for (var i = 0; i < num; i++) { result += str; } + return result; +}; + +exports.arrayEqual = function (a, b) { + if (a.length !== b.length) { return false; } + for (var i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { return false; } + } + return true; +}; + +exports.trimChars = function (str, chars) { + var start = 0; + var end = str.length - 1; + while (chars.indexOf(str.charAt(start)) >= 0) { start++; } + while (chars.indexOf(str.charAt(end)) >= 0) { end--; } + return str.slice(start, end + 1); +}; + +exports.capitalize = function (str) { + return str.charAt(0).toUpperCase() + str.slice(1); +}; + +exports.arrayUnion = function () { + var result = []; + for (var i = 0, values = {}; i < arguments.length; i++) { + var arr = arguments[i]; + for (var j = 0; j < arr.length; j++) { + if (!values[arr[j]]) { + values[arr[j]] = true; + result.push(arr[j]); + } + } + } + return result; +}; + +function has(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +exports.has = has; + +exports.extend = function (dest, src) { + for (var i in src) { + if (has(src, i)) { dest[i] = src[i]; } + } +}; + +exports.trimEnd = function (str) { + return str.replace(/\s+$/g, ''); +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/argparse/package.json b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/package.json new file mode 100644 index 0000000..62fba0a --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/argparse/package.json @@ -0,0 +1,34 @@ +{ + "name": "argparse", + "description": "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library", + "version": "1.0.10", + "keywords": [ + "cli", + "parser", + "argparse", + "option", + "args" + ], + "contributors": [ + "Eugene Shkuropat", + "Paul Jacobson" + ], + "files": [ + "index.js", + "lib/" + ], + "license": "MIT", + "repository": "nodeca/argparse", + "scripts": { + "test": "make test" + }, + "dependencies": { + "sprintf-js": "~1.0.2" + }, + "devDependencies": { + "eslint": "^2.13.1", + "istanbul": "^0.4.5", + "mocha": "^3.1.0", + "ndoc": "^5.0.1" + } +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/.coveralls.yml b/coc/extensions/node_modules/coc-yaml/node_modules/debug/.coveralls.yml new file mode 100644 index 0000000..20a7068 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/.coveralls.yml @@ -0,0 +1 @@ +repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/.eslintrc b/coc/extensions/node_modules/coc-yaml/node_modules/debug/.eslintrc new file mode 100644 index 0000000..146371e --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/.eslintrc @@ -0,0 +1,14 @@ +{ + "env": { + "browser": true, + "node": true + }, + "globals": { + "chrome": true + }, + "rules": { + "no-console": 0, + "no-empty": [1, { "allowEmptyCatch": true }] + }, + "extends": "eslint:recommended" +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/.npmignore b/coc/extensions/node_modules/coc-yaml/node_modules/debug/.npmignore new file mode 100644 index 0000000..5f60eec --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/.npmignore @@ -0,0 +1,9 @@ +support +test +examples +example +*.sock +dist +yarn.lock +coverage +bower.json diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/.travis.yml b/coc/extensions/node_modules/coc-yaml/node_modules/debug/.travis.yml new file mode 100644 index 0000000..a764300 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/.travis.yml @@ -0,0 +1,20 @@ +sudo: false + +language: node_js + +node_js: + - "4" + - "6" + - "8" + +install: + - make install + +script: + - make lint + - make test + +matrix: + include: + - node_js: '8' + env: BROWSER=1 diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/CHANGELOG.md b/coc/extensions/node_modules/coc-yaml/node_modules/debug/CHANGELOG.md new file mode 100644 index 0000000..820d21e --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/LICENSE b/coc/extensions/node_modules/coc-yaml/node_modules/debug/LICENSE new file mode 100644 index 0000000..658c933 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk + +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/coc/extensions/node_modules/coc-yaml/node_modules/debug/Makefile b/coc/extensions/node_modules/coc-yaml/node_modules/debug/Makefile new file mode 100644 index 0000000..3ddd136 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/Makefile @@ -0,0 +1,58 @@ +# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 +THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) + +# BIN directory +BIN := $(THIS_DIR)/node_modules/.bin + +# Path +PATH := node_modules/.bin:$(PATH) +SHELL := /bin/bash + +# applications +NODE ?= $(shell which node) +YARN ?= $(shell which yarn) +PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm)) +BROWSERIFY ?= $(NODE) $(BIN)/browserify + +install: node_modules + +browser: dist/debug.js + +node_modules: package.json + @NODE_ENV= $(PKG) install + @touch node_modules + +dist/debug.js: src/*.js node_modules + @mkdir -p dist + @$(BROWSERIFY) \ + --standalone debug \ + . > dist/debug.js + +lint: + @eslint *.js src/*.js + +test-node: + @istanbul cover node_modules/mocha/bin/_mocha -- test/**.js + @cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js + +test-browser: + @$(MAKE) browser + @karma start --single-run + +test-all: + @concurrently \ + "make test-node" \ + "make test-browser" + +test: + @if [ "x$(BROWSER)" = "x" ]; then \ + $(MAKE) test-node; \ + else \ + $(MAKE) test-browser; \ + fi + +clean: + rimraf dist coverage + +.PHONY: browser install clean lint test test-all test-node test-browser diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/README.md b/coc/extensions/node_modules/coc-yaml/node_modules/debug/README.md new file mode 100644 index 0000000..8e754d1 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/README.md @@ -0,0 +1,368 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows note + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Note that PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Then, run the program to be debugged as usual. + + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> + +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/coc/extensions/node_modules/coc-yaml/node_modules/debug/karma.conf.js b/coc/extensions/node_modules/coc-yaml/node_modules/debug/karma.conf.js new file mode 100644 index 0000000..103a82d --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/karma.conf.js @@ -0,0 +1,70 @@ +// Karma configuration +// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC) + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['mocha', 'chai', 'sinon'], + + + // list of files / patterns to load in the browser + files: [ + 'dist/debug.js', + 'test/*spec.js' + ], + + + // list of files to exclude + exclude: [ + 'src/node.js' + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['PhantomJS'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/node.js b/coc/extensions/node_modules/coc-yaml/node_modules/debug/node.js new file mode 100644 index 0000000..7fc36fe --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/node.js @@ -0,0 +1 @@ +module.exports = require('./src/node'); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/package.json b/coc/extensions/node_modules/coc-yaml/node_modules/debug/package.json new file mode 100644 index 0000000..ada43cf --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/package.json @@ -0,0 +1,43 @@ +{ + "name": "debug", + "version": "3.1.0", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": "TJ Holowaychuk ", + "contributors": [ + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + }, + "devDependencies": { + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^2.11.15", + "eslint": "^3.12.1", + "istanbul": "^0.4.5", + "karma": "^1.3.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "karma-sinon": "^1.0.5", + "mocha": "^3.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "sinon": "^1.17.6", + "sinon-chai": "^2.8.0" + }, + "main": "./src/index.js", + "browser": "./src/browser.js" +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/src/browser.js b/coc/extensions/node_modules/coc-yaml/node_modules/debug/src/browser.js new file mode 100644 index 0000000..f5149ff --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/src/browser.js @@ -0,0 +1,195 @@ +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', + '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', + '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', + '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', + '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', + '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', + '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', + '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', + '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', + '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', + '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit') + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + return window.localStorage; + } catch (e) {} +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/src/debug.js b/coc/extensions/node_modules/coc-yaml/node_modules/debug/src/debug.js new file mode 100644 index 0000000..77e6384 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/src/debug.js @@ -0,0 +1,225 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * Active `debug` instances. + */ +exports.instances = []; + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + +exports.formatters = {}; + +/** + * Select a color. + * @param {String} namespace + * @return {Number} + * @api private + */ + +function selectColor(namespace) { + var hash = 0, i; + + for (i in namespace) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function createDebug(namespace) { + + var prevTime; + + function debug() { + // disabled? + if (!debug.enabled) return; + + var self = debug; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %O + args.unshift('%O'); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } + + exports.instances.push(debug); + + return debug; +} + +function destroy () { + var index = exports.instances.indexOf(this); + if (index !== -1) { + exports.instances.splice(index, 1); + return true; + } else { + return false; + } +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + exports.names = []; + exports.skips = []; + + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < exports.instances.length; i++) { + var instance = exports.instances[i]; + instance.enabled = exports.enabled(instance.namespace); + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/src/index.js b/coc/extensions/node_modules/coc-yaml/node_modules/debug/src/index.js new file mode 100644 index 0000000..cabcbcd --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer') { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/debug/src/node.js b/coc/extensions/node_modules/coc-yaml/node_modules/debug/src/node.js new file mode 100644 index 0000000..d666fb9 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/debug/src/node.js @@ -0,0 +1,186 @@ +/** + * Module dependencies. + */ + +var tty = require('tty'); +var util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [ 6, 2, 3, 4, 5, 1 ]; + +try { + var supportsColor = require('supports-color'); + if (supportsColor && supportsColor.level >= 2) { + exports.colors = [ + 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, + 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, + 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 214, 215, 220, 221 + ]; + } +} catch (err) { + // swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // camel-case + var prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); + + // coerce string value into JS value + var val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) val = true; + else if (/^(no|off|false|disabled)$/i.test(val)) val = false; + else if (val === 'null') val = null; + else val = Number(val); + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts + ? Boolean(exports.inspectOpts.colors) + : tty.isatty(process.stderr.fd); +} + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +exports.formatters.o = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n').map(function(str) { + return str.trim() + }).join(' '); +}; + +/** + * Map %o to `util.inspect()`, allowing multiple lines if needed. + */ + +exports.formatters.O = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + var name = this.namespace; + var useColors = this.useColors; + + if (useColors) { + var c = this.color; + var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c); + var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m'; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } else { + return new Date().toISOString() + ' '; + } +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log() { + return process.stderr.write(util.format.apply(util, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init (debug) { + debug.inspectOpts = {}; + + var keys = Object.keys(exports.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/CHANGELOG.md b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/CHANGELOG.md new file mode 100644 index 0000000..d630cc0 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/CHANGELOG.md @@ -0,0 +1,155 @@ +# Master + +# 4.2.5 + +* remove old try/catch performance hacks, modern runtimes do not require these tricks + +# 4.2.4 + +* [Fixes #305] Confuse webpack + +# 4.2.3 + +* Cleanup testem related build configuration +* Use `prepublishOnly` instead of `prepublish` (thanks @rhysd) +* Add Node.js 9, 8 to testing matrix +* drop now unused s3 deployment files +* internal cleanup (thanks to @bekzod, @mariusschulz) +* Fixup Changelog + +# 4.2.2 + +* Ensure PROMISE_ID works correctly +* internal cleanup (thanks yo @mariusschulz) + +# 4.2.1 + +* drop bower support + +# 4.2.0 + +* drop `dist` from git repo +* add `Promise.prototype.finally` +* update various build related dependencies +* add CDN links + +# 4.1.0 + +* [BUGFIX] Fix memory leak [#269] +* [BUGFIX] Auto Bundles within an AMD Environment [#263] + +# 4.0.5 + +* fix require('es6-promise/auto') for Node < 4 + +# 4.0.4 + +* fix asap when using https://github.com/Kinvey/titanium-sdk + +# 4.0.3 + +* fix Readme links + +# 4.0.2 + +* fix require('es6-promise/auto'); + +# 4.0.0 + +* no longer polyfill automatically, if needed one can still invoke + `require('es6-promise/auto')` directly. + +# 3.3.1 + +* fix links in readme + +# 3.3.0 + +* support polyfil on WebMAF (playstation env) +* fix tampering related bug global `constructor` was referenced by mistake. +* provide TS Typings +* increase compatibliity with sinon.useFakeTimers(); +* update build tools (use rollup) +* directly export promise; + +# 3.2.2 + +* IE8: use isArray +* update build dependencies + +# 3.2.1 + +* fix race tampering issue +* use eslint +* fix Promise.all tampering +* remove unused code +* fix issues with NWJS/electron + +# 3.2.0 + +* improve tamper resistence of Promise.all Promise.race and + Promise.prototype.then (note, this isn't complete, but addresses an exception + when used \w core-js, follow up work will address entirely) +* remove spec incompatible then chaining fast-path +* add eslint +* update build deps + +# 3.1.2 + +* fix node detection issues with NWJS/electron + +# 3.1.0 + +* improve performance of Promise.all when it encounters a non-promise input object input +* then/resolve tamper protection +* reduce AST size of promise constructor, to facilitate more inlining +* Update README.md with details about PhantomJS requirement for running tests +* Mangle and compress the minified version + +# 3.0.2 + +* correctly bump both bower and package.json versions + +# 3.0.1 + +* no longer include dist/test in npm releases + +# 3.0.0 + +* use nextTick() instead of setImmediate() to schedule microtasks with node 0.10. Later versions of + nodes are not affected as they were already using nextTick(). Note that using nextTick() might + trigger a depreciation warning on 0.10 as described at https://github.com/cujojs/when/issues/410. + The reason why nextTick() is preferred is that is setImmediate() would schedule a macrotask + instead of a microtask and might result in a different scheduling. + If needed you can revert to the former behavior as follow: + + var Promise = require('es6-promise').Promise; + Promise._setScheduler(setImmediate); + +# 2.3.0 + +* #121: Ability to override the internal asap implementation +* #120: Use an ascii character for an apostrophe, for source maps + +# 2.2.0 + +* #116: Expose asap() and a way to override the scheduling mechanism on Promise +* Lock to v0.2.3 of ember-cli + +# 2.1.1 + +* Fix #100 via #105: tell browserify to ignore vertx require +* Fix #101 via #102: "follow thenable state, not own state" + +# 2.1.0 + +* #59: Automatic polyfill. No need to invoke `ES6Promise.polyfill()` anymore. +* ... (see the commit log) + +# 2.0.0 + +* re-sync with RSVP. Many large performance improvements and bugfixes. + +# 1.0.0 + +* first subset of RSVP diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/LICENSE b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/LICENSE new file mode 100644 index 0000000..954ec59 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/README.md b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/README.md new file mode 100644 index 0000000..951db75 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/README.md @@ -0,0 +1,97 @@ +# ES6-Promise (subset of [rsvp.js](https://github.com/tildeio/rsvp.js)) [![Build Status](https://travis-ci.org/stefanpenner/es6-promise.svg?branch=master)](https://travis-ci.org/stefanpenner/es6-promise) + +This is a polyfill of the [ES6 Promise](http://www.ecma-international.org/ecma-262/6.0/#sec-promise-constructor). The implementation is a subset of [rsvp.js](https://github.com/tildeio/rsvp.js) extracted by @jakearchibald, if you're wanting extra features and more debugging options, check out the [full library](https://github.com/tildeio/rsvp.js). + +For API details and how to use promises, see the JavaScript Promises HTML5Rocks article. + +## Downloads + +* [es6-promise 27.86 KB (7.33 KB gzipped)](https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.js) +* [es6-promise-auto 27.78 KB (7.3 KB gzipped)](https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.auto.js) - Automatically provides/replaces `Promise` if missing or broken. +* [es6-promise-min 6.17 KB (2.4 KB gzipped)](https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.min.js) +* [es6-promise-auto-min 6.19 KB (2.4 KB gzipped)](https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.auto.min.js) - Minified version of `es6-promise-auto` above. + +## CDN + +To use via a CDN include this in your html: + +```html + + + + + + + + +``` + +## Node.js + +To install: + +```sh +yarn add es6-promise +``` + +or + +```sh +npm install es6-promise +``` + +To use: + +```js +var Promise = require('es6-promise').Promise; +``` + + +## Usage in IE<9 + +`catch` and `finally` are reserved keywords in IE<9, meaning +`promise.catch(func)` or `promise.finally(func)` throw a syntax error. To work +around this, you can use a string to access the property as shown in the +following example. + +However most minifiers will automatically fix this for you, making the +resulting code safe for old browsers and production: + +```js +promise['catch'](function(err) { + // ... +}); +``` + +```js +promise['finally'](function() { + // ... +}); +``` + +## Auto-polyfill + +To polyfill the global environment (either in Node or in the browser via CommonJS) use the following code snippet: + +```js +require('es6-promise').polyfill(); +``` + +Alternatively + +```js +require('es6-promise/auto'); +``` + +Notice that we don't assign the result of `polyfill()` to any variable. The `polyfill()` method will patch the global environment (in this case to the `Promise` name) when called. + +## Building & Testing + +You will need to have PhantomJS installed globally in order to run the tests. + +`npm install -g phantomjs` + +* `npm run build` to build +* `npm test` to run tests +* `npm start` to run a build watcher, and webserver to test +* `npm run test:server` for a testem test runner and watching builder diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/auto.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/auto.js new file mode 100644 index 0000000..92bbf36 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/auto.js @@ -0,0 +1,4 @@ +// This file can be required in Browserify and Node.js for automatic polyfill +// To use it: require('es6-promise/auto'); +'use strict'; +module.exports = require('./').polyfill(); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.js new file mode 100644 index 0000000..7ad1de5 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.js @@ -0,0 +1,1176 @@ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version v4.2.8+1e68dce6 + */ + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.ES6Promise = factory()); +}(this, (function () { 'use strict'; + +function objectOrFunction(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); +} + +function isFunction(x) { + return typeof x === 'function'; +} + + + +var _isArray = void 0; +if (Array.isArray) { + _isArray = Array.isArray; +} else { + _isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; +} + +var isArray = _isArray; + +var len = 0; +var vertxNext = void 0; +var customSchedulerFn = void 0; + +var asap = function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (customSchedulerFn) { + customSchedulerFn(flush); + } else { + scheduleFlush(); + } + } +}; + +function setScheduler(scheduleFn) { + customSchedulerFn = scheduleFn; +} + +function setAsap(asapFn) { + asap = asapFn; +} + +var browserWindow = typeof window !== 'undefined' ? window : undefined; +var browserGlobal = browserWindow || {}; +var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; +var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + +// test for web worker but not in IE10 +var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; + +// node +function useNextTick() { + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // see https://github.com/cujojs/when/issues/410 for details + return function () { + return process.nextTick(flush); + }; +} + +// vertx +function useVertxTimer() { + if (typeof vertxNext !== 'undefined') { + return function () { + vertxNext(flush); + }; + } + + return useSetTimeout(); +} + +function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function () { + node.data = iterations = ++iterations % 2; + }; +} + +// web worker +function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function () { + return channel.port2.postMessage(0); + }; +} + +function useSetTimeout() { + // Store setTimeout reference so es6-promise will be unaffected by + // other code modifying setTimeout (like sinon.useFakeTimers()) + var globalSetTimeout = setTimeout; + return function () { + return globalSetTimeout(flush, 1); + }; +} + +var queue = new Array(1000); +function flush() { + for (var i = 0; i < len; i += 2) { + var callback = queue[i]; + var arg = queue[i + 1]; + + callback(arg); + + queue[i] = undefined; + queue[i + 1] = undefined; + } + + len = 0; +} + +function attemptVertx() { + try { + var vertx = Function('return this')().require('vertx'); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch (e) { + return useSetTimeout(); + } +} + +var scheduleFlush = void 0; +// Decide what async method to use to triggering processing of queued callbacks: +if (isNode) { + scheduleFlush = useNextTick(); +} else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); +} else if (isWorker) { + scheduleFlush = useMessageChannel(); +} else if (browserWindow === undefined && typeof require === 'function') { + scheduleFlush = attemptVertx(); +} else { + scheduleFlush = useSetTimeout(); +} + +function then(onFulfillment, onRejection) { + var parent = this; + + var child = new this.constructor(noop); + + if (child[PROMISE_ID] === undefined) { + makePromise(child); + } + + var _state = parent._state; + + + if (_state) { + var callback = arguments[_state - 1]; + asap(function () { + return invokeCallback(_state, child, callback, parent._result); + }); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + + return child; +} + +/** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` +*/ +function resolve$1(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(noop); + resolve(promise, object); + return promise; +} + +var PROMISE_ID = Math.random().toString(36).substring(2); + +function noop() {} + +var PENDING = void 0; +var FULFILLED = 1; +var REJECTED = 2; + +function selfFulfillment() { + return new TypeError("You cannot resolve a promise with itself"); +} + +function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); +} + +function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { + try { + then$$1.call(value, fulfillmentHandler, rejectionHandler); + } catch (e) { + return e; + } +} + +function handleForeignThenable(promise, thenable, then$$1) { + asap(function (promise) { + var sealed = false; + var error = tryThen(then$$1, thenable, function (value) { + if (sealed) { + return; + } + sealed = true; + if (thenable !== value) { + resolve(promise, value); + } else { + fulfill(promise, value); + } + }, function (reason) { + if (sealed) { + return; + } + sealed = true; + + reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + reject(promise, error); + } + }, promise); +} + +function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, function (value) { + return resolve(promise, value); + }, function (reason) { + return reject(promise, reason); + }); + } +} + +function handleMaybeThenable(promise, maybeThenable, then$$1) { + if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { + handleOwnThenable(promise, maybeThenable); + } else { + if (then$$1 === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then$$1)) { + handleForeignThenable(promise, maybeThenable, then$$1); + } else { + fulfill(promise, maybeThenable); + } + } +} + +function resolve(promise, value) { + if (promise === value) { + reject(promise, selfFulfillment()); + } else if (objectOrFunction(value)) { + var then$$1 = void 0; + try { + then$$1 = value.then; + } catch (error) { + reject(promise, error); + return; + } + handleMaybeThenable(promise, value, then$$1); + } else { + fulfill(promise, value); + } +} + +function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + publish(promise); +} + +function fulfill(promise, value) { + if (promise._state !== PENDING) { + return; + } + + promise._result = value; + promise._state = FULFILLED; + + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } +} + +function reject(promise, reason) { + if (promise._state !== PENDING) { + return; + } + promise._state = REJECTED; + promise._result = reason; + + asap(publishRejection, promise); +} + +function subscribe(parent, child, onFulfillment, onRejection) { + var _subscribers = parent._subscribers; + var length = _subscribers.length; + + + parent._onerror = null; + + _subscribers[length] = child; + _subscribers[length + FULFILLED] = onFulfillment; + _subscribers[length + REJECTED] = onRejection; + + if (length === 0 && parent._state) { + asap(publish, parent); + } +} + +function publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { + return; + } + + var child = void 0, + callback = void 0, + detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; +} + +function invokeCallback(settled, promise, callback, detail) { + var hasCallback = isFunction(callback), + value = void 0, + error = void 0, + succeeded = true; + + if (hasCallback) { + try { + value = callback(detail); + } catch (e) { + succeeded = false; + error = e; + } + + if (promise === value) { + reject(promise, cannotReturnOwn()); + return; + } + } else { + value = detail; + } + + if (promise._state !== PENDING) { + // noop + } else if (hasCallback && succeeded) { + resolve(promise, value); + } else if (succeeded === false) { + reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + reject(promise, value); + } +} + +function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value) { + resolve(promise, value); + }, function rejectPromise(reason) { + reject(promise, reason); + }); + } catch (e) { + reject(promise, e); + } +} + +var id = 0; +function nextId() { + return id++; +} + +function makePromise(promise) { + promise[PROMISE_ID] = id++; + promise._state = undefined; + promise._result = undefined; + promise._subscribers = []; +} + +function validationError() { + return new Error('Array Methods must be provided an Array'); +} + +var Enumerator = function () { + function Enumerator(Constructor, input) { + this._instanceConstructor = Constructor; + this.promise = new Constructor(noop); + + if (!this.promise[PROMISE_ID]) { + makePromise(this.promise); + } + + if (isArray(input)) { + this.length = input.length; + this._remaining = input.length; + + this._result = new Array(this.length); + + if (this.length === 0) { + fulfill(this.promise, this._result); + } else { + this.length = this.length || 0; + this._enumerate(input); + if (this._remaining === 0) { + fulfill(this.promise, this._result); + } + } + } else { + reject(this.promise, validationError()); + } + } + + Enumerator.prototype._enumerate = function _enumerate(input) { + for (var i = 0; this._state === PENDING && i < input.length; i++) { + this._eachEntry(input[i], i); + } + }; + + Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { + var c = this._instanceConstructor; + var resolve$$1 = c.resolve; + + + if (resolve$$1 === resolve$1) { + var _then = void 0; + var error = void 0; + var didError = false; + try { + _then = entry.then; + } catch (e) { + didError = true; + error = e; + } + + if (_then === then && entry._state !== PENDING) { + this._settledAt(entry._state, i, entry._result); + } else if (typeof _then !== 'function') { + this._remaining--; + this._result[i] = entry; + } else if (c === Promise$2) { + var promise = new c(noop); + if (didError) { + reject(promise, error); + } else { + handleMaybeThenable(promise, entry, _then); + } + this._willSettleAt(promise, i); + } else { + this._willSettleAt(new c(function (resolve$$1) { + return resolve$$1(entry); + }), i); + } + } else { + this._willSettleAt(resolve$$1(entry), i); + } + }; + + Enumerator.prototype._settledAt = function _settledAt(state, i, value) { + var promise = this.promise; + + + if (promise._state === PENDING) { + this._remaining--; + + if (state === REJECTED) { + reject(promise, value); + } else { + this._result[i] = value; + } + } + + if (this._remaining === 0) { + fulfill(promise, this._result); + } + }; + + Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { + var enumerator = this; + + subscribe(promise, undefined, function (value) { + return enumerator._settledAt(FULFILLED, i, value); + }, function (reason) { + return enumerator._settledAt(REJECTED, i, reason); + }); + }; + + return Enumerator; +}(); + +/** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = resolve(2); + let promise3 = resolve(3); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = reject(new Error("2")); + let promise3 = reject(new Error("3")); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static +*/ +function all(entries) { + return new Enumerator(this, entries).promise; +} + +/** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. +*/ +function race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + if (!isArray(entries)) { + return new Constructor(function (_, reject) { + return reject(new TypeError('You must pass an array to race.')); + }); + } else { + return new Constructor(function (resolve, reject) { + var length = entries.length; + for (var i = 0; i < length; i++) { + Constructor.resolve(entries[i]).then(resolve, reject); + } + }); + } +} + +/** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. +*/ +function reject$1(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(noop); + reject(promise, reason); + return promise; +} + +function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); +} + +function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); +} + +/** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + let promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + let xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {Function} resolver + Useful for tooling. + @constructor +*/ + +var Promise$2 = function () { + function Promise(resolver) { + this[PROMISE_ID] = nextId(); + this._result = this._state = undefined; + this._subscribers = []; + + if (noop !== resolver) { + typeof resolver !== 'function' && needsResolver(); + this instanceof Promise ? initializePromise(this, resolver) : needsNew(); + } + } + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + Chaining + -------- + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + Assimilation + ------------ + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + If the assimliated promise rejects, then the downstream promise will also reject. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + Simple Example + -------------- + Synchronous Example + ```javascript + let result; + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + Promise Example; + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + Advanced Example + -------------- + Synchronous Example + ```javascript + let author, books; + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + function foundBooks(books) { + } + function failure(reason) { + } + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + Promise Example; + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + + + Promise.prototype.catch = function _catch(onRejection) { + return this.then(null, onRejection); + }; + + /** + `finally` will be invoked regardless of the promise's fate just as native + try/catch/finally behaves + + Synchronous example: + + ```js + findAuthor() { + if (Math.random() > 0.5) { + throw new Error(); + } + return new Author(); + } + + try { + return findAuthor(); // succeed or fail + } catch(error) { + return findOtherAuther(); + } finally { + // always runs + // doesn't affect the return value + } + ``` + + Asynchronous example: + + ```js + findAuthor().catch(function(reason){ + return findOtherAuther(); + }).finally(function(){ + // author was either found, or not + }); + ``` + + @method finally + @param {Function} callback + @return {Promise} + */ + + + Promise.prototype.finally = function _finally(callback) { + var promise = this; + var constructor = promise.constructor; + + if (isFunction(callback)) { + return promise.then(function (value) { + return constructor.resolve(callback()).then(function () { + return value; + }); + }, function (reason) { + return constructor.resolve(callback()).then(function () { + throw reason; + }); + }); + } + + return promise.then(callback, callback); + }; + + return Promise; +}(); + +Promise$2.prototype.then = then; +Promise$2.all = all; +Promise$2.race = race; +Promise$2.resolve = resolve$1; +Promise$2.reject = reject$1; +Promise$2._setScheduler = setScheduler; +Promise$2._setAsap = setAsap; +Promise$2._asap = asap; + +/*global self*/ +function polyfill() { + var local = void 0; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P) { + var promiseToString = null; + try { + promiseToString = Object.prototype.toString.call(P.resolve()); + } catch (e) { + // silently ignored + } + + if (promiseToString === '[object Promise]' && !P.cast) { + return; + } + } + + local.Promise = Promise$2; +} + +// Strange compat.. +Promise$2.polyfill = polyfill; +Promise$2.Promise = Promise$2; + +Promise$2.polyfill(); + +return Promise$2; + +}))); + + + +//# sourceMappingURL=es6-promise.auto.map diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.map b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.map new file mode 100644 index 0000000..a5abce9 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.map @@ -0,0 +1 @@ +{"version":3,"sources":["config/versionTemplate.txt","lib/es6-promise/utils.js","lib/es6-promise/asap.js","lib/es6-promise/then.js","lib/es6-promise/promise/resolve.js","lib/es6-promise/-internal.js","lib/es6-promise/enumerator.js","lib/es6-promise/promise/all.js","lib/es6-promise/promise/race.js","lib/es6-promise/promise/reject.js","lib/es6-promise/promise.js","lib/es6-promise/polyfill.js","lib/es6-promise.js","lib/es6-promise.auto.js"],"sourcesContent":["/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n * @version v4.2.8+1e68dce6\n */\n","export function objectOrFunction(x) {\n var type = typeof x;\n return x !== null && (type === 'object' || type === 'function');\n}\n\nexport function isFunction(x) {\n return typeof x === 'function';\n}\n\nexport function isMaybeThenable(x) {\n return x !== null && typeof x === 'object';\n}\n\nvar _isArray = void 0;\nif (Array.isArray) {\n _isArray = Array.isArray;\n} else {\n _isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n}\n\nexport var isArray = _isArray;","var len = 0;\nvar vertxNext = void 0;\nvar customSchedulerFn = void 0;\n\nexport var asap = function asap(callback, arg) {\n queue[len] = callback;\n queue[len + 1] = arg;\n len += 2;\n if (len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (customSchedulerFn) {\n customSchedulerFn(flush);\n } else {\n scheduleFlush();\n }\n }\n};\n\nexport function setScheduler(scheduleFn) {\n customSchedulerFn = scheduleFn;\n}\n\nexport function setAsap(asapFn) {\n asap = asapFn;\n}\n\nvar browserWindow = typeof window !== 'undefined' ? window : undefined;\nvar browserGlobal = browserWindow || {};\nvar BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\nvar isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n// test for web worker but not in IE10\nvar isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';\n\n// node\nfunction useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function () {\n return process.nextTick(flush);\n };\n}\n\n// vertx\nfunction useVertxTimer() {\n if (typeof vertxNext !== 'undefined') {\n return function () {\n vertxNext(flush);\n };\n }\n\n return useSetTimeout();\n}\n\nfunction useMutationObserver() {\n var iterations = 0;\n var observer = new BrowserMutationObserver(flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function () {\n node.data = iterations = ++iterations % 2;\n };\n}\n\n// web worker\nfunction useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n return function () {\n return channel.port2.postMessage(0);\n };\n}\n\nfunction useSetTimeout() {\n // Store setTimeout reference so es6-promise will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var globalSetTimeout = setTimeout;\n return function () {\n return globalSetTimeout(flush, 1);\n };\n}\n\nvar queue = new Array(1000);\nfunction flush() {\n for (var i = 0; i < len; i += 2) {\n var callback = queue[i];\n var arg = queue[i + 1];\n\n callback(arg);\n\n queue[i] = undefined;\n queue[i + 1] = undefined;\n }\n\n len = 0;\n}\n\nfunction attemptVertx() {\n try {\n var vertx = Function('return this')().require('vertx');\n vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return useVertxTimer();\n } catch (e) {\n return useSetTimeout();\n }\n}\n\nvar scheduleFlush = void 0;\n// Decide what async method to use to triggering processing of queued callbacks:\nif (isNode) {\n scheduleFlush = useNextTick();\n} else if (BrowserMutationObserver) {\n scheduleFlush = useMutationObserver();\n} else if (isWorker) {\n scheduleFlush = useMessageChannel();\n} else if (browserWindow === undefined && typeof require === 'function') {\n scheduleFlush = attemptVertx();\n} else {\n scheduleFlush = useSetTimeout();\n}","import { invokeCallback, subscribe, FULFILLED, REJECTED, noop, makePromise, PROMISE_ID } from './-internal';\n\nimport { asap } from './asap';\n\nexport default function then(onFulfillment, onRejection) {\n var parent = this;\n\n var child = new this.constructor(noop);\n\n if (child[PROMISE_ID] === undefined) {\n makePromise(child);\n }\n\n var _state = parent._state;\n\n\n if (_state) {\n var callback = arguments[_state - 1];\n asap(function () {\n return invokeCallback(_state, child, callback, parent._result);\n });\n } else {\n subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n}","import { noop, resolve as _resolve } from '../-internal';\n\n/**\n `Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n resolve(1);\n });\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.resolve(1);\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n @method resolve\n @static\n @param {Any} value value that the returned promise will be resolved with\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n*/\nexport default function resolve(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(noop);\n _resolve(promise, object);\n return promise;\n}","import { objectOrFunction, isFunction } from './utils';\n\nimport { asap } from './asap';\n\nimport originalThen from './then';\nimport originalResolve from './promise/resolve';\n\nexport var PROMISE_ID = Math.random().toString(36).substring(2);\n\nfunction noop() {}\n\nvar PENDING = void 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\n\nfunction selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n}\n\nfunction cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n}\n\nfunction tryThen(then, value, fulfillmentHandler, rejectionHandler) {\n try {\n then.call(value, fulfillmentHandler, rejectionHandler);\n } catch (e) {\n return e;\n }\n}\n\nfunction handleForeignThenable(promise, thenable, then) {\n asap(function (promise) {\n var sealed = false;\n var error = tryThen(then, thenable, function (value) {\n if (sealed) {\n return;\n }\n sealed = true;\n if (thenable !== value) {\n resolve(promise, value);\n } else {\n fulfill(promise, value);\n }\n }, function (reason) {\n if (sealed) {\n return;\n }\n sealed = true;\n\n reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n reject(promise, error);\n }\n }, promise);\n}\n\nfunction handleOwnThenable(promise, thenable) {\n if (thenable._state === FULFILLED) {\n fulfill(promise, thenable._result);\n } else if (thenable._state === REJECTED) {\n reject(promise, thenable._result);\n } else {\n subscribe(thenable, undefined, function (value) {\n return resolve(promise, value);\n }, function (reason) {\n return reject(promise, reason);\n });\n }\n}\n\nfunction handleMaybeThenable(promise, maybeThenable, then) {\n if (maybeThenable.constructor === promise.constructor && then === originalThen && maybeThenable.constructor.resolve === originalResolve) {\n handleOwnThenable(promise, maybeThenable);\n } else {\n if (then === undefined) {\n fulfill(promise, maybeThenable);\n } else if (isFunction(then)) {\n handleForeignThenable(promise, maybeThenable, then);\n } else {\n fulfill(promise, maybeThenable);\n }\n }\n}\n\nfunction resolve(promise, value) {\n if (promise === value) {\n reject(promise, selfFulfillment());\n } else if (objectOrFunction(value)) {\n var then = void 0;\n try {\n then = value.then;\n } catch (error) {\n reject(promise, error);\n return;\n }\n handleMaybeThenable(promise, value, then);\n } else {\n fulfill(promise, value);\n }\n}\n\nfunction publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n publish(promise);\n}\n\nfunction fulfill(promise, value) {\n if (promise._state !== PENDING) {\n return;\n }\n\n promise._result = value;\n promise._state = FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n asap(publish, promise);\n }\n}\n\nfunction reject(promise, reason) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._state = REJECTED;\n promise._result = reason;\n\n asap(publishRejection, promise);\n}\n\nfunction subscribe(parent, child, onFulfillment, onRejection) {\n var _subscribers = parent._subscribers;\n var length = _subscribers.length;\n\n\n parent._onerror = null;\n\n _subscribers[length] = child;\n _subscribers[length + FULFILLED] = onFulfillment;\n _subscribers[length + REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n asap(publish, parent);\n }\n}\n\nfunction publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) {\n return;\n }\n\n var child = void 0,\n callback = void 0,\n detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n}\n\nfunction invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback),\n value = void 0,\n error = void 0,\n succeeded = true;\n\n if (hasCallback) {\n try {\n value = callback(detail);\n } catch (e) {\n succeeded = false;\n error = e;\n }\n\n if (promise === value) {\n reject(promise, cannotReturnOwn());\n return;\n }\n } else {\n value = detail;\n }\n\n if (promise._state !== PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n resolve(promise, value);\n } else if (succeeded === false) {\n reject(promise, error);\n } else if (settled === FULFILLED) {\n fulfill(promise, value);\n } else if (settled === REJECTED) {\n reject(promise, value);\n }\n}\n\nfunction initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value) {\n resolve(promise, value);\n }, function rejectPromise(reason) {\n reject(promise, reason);\n });\n } catch (e) {\n reject(promise, e);\n }\n}\n\nvar id = 0;\nfunction nextId() {\n return id++;\n}\n\nfunction makePromise(promise) {\n promise[PROMISE_ID] = id++;\n promise._state = undefined;\n promise._result = undefined;\n promise._subscribers = [];\n}\n\nexport { nextId, makePromise, noop, resolve, reject, fulfill, subscribe, publish, publishRejection, initializePromise, invokeCallback, FULFILLED, REJECTED, PENDING, handleMaybeThenable };","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nimport { isArray, isMaybeThenable } from './utils';\nimport { noop, reject, fulfill, subscribe, FULFILLED, REJECTED, PENDING, handleMaybeThenable } from './-internal';\n\nimport then from './then';\nimport Promise from './promise';\nimport originalResolve from './promise/resolve';\nimport originalThen from './then';\nimport { makePromise, PROMISE_ID } from './-internal';\n\nfunction validationError() {\n return new Error('Array Methods must be provided an Array');\n};\n\nvar Enumerator = function () {\n function Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(noop);\n\n if (!this.promise[PROMISE_ID]) {\n makePromise(this.promise);\n }\n\n if (isArray(input)) {\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate(input);\n if (this._remaining === 0) {\n fulfill(this.promise, this._result);\n }\n }\n } else {\n reject(this.promise, validationError());\n }\n }\n\n Enumerator.prototype._enumerate = function _enumerate(input) {\n for (var i = 0; this._state === PENDING && i < input.length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {\n var c = this._instanceConstructor;\n var resolve = c.resolve;\n\n\n if (resolve === originalResolve) {\n var _then = void 0;\n var error = void 0;\n var didError = false;\n try {\n _then = entry.then;\n } catch (e) {\n didError = true;\n error = e;\n }\n\n if (_then === originalThen && entry._state !== PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof _then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === Promise) {\n var promise = new c(noop);\n if (didError) {\n reject(promise, error);\n } else {\n handleMaybeThenable(promise, entry, _then);\n }\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function (resolve) {\n return resolve(entry);\n }), i);\n }\n } else {\n this._willSettleAt(resolve(entry), i);\n }\n };\n\n Enumerator.prototype._settledAt = function _settledAt(state, i, value) {\n var promise = this.promise;\n\n\n if (promise._state === PENDING) {\n this._remaining--;\n\n if (state === REJECTED) {\n reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n fulfill(promise, this._result);\n }\n };\n\n Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {\n var enumerator = this;\n\n subscribe(promise, undefined, function (value) {\n return enumerator._settledAt(FULFILLED, i, value);\n }, function (reason) {\n return enumerator._settledAt(REJECTED, i, reason);\n });\n };\n\n return Enumerator;\n}();\n\nexport default Enumerator;\n;","import Enumerator from '../enumerator';\n\n/**\n `Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = resolve(2);\n let promise3 = resolve(3);\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n\n If any of the `promises` given to `all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises's\n rejection handler. For example:\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = reject(new Error(\"2\"));\n let promise3 = reject(new Error(\"3\"));\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === \"2\"\n });\n ```\n\n @method all\n @static\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n*/\nexport default function all(entries) {\n return new Enumerator(this, entries).promise;\n}","import { isArray } from \"../utils\";\n\n/**\n `Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n\n Example:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 2');\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // result === 'promise 2' because it was resolved before promise1\n // was resolved.\n });\n ```\n\n `Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error('promise 2'));\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === 'promise 2' because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n\n An example real-world use case is implementing timeouts:\n\n ```javascript\n Promise.race([ajax('foo.json'), timeout(5000)])\n ```\n\n @method race\n @static\n @param {Array} promises array of promises to observe\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n*/\nexport default function race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (!isArray(entries)) {\n return new Constructor(function (_, reject) {\n return reject(new TypeError('You must pass an array to race.'));\n });\n } else {\n return new Constructor(function (resolve, reject) {\n var length = entries.length;\n for (var i = 0; i < length; i++) {\n Constructor.resolve(entries[i]).then(resolve, reject);\n }\n });\n }\n}","import { noop, reject as _reject } from '../-internal';\n\n/**\n `Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n reject(new Error('WHOOPS'));\n });\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.reject(new Error('WHOOPS'));\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n @method reject\n @static\n @param {Any} reason value that the returned promise will be rejected with.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n*/\nexport default function reject(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(noop);\n _reject(promise, reason);\n return promise;\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nimport { isFunction } from './utils';\nimport { noop, nextId, PROMISE_ID, initializePromise } from './-internal';\nimport { asap, setAsap, setScheduler } from './asap';\n\nimport all from './promise/all';\nimport race from './promise/race';\nimport Resolve from './promise/resolve';\nimport Reject from './promise/reject';\nimport then from './then';\n\nfunction needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n}\n\nfunction needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n}\n\n/**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n let promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n let xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise.prototype.then = then;\nexport default Promise;\nPromise.all = all;\nPromise.race = race;\nPromise.resolve = Resolve;\nPromise.reject = Reject;\nPromise._setScheduler = setScheduler;\nPromise._setAsap = setAsap;\nPromise._asap = asap;","/*global self*/\nimport Promise from './promise';\n\nexport default function polyfill() {\n var local = void 0;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise;\n}","import Promise from './es6-promise/promise';\nimport polyfill from './es6-promise/polyfill';\n\n// Strange compat..\nPromise.polyfill = polyfill;\nPromise.Promise = Promise;\nexport default Promise;","import Promise from './es6-promise';\nPromise.polyfill();\nexport default Promise;"],"names":["resolve","_resolve","then","originalThen","originalResolve","Promise","reject","_reject","Resolve","Reject"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACNO,SAAS,gBAAgB,CAAC,CAAC,EAAE;EAClC,IAAI,IAAI,GAAG,OAAO,CAAC,CAAC;EACpB,OAAO,CAAC,KAAK,IAAI,KAAK,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,UAAU,CAAC,CAAC;CACjE;;AAED,AAAO,SAAS,UAAU,CAAC,CAAC,EAAE;EAC5B,OAAO,OAAO,CAAC,KAAK,UAAU,CAAC;CAChC;;AAED,AAEC;;AAED,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC;AACtB,IAAI,KAAK,CAAC,OAAO,EAAE;EACjB,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;CAC1B,MAAM;EACL,QAAQ,GAAG,UAAU,CAAC,EAAE;IACtB,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC;GAC/D,CAAC;CACH;;AAED,AAAO,IAAI,OAAO,GAAG,QAAQ;;ACtB7B,IAAI,GAAG,GAAG,CAAC,CAAC;AACZ,IAAI,SAAS,GAAG,KAAK,CAAC,CAAC;AACvB,IAAI,iBAAiB,GAAG,KAAK,CAAC,CAAC;;AAE/B,AAAO,IAAI,IAAI,GAAG,SAAS,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;EAC7C,KAAK,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;EACtB,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;EACrB,GAAG,IAAI,CAAC,CAAC;EACT,IAAI,GAAG,KAAK,CAAC,EAAE;;;;IAIb,IAAI,iBAAiB,EAAE;MACrB,iBAAiB,CAAC,KAAK,CAAC,CAAC;KAC1B,MAAM;MACL,aAAa,EAAE,CAAC;KACjB;GACF;CACF,CAAC;;AAEF,AAAO,SAAS,YAAY,CAAC,UAAU,EAAE;EACvC,iBAAiB,GAAG,UAAU,CAAC;CAChC;;AAED,AAAO,SAAS,OAAO,CAAC,MAAM,EAAE;EAC9B,IAAI,GAAG,MAAM,CAAC;CACf;;AAED,IAAI,aAAa,GAAG,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AACvE,IAAI,aAAa,GAAG,aAAa,IAAI,EAAE,CAAC;AACxC,IAAI,uBAAuB,GAAG,aAAa,CAAC,gBAAgB,IAAI,aAAa,CAAC,sBAAsB,CAAC;AACrG,IAAI,MAAM,GAAG,OAAO,IAAI,KAAK,WAAW,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,kBAAkB,CAAC;;;AAG/H,IAAI,QAAQ,GAAG,OAAO,iBAAiB,KAAK,WAAW,IAAI,OAAO,aAAa,KAAK,WAAW,IAAI,OAAO,cAAc,KAAK,WAAW,CAAC;;;AAGzI,SAAS,WAAW,GAAG;;;EAGrB,OAAO,YAAY;IACjB,OAAO,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;GAChC,CAAC;CACH;;;AAGD,SAAS,aAAa,GAAG;EACvB,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE;IACpC,OAAO,YAAY;MACjB,SAAS,CAAC,KAAK,CAAC,CAAC;KAClB,CAAC;GACH;;EAED,OAAO,aAAa,EAAE,CAAC;CACxB;;AAED,SAAS,mBAAmB,GAAG;EAC7B,IAAI,UAAU,GAAG,CAAC,CAAC;EACnB,IAAI,QAAQ,GAAG,IAAI,uBAAuB,CAAC,KAAK,CAAC,CAAC;EAClD,IAAI,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;EACvC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;;EAEhD,OAAO,YAAY;IACjB,IAAI,CAAC,IAAI,GAAG,UAAU,GAAG,EAAE,UAAU,GAAG,CAAC,CAAC;GAC3C,CAAC;CACH;;;AAGD,SAAS,iBAAiB,GAAG;EAC3B,IAAI,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;EACnC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;EAChC,OAAO,YAAY;IACjB,OAAO,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;GACrC,CAAC;CACH;;AAED,SAAS,aAAa,GAAG;;;EAGvB,IAAI,gBAAgB,GAAG,UAAU,CAAC;EAClC,OAAO,YAAY;IACjB,OAAO,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;GACnC,CAAC;CACH;;AAED,IAAI,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;AAC5B,SAAS,KAAK,GAAG;EACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;IAC/B,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;;IAEvB,QAAQ,CAAC,GAAG,CAAC,CAAC;;IAEd,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACrB,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;GAC1B;;EAED,GAAG,GAAG,CAAC,CAAC;CACT;;AAED,SAAS,YAAY,GAAG;EACtB,IAAI;IACF,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,YAAY,CAAC;IAClD,OAAO,aAAa,EAAE,CAAC;GACxB,CAAC,OAAO,CAAC,EAAE;IACV,OAAO,aAAa,EAAE,CAAC;GACxB;CACF;;AAED,IAAI,aAAa,GAAG,KAAK,CAAC,CAAC;;AAE3B,IAAI,MAAM,EAAE;EACV,aAAa,GAAG,WAAW,EAAE,CAAC;CAC/B,MAAM,IAAI,uBAAuB,EAAE;EAClC,aAAa,GAAG,mBAAmB,EAAE,CAAC;CACvC,MAAM,IAAI,QAAQ,EAAE;EACnB,aAAa,GAAG,iBAAiB,EAAE,CAAC;CACrC,MAAM,IAAI,aAAa,KAAK,SAAS,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;EACvE,aAAa,GAAG,YAAY,EAAE,CAAC;CAChC,MAAM;EACL,aAAa,GAAG,aAAa,EAAE,CAAC;;;CACjC,DCtHc,SAAS,IAAI,CAAC,aAAa,EAAE,WAAW,EAAE;EACvD,IAAI,MAAM,GAAG,IAAI,CAAC;;EAElB,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;;EAEvC,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,SAAS,EAAE;IACnC,WAAW,CAAC,KAAK,CAAC,CAAC;GACpB;;EAED,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;;;EAG3B,IAAI,MAAM,EAAE;IACV,IAAI,QAAQ,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,IAAI,CAAC,YAAY;MACf,OAAO,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;KAChE,CAAC,CAAC;GACJ,MAAM;IACL,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;GACtD;;EAED,OAAO,KAAK,CAAC;;;CACd,DCxBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,AAAe,SAASA,SAAO,CAAC,MAAM,EAAE;;EAEtC,IAAI,WAAW,GAAG,IAAI,CAAC;;EAEvB,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,WAAW,KAAK,WAAW,EAAE;IAC9E,OAAO,MAAM,CAAC;GACf;;EAED,IAAI,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;EACpCC,OAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;EAC1B,OAAO,OAAO,CAAC;;;CAChB,DCrCM,IAAI,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;;AAEhE,SAAS,IAAI,GAAG,EAAE;;AAElB,IAAI,OAAO,GAAG,KAAK,CAAC,CAAC;AACrB,IAAI,SAAS,GAAG,CAAC,CAAC;AAClB,IAAI,QAAQ,GAAG,CAAC,CAAC;;AAEjB,SAAS,eAAe,GAAG;EACzB,OAAO,IAAI,SAAS,CAAC,0CAA0C,CAAC,CAAC;CAClE;;AAED,SAAS,eAAe,GAAG;EACzB,OAAO,IAAI,SAAS,CAAC,sDAAsD,CAAC,CAAC;CAC9E;;AAED,SAAS,OAAO,CAACC,OAAI,EAAE,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE;EAClE,IAAI;IACFA,OAAI,CAAC,IAAI,CAAC,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;GACxD,CAAC,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,CAAC;GACV;CACF;;AAED,SAAS,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAEA,OAAI,EAAE;EACtD,IAAI,CAAC,UAAU,OAAO,EAAE;IACtB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,KAAK,GAAG,OAAO,CAACA,OAAI,EAAE,QAAQ,EAAE,UAAU,KAAK,EAAE;MACnD,IAAI,MAAM,EAAE;QACV,OAAO;OACR;MACD,MAAM,GAAG,IAAI,CAAC;MACd,IAAI,QAAQ,KAAK,KAAK,EAAE;QACtB,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;OACzB,MAAM;QACL,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;OACzB;KACF,EAAE,UAAU,MAAM,EAAE;MACnB,IAAI,MAAM,EAAE;QACV,OAAO;OACR;MACD,MAAM,GAAG,IAAI,CAAC;;MAEd,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACzB,EAAE,UAAU,IAAI,OAAO,CAAC,MAAM,IAAI,kBAAkB,CAAC,CAAC,CAAC;;IAExD,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE;MACpB,MAAM,GAAG,IAAI,CAAC;MACd,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KACxB;GACF,EAAE,OAAO,CAAC,CAAC;CACb;;AAED,SAAS,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE;EAC5C,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE;IACjC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;GACpC,MAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE;IACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;GACnC,MAAM;IACL,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,KAAK,EAAE;MAC9C,OAAO,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KAChC,EAAE,UAAU,MAAM,EAAE;MACnB,OAAO,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC,CAAC;GACJ;CACF;;AAED,SAAS,mBAAmB,CAAC,OAAO,EAAE,aAAa,EAAEA,OAAI,EAAE;EACzD,IAAI,aAAa,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW,IAAIA,OAAI,KAAKC,IAAY,IAAI,aAAa,CAAC,WAAW,CAAC,OAAO,KAAKC,SAAe,EAAE;IACvI,iBAAiB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;GAC3C,MAAM;IACL,IAAIF,OAAI,KAAK,SAAS,EAAE;MACtB,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;KACjC,MAAM,IAAI,UAAU,CAACA,OAAI,CAAC,EAAE;MAC3B,qBAAqB,CAAC,OAAO,EAAE,aAAa,EAAEA,OAAI,CAAC,CAAC;KACrD,MAAM;MACL,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;KACjC;GACF;CACF;;AAED,SAAS,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE;EAC/B,IAAI,OAAO,KAAK,KAAK,EAAE;IACrB,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;GACpC,MAAM,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;IAClC,IAAIA,OAAI,GAAG,KAAK,CAAC,CAAC;IAClB,IAAI;MACFA,OAAI,GAAG,KAAK,CAAC,IAAI,CAAC;KACnB,CAAC,OAAO,KAAK,EAAE;MACd,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;MACvB,OAAO;KACR;IACD,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAEA,OAAI,CAAC,CAAC;GAC3C,MAAM;IACL,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACzB;CACF;;AAED,SAAS,gBAAgB,CAAC,OAAO,EAAE;EACjC,IAAI,OAAO,CAAC,QAAQ,EAAE;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;GACnC;;EAED,OAAO,CAAC,OAAO,CAAC,CAAC;CAClB;;AAED,SAAS,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE;EAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;IAC9B,OAAO;GACR;;EAED,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;EACxB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;;EAE3B,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;IACrC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;GACxB;CACF;;AAED,SAAS,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE;EAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;IAC9B,OAAO;GACR;EACD,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC;EAC1B,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC;;EAEzB,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;CACjC;;AAED,SAAS,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE;EAC5D,IAAI,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;EACvC,IAAI,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;;;EAGjC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;;EAEvB,YAAY,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;EAC7B,YAAY,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,aAAa,CAAC;EACjD,YAAY,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC;;EAE9C,IAAI,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE;IACjC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;GACvB;CACF;;AAED,SAAS,OAAO,CAAC,OAAO,EAAE;EACxB,IAAI,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;EACvC,IAAI,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;;EAE7B,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;IAC5B,OAAO;GACR;;EAED,IAAI,KAAK,GAAG,KAAK,CAAC;MACd,QAAQ,GAAG,KAAK,CAAC;MACjB,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;;EAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;IAC9C,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACvB,QAAQ,GAAG,WAAW,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;;IAEpC,IAAI,KAAK,EAAE;MACT,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KAClD,MAAM;MACL,QAAQ,CAAC,MAAM,CAAC,CAAC;KAClB;GACF;;EAED,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;CACjC;;AAED,SAAS,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;EAC1D,IAAI,WAAW,GAAG,UAAU,CAAC,QAAQ,CAAC;MAClC,KAAK,GAAG,KAAK,CAAC;MACd,KAAK,GAAG,KAAK,CAAC;MACd,SAAS,GAAG,IAAI,CAAC;;EAErB,IAAI,WAAW,EAAE;IACf,IAAI;MACF,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;KAC1B,CAAC,OAAO,CAAC,EAAE;MACV,SAAS,GAAG,KAAK,CAAC;MAClB,KAAK,GAAG,CAAC,CAAC;KACX;;IAED,IAAI,OAAO,KAAK,KAAK,EAAE;MACrB,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;MACnC,OAAO;KACR;GACF,MAAM;IACL,KAAK,GAAG,MAAM,CAAC;GAChB;;EAED,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;;GAE/B,MAAM,IAAI,WAAW,IAAI,SAAS,EAAE;IACnC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACzB,MAAM,IAAI,SAAS,KAAK,KAAK,EAAE;IAC9B,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACxB,MAAM,IAAI,OAAO,KAAK,SAAS,EAAE;IAChC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACzB,MAAM,IAAI,OAAO,KAAK,QAAQ,EAAE;IAC/B,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACxB;CACF;;AAED,SAAS,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE;EAC5C,IAAI;IACF,QAAQ,CAAC,SAAS,cAAc,CAAC,KAAK,EAAE;MACtC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KACzB,EAAE,SAAS,aAAa,CAAC,MAAM,EAAE;MAChC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACzB,CAAC,CAAC;GACJ,CAAC,OAAO,CAAC,EAAE;IACV,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;GACpB;CACF;;AAED,IAAI,EAAE,GAAG,CAAC,CAAC;AACX,SAAS,MAAM,GAAG;EAChB,OAAO,EAAE,EAAE,CAAC;CACb;;AAED,SAAS,WAAW,CAAC,OAAO,EAAE;EAC5B,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC;EAC3B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;EAC3B,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;EAC5B,OAAO,CAAC,YAAY,GAAG,EAAE,CAAC;CAC3B;;AChOD,SAAS,eAAe,GAAG;EACzB,OAAO,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;CAC7D,AAAC;;AAEF,IAAI,UAAU,GAAG,YAAY;EAC3B,SAAS,UAAU,CAAC,WAAW,EAAE,KAAK,EAAE;IACtC,IAAI,CAAC,oBAAoB,GAAG,WAAW,CAAC;IACxC,IAAI,CAAC,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;;IAErC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;MAC7B,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KAC3B;;IAED,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;MAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;MAC3B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;;MAE/B,IAAI,CAAC,OAAO,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;;MAEtC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;OACrC,MAAM;QACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvB,IAAI,IAAI,CAAC,UAAU,KAAK,CAAC,EAAE;UACzB,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;SACrC;OACF;KACF,MAAM;MACL,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;KACzC;GACF;;EAED,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAAK,EAAE;IAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;MAChE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC9B;GACF,CAAC;;EAEF,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE;IAC9D,IAAI,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC;IAClC,IAAIF,UAAO,GAAG,CAAC,CAAC,OAAO,CAAC;;;IAGxB,IAAIA,UAAO,KAAKI,SAAe,EAAE;MAC/B,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC;MACnB,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC;MACnB,IAAI,QAAQ,GAAG,KAAK,CAAC;MACrB,IAAI;QACF,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;OACpB,CAAC,OAAO,CAAC,EAAE;QACV,QAAQ,GAAG,IAAI,CAAC;QAChB,KAAK,GAAG,CAAC,CAAC;OACX;;MAED,IAAI,KAAK,KAAKD,IAAY,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE;QACtD,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;OACjD,MAAM,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;QACtC,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;OACzB,MAAM,IAAI,CAAC,KAAKE,SAAO,EAAE;QACxB,IAAI,OAAO,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,QAAQ,EAAE;UACZ,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SACxB,MAAM;UACL,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC5C;QACD,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;OAChC,MAAM;QACL,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,UAAUL,UAAO,EAAE;UAC1C,OAAOA,UAAO,CAAC,KAAK,CAAC,CAAC;SACvB,CAAC,EAAE,CAAC,CAAC,CAAC;OACR;KACF,MAAM;MACL,IAAI,CAAC,aAAa,CAACA,UAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;KACvC;GACF,CAAC;;EAEF,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE;IACrE,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;;;IAG3B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;MAC9B,IAAI,CAAC,UAAU,EAAE,CAAC;;MAElB,IAAI,KAAK,KAAK,QAAQ,EAAE;QACtB,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;OACxB,MAAM;QACL,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;OACzB;KACF;;IAED,IAAI,IAAI,CAAC,UAAU,KAAK,CAAC,EAAE;MACzB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;KAChC;GACF,CAAC;;EAEF,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,SAAS,aAAa,CAAC,OAAO,EAAE,CAAC,EAAE;IACtE,IAAI,UAAU,GAAG,IAAI,CAAC;;IAEtB,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,KAAK,EAAE;MAC7C,OAAO,UAAU,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;KACnD,EAAE,UAAU,MAAM,EAAE;MACnB,OAAO,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;KACnD,CAAC,CAAC;GACJ,CAAC;;EAEF,OAAO,UAAU,CAAC;CACnB,EAAE;;ACrHH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,AAAe,SAAS,GAAG,CAAC,OAAO,EAAE;EACnC,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC;;;CAC9C,DCjDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,AAAe,SAAS,IAAI,CAAC,OAAO,EAAE;;EAEpC,IAAI,WAAW,GAAG,IAAI,CAAC;;EAEvB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;IACrB,OAAO,IAAI,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE;MAC1C,OAAO,MAAM,CAAC,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAC,CAAC;KACjE,CAAC,CAAC;GACJ,MAAM;IACL,OAAO,IAAI,WAAW,CAAC,UAAU,OAAO,EAAE,MAAM,EAAE;MAChD,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;MAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;OACvD;KACF,CAAC,CAAC;GACJ;;;CACF,DCjFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,AAAe,SAASM,QAAM,CAAC,MAAM,EAAE;;EAErC,IAAI,WAAW,GAAG,IAAI,CAAC;EACvB,IAAI,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;EACpCC,MAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;EACzB,OAAO,OAAO,CAAC;;;CAChB,DC9BD,SAAS,aAAa,GAAG;EACvB,MAAM,IAAI,SAAS,CAAC,oFAAoF,CAAC,CAAC;CAC3G;;AAED,SAAS,QAAQ,GAAG;EAClB,MAAM,IAAI,SAAS,CAAC,uHAAuH,CAAC,CAAC;CAC9I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0GD,IAAIF,SAAO,GAAG,YAAY;EACxB,SAAS,OAAO,CAAC,QAAQ,EAAE;IACzB,IAAI,CAAC,UAAU,CAAC,GAAG,MAAM,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IACvC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;;IAEvB,IAAI,IAAI,KAAK,QAAQ,EAAE;MACrB,OAAO,QAAQ,KAAK,UAAU,IAAI,aAAa,EAAE,CAAC;MAClD,IAAI,YAAY,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAE,CAAC;KAC1E;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4LD,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG,SAAS,MAAM,CAAC,WAAW,EAAE;IACrD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;GACrC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CF,OAAO,CAAC,SAAS,CAAC,OAAO,GAAG,SAAS,QAAQ,CAAC,QAAQ,EAAE;IACtD,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,IAAI,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;;IAEtC,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;MACxB,OAAO,OAAO,CAAC,IAAI,CAAC,UAAU,KAAK,EAAE;QACnC,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY;UACtD,OAAO,KAAK,CAAC;SACd,CAAC,CAAC;OACJ,EAAE,UAAU,MAAM,EAAE;QACnB,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY;UACtD,MAAM,MAAM,CAAC;SACd,CAAC,CAAC;OACJ,CAAC,CAAC;KACJ;;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;GACzC,CAAC;;EAEF,OAAO,OAAO,CAAC;CAChB,EAAE,CAAC;;AAEJA,SAAO,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC;AAC9B,AACAA,SAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AAClBA,SAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AACpBA,SAAO,CAAC,OAAO,GAAGG,SAAO,CAAC;AAC1BH,SAAO,CAAC,MAAM,GAAGI,QAAM,CAAC;AACxBJ,SAAO,CAAC,aAAa,GAAG,YAAY,CAAC;AACrCA,SAAO,CAAC,QAAQ,GAAG,OAAO,CAAC;AAC3BA,SAAO,CAAC,KAAK,GAAG,IAAI;;AC5YpB;AACA,AAEe,SAAS,QAAQ,GAAG;EACjC,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC;;EAEnB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,KAAK,GAAG,MAAM,CAAC;GAChB,MAAM,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;IACtC,KAAK,GAAG,IAAI,CAAC;GACd,MAAM;IACL,IAAI;MACF,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;KACnC,CAAC,OAAO,CAAC,EAAE;MACV,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;KAC7F;GACF;;EAED,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;;EAEtB,IAAI,CAAC,EAAE;IACL,IAAI,eAAe,GAAG,IAAI,CAAC;IAC3B,IAAI;MACF,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KAC/D,CAAC,OAAO,CAAC,EAAE;;KAEX;;IAED,IAAI,eAAe,KAAK,kBAAkB,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;MACrD,OAAO;KACR;GACF;;EAED,KAAK,CAAC,OAAO,GAAGA,SAAO,CAAC;;;CACzB,DC/BD;AACAA,SAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC5BA,SAAO,CAAC,OAAO,GAAGA,SAAO,CAAC;;ACJ1BA,SAAO,CAAC,QAAQ,EAAE,CAAC;;;;;;;;","file":"es6-promise.auto.js"} \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.min.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.min.js new file mode 100644 index 0000000..5a44a3b --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.auto.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){W=t}function r(t){z=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof U?function(){U(a)}:c()}function s(){var t=0,e=new H(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise.prototype.then = then;\nexport default Promise;\nPromise.all = all;\nPromise.race = race;\nPromise.resolve = Resolve;\nPromise.reject = Reject;\nPromise._setScheduler = setScheduler;\nPromise._setAsap = setAsap;\nPromise._asap = asap;","/*global self*/\nimport Promise from './promise';\n\nexport default function polyfill() {\n var local = void 0;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise;\n}","import Promise from './es6-promise/promise';\nimport polyfill from './es6-promise/polyfill';\n\n// Strange compat..\nPromise.polyfill = polyfill;\nPromise.Promise = Promise;\nexport default Promise;","import Promise from './es6-promise';\nPromise.polyfill();\nexport default Promise;"],"names":["resolve","_resolve","then","originalThen","originalResolve","Promise","reject","_reject","Resolve","Reject"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACNO,SAAS,gBAAgB,CAAC,CAAC,EAAE;EAClC,IAAI,IAAI,GAAG,OAAO,CAAC,CAAC;EACpB,OAAO,CAAC,KAAK,IAAI,KAAK,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,UAAU,CAAC,CAAC;CACjE;;AAED,AAAO,SAAS,UAAU,CAAC,CAAC,EAAE;EAC5B,OAAO,OAAO,CAAC,KAAK,UAAU,CAAC;CAChC;;AAED,AAEC;;AAED,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC;AACtB,IAAI,KAAK,CAAC,OAAO,EAAE;EACjB,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;CAC1B,MAAM;EACL,QAAQ,GAAG,UAAU,CAAC,EAAE;IACtB,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC;GAC/D,CAAC;CACH;;AAED,AAAO,IAAI,OAAO,GAAG,QAAQ;;ACtB7B,IAAI,GAAG,GAAG,CAAC,CAAC;AACZ,IAAI,SAAS,GAAG,KAAK,CAAC,CAAC;AACvB,IAAI,iBAAiB,GAAG,KAAK,CAAC,CAAC;;AAE/B,AAAO,IAAI,IAAI,GAAG,SAAS,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;EAC7C,KAAK,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;EACtB,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;EACrB,GAAG,IAAI,CAAC,CAAC;EACT,IAAI,GAAG,KAAK,CAAC,EAAE;;;;IAIb,IAAI,iBAAiB,EAAE;MACrB,iBAAiB,CAAC,KAAK,CAAC,CAAC;KAC1B,MAAM;MACL,aAAa,EAAE,CAAC;KACjB;GACF;CACF,CAAC;;AAEF,AAAO,SAAS,YAAY,CAAC,UAAU,EAAE;EACvC,iBAAiB,GAAG,UAAU,CAAC;CAChC;;AAED,AAAO,SAAS,OAAO,CAAC,MAAM,EAAE;EAC9B,IAAI,GAAG,MAAM,CAAC;CACf;;AAED,IAAI,aAAa,GAAG,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AACvE,IAAI,aAAa,GAAG,aAAa,IAAI,EAAE,CAAC;AACxC,IAAI,uBAAuB,GAAG,aAAa,CAAC,gBAAgB,IAAI,aAAa,CAAC,sBAAsB,CAAC;AACrG,IAAI,MAAM,GAAG,OAAO,IAAI,KAAK,WAAW,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,kBAAkB,CAAC;;;AAG/H,IAAI,QAAQ,GAAG,OAAO,iBAAiB,KAAK,WAAW,IAAI,OAAO,aAAa,KAAK,WAAW,IAAI,OAAO,cAAc,KAAK,WAAW,CAAC;;;AAGzI,SAAS,WAAW,GAAG;;;EAGrB,OAAO,YAAY;IACjB,OAAO,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;GAChC,CAAC;CACH;;;AAGD,SAAS,aAAa,GAAG;EACvB,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE;IACpC,OAAO,YAAY;MACjB,SAAS,CAAC,KAAK,CAAC,CAAC;KAClB,CAAC;GACH;;EAED,OAAO,aAAa,EAAE,CAAC;CACxB;;AAED,SAAS,mBAAmB,GAAG;EAC7B,IAAI,UAAU,GAAG,CAAC,CAAC;EACnB,IAAI,QAAQ,GAAG,IAAI,uBAAuB,CAAC,KAAK,CAAC,CAAC;EAClD,IAAI,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;EACvC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;;EAEhD,OAAO,YAAY;IACjB,IAAI,CAAC,IAAI,GAAG,UAAU,GAAG,EAAE,UAAU,GAAG,CAAC,CAAC;GAC3C,CAAC;CACH;;;AAGD,SAAS,iBAAiB,GAAG;EAC3B,IAAI,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;EACnC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;EAChC,OAAO,YAAY;IACjB,OAAO,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;GACrC,CAAC;CACH;;AAED,SAAS,aAAa,GAAG;;;EAGvB,IAAI,gBAAgB,GAAG,UAAU,CAAC;EAClC,OAAO,YAAY;IACjB,OAAO,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;GACnC,CAAC;CACH;;AAED,IAAI,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;AAC5B,SAAS,KAAK,GAAG;EACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;IAC/B,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;;IAEvB,QAAQ,CAAC,GAAG,CAAC,CAAC;;IAEd,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACrB,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;GAC1B;;EAED,GAAG,GAAG,CAAC,CAAC;CACT;;AAED,SAAS,YAAY,GAAG;EACtB,IAAI;IACF,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,YAAY,CAAC;IAClD,OAAO,aAAa,EAAE,CAAC;GACxB,CAAC,OAAO,CAAC,EAAE;IACV,OAAO,aAAa,EAAE,CAAC;GACxB;CACF;;AAED,IAAI,aAAa,GAAG,KAAK,CAAC,CAAC;;AAE3B,IAAI,MAAM,EAAE;EACV,aAAa,GAAG,WAAW,EAAE,CAAC;CAC/B,MAAM,IAAI,uBAAuB,EAAE;EAClC,aAAa,GAAG,mBAAmB,EAAE,CAAC;CACvC,MAAM,IAAI,QAAQ,EAAE;EACnB,aAAa,GAAG,iBAAiB,EAAE,CAAC;CACrC,MAAM,IAAI,aAAa,KAAK,SAAS,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;EACvE,aAAa,GAAG,YAAY,EAAE,CAAC;CAChC,MAAM;EACL,aAAa,GAAG,aAAa,EAAE,CAAC;;;CACjC,DCtHc,SAAS,IAAI,CAAC,aAAa,EAAE,WAAW,EAAE;EACvD,IAAI,MAAM,GAAG,IAAI,CAAC;;EAElB,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;;EAEvC,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,SAAS,EAAE;IACnC,WAAW,CAAC,KAAK,CAAC,CAAC;GACpB;;EAED,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;;;EAG3B,IAAI,MAAM,EAAE;IACV,IAAI,QAAQ,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,IAAI,CAAC,YAAY;MACf,OAAO,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;KAChE,CAAC,CAAC;GACJ,MAAM;IACL,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;GACtD;;EAED,OAAO,KAAK,CAAC;;;CACd,DCxBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,AAAe,SAASA,SAAO,CAAC,MAAM,EAAE;;EAEtC,IAAI,WAAW,GAAG,IAAI,CAAC;;EAEvB,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,WAAW,KAAK,WAAW,EAAE;IAC9E,OAAO,MAAM,CAAC;GACf;;EAED,IAAI,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;EACpCC,OAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;EAC1B,OAAO,OAAO,CAAC;;;CAChB,DCrCM,IAAI,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;;AAEhE,SAAS,IAAI,GAAG,EAAE;;AAElB,IAAI,OAAO,GAAG,KAAK,CAAC,CAAC;AACrB,IAAI,SAAS,GAAG,CAAC,CAAC;AAClB,IAAI,QAAQ,GAAG,CAAC,CAAC;;AAEjB,SAAS,eAAe,GAAG;EACzB,OAAO,IAAI,SAAS,CAAC,0CAA0C,CAAC,CAAC;CAClE;;AAED,SAAS,eAAe,GAAG;EACzB,OAAO,IAAI,SAAS,CAAC,sDAAsD,CAAC,CAAC;CAC9E;;AAED,SAAS,OAAO,CAACC,OAAI,EAAE,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE;EAClE,IAAI;IACFA,OAAI,CAAC,IAAI,CAAC,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;GACxD,CAAC,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,CAAC;GACV;CACF;;AAED,SAAS,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAEA,OAAI,EAAE;EACtD,IAAI,CAAC,UAAU,OAAO,EAAE;IACtB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,KAAK,GAAG,OAAO,CAACA,OAAI,EAAE,QAAQ,EAAE,UAAU,KAAK,EAAE;MACnD,IAAI,MAAM,EAAE;QACV,OAAO;OACR;MACD,MAAM,GAAG,IAAI,CAAC;MACd,IAAI,QAAQ,KAAK,KAAK,EAAE;QACtB,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;OACzB,MAAM;QACL,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;OACzB;KACF,EAAE,UAAU,MAAM,EAAE;MACnB,IAAI,MAAM,EAAE;QACV,OAAO;OACR;MACD,MAAM,GAAG,IAAI,CAAC;;MAEd,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACzB,EAAE,UAAU,IAAI,OAAO,CAAC,MAAM,IAAI,kBAAkB,CAAC,CAAC,CAAC;;IAExD,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE;MACpB,MAAM,GAAG,IAAI,CAAC;MACd,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KACxB;GACF,EAAE,OAAO,CAAC,CAAC;CACb;;AAED,SAAS,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE;EAC5C,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE;IACjC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;GACpC,MAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE;IACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;GACnC,MAAM;IACL,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,KAAK,EAAE;MAC9C,OAAO,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KAChC,EAAE,UAAU,MAAM,EAAE;MACnB,OAAO,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC,CAAC;GACJ;CACF;;AAED,SAAS,mBAAmB,CAAC,OAAO,EAAE,aAAa,EAAEA,OAAI,EAAE;EACzD,IAAI,aAAa,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW,IAAIA,OAAI,KAAKC,IAAY,IAAI,aAAa,CAAC,WAAW,CAAC,OAAO,KAAKC,SAAe,EAAE;IACvI,iBAAiB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;GAC3C,MAAM;IACL,IAAIF,OAAI,KAAK,SAAS,EAAE;MACtB,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;KACjC,MAAM,IAAI,UAAU,CAACA,OAAI,CAAC,EAAE;MAC3B,qBAAqB,CAAC,OAAO,EAAE,aAAa,EAAEA,OAAI,CAAC,CAAC;KACrD,MAAM;MACL,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;KACjC;GACF;CACF;;AAED,SAAS,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE;EAC/B,IAAI,OAAO,KAAK,KAAK,EAAE;IACrB,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;GACpC,MAAM,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;IAClC,IAAIA,OAAI,GAAG,KAAK,CAAC,CAAC;IAClB,IAAI;MACFA,OAAI,GAAG,KAAK,CAAC,IAAI,CAAC;KACnB,CAAC,OAAO,KAAK,EAAE;MACd,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;MACvB,OAAO;KACR;IACD,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAEA,OAAI,CAAC,CAAC;GAC3C,MAAM;IACL,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACzB;CACF;;AAED,SAAS,gBAAgB,CAAC,OAAO,EAAE;EACjC,IAAI,OAAO,CAAC,QAAQ,EAAE;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;GACnC;;EAED,OAAO,CAAC,OAAO,CAAC,CAAC;CAClB;;AAED,SAAS,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE;EAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;IAC9B,OAAO;GACR;;EAED,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;EACxB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;;EAE3B,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;IACrC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;GACxB;CACF;;AAED,SAAS,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE;EAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;IAC9B,OAAO;GACR;EACD,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC;EAC1B,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC;;EAEzB,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;CACjC;;AAED,SAAS,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE;EAC5D,IAAI,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;EACvC,IAAI,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;;;EAGjC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;;EAEvB,YAAY,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;EAC7B,YAAY,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,aAAa,CAAC;EACjD,YAAY,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC;;EAE9C,IAAI,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE;IACjC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;GACvB;CACF;;AAED,SAAS,OAAO,CAAC,OAAO,EAAE;EACxB,IAAI,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;EACvC,IAAI,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;;EAE7B,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;IAC5B,OAAO;GACR;;EAED,IAAI,KAAK,GAAG,KAAK,CAAC;MACd,QAAQ,GAAG,KAAK,CAAC;MACjB,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;;EAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;IAC9C,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACvB,QAAQ,GAAG,WAAW,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;;IAEpC,IAAI,KAAK,EAAE;MACT,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KAClD,MAAM;MACL,QAAQ,CAAC,MAAM,CAAC,CAAC;KAClB;GACF;;EAED,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;CACjC;;AAED,SAAS,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;EAC1D,IAAI,WAAW,GAAG,UAAU,CAAC,QAAQ,CAAC;MAClC,KAAK,GAAG,KAAK,CAAC;MACd,KAAK,GAAG,KAAK,CAAC;MACd,SAAS,GAAG,IAAI,CAAC;;EAErB,IAAI,WAAW,EAAE;IACf,IAAI;MACF,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;KAC1B,CAAC,OAAO,CAAC,EAAE;MACV,SAAS,GAAG,KAAK,CAAC;MAClB,KAAK,GAAG,CAAC,CAAC;KACX;;IAED,IAAI,OAAO,KAAK,KAAK,EAAE;MACrB,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;MACnC,OAAO;KACR;GACF,MAAM;IACL,KAAK,GAAG,MAAM,CAAC;GAChB;;EAED,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;;GAE/B,MAAM,IAAI,WAAW,IAAI,SAAS,EAAE;IACnC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACzB,MAAM,IAAI,SAAS,KAAK,KAAK,EAAE;IAC9B,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACxB,MAAM,IAAI,OAAO,KAAK,SAAS,EAAE;IAChC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACzB,MAAM,IAAI,OAAO,KAAK,QAAQ,EAAE;IAC/B,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACxB;CACF;;AAED,SAAS,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE;EAC5C,IAAI;IACF,QAAQ,CAAC,SAAS,cAAc,CAAC,KAAK,EAAE;MACtC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KACzB,EAAE,SAAS,aAAa,CAAC,MAAM,EAAE;MAChC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACzB,CAAC,CAAC;GACJ,CAAC,OAAO,CAAC,EAAE;IACV,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;GACpB;CACF;;AAED,IAAI,EAAE,GAAG,CAAC,CAAC;AACX,SAAS,MAAM,GAAG;EAChB,OAAO,EAAE,EAAE,CAAC;CACb;;AAED,SAAS,WAAW,CAAC,OAAO,EAAE;EAC5B,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC;EAC3B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;EAC3B,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;EAC5B,OAAO,CAAC,YAAY,GAAG,EAAE,CAAC;CAC3B;;AChOD,SAAS,eAAe,GAAG;EACzB,OAAO,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;CAC7D,AAAC;;AAEF,IAAI,UAAU,GAAG,YAAY;EAC3B,SAAS,UAAU,CAAC,WAAW,EAAE,KAAK,EAAE;IACtC,IAAI,CAAC,oBAAoB,GAAG,WAAW,CAAC;IACxC,IAAI,CAAC,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;;IAErC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;MAC7B,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KAC3B;;IAED,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;MAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;MAC3B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;;MAE/B,IAAI,CAAC,OAAO,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;;MAEtC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;OACrC,MAAM;QACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvB,IAAI,IAAI,CAAC,UAAU,KAAK,CAAC,EAAE;UACzB,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;SACrC;OACF;KACF,MAAM;MACL,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;KACzC;GACF;;EAED,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAAK,EAAE;IAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;MAChE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC9B;GACF,CAAC;;EAEF,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE;IAC9D,IAAI,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC;IAClC,IAAIF,UAAO,GAAG,CAAC,CAAC,OAAO,CAAC;;;IAGxB,IAAIA,UAAO,KAAKI,SAAe,EAAE;MAC/B,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC;MACnB,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC;MACnB,IAAI,QAAQ,GAAG,KAAK,CAAC;MACrB,IAAI;QACF,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;OACpB,CAAC,OAAO,CAAC,EAAE;QACV,QAAQ,GAAG,IAAI,CAAC;QAChB,KAAK,GAAG,CAAC,CAAC;OACX;;MAED,IAAI,KAAK,KAAKD,IAAY,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE;QACtD,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;OACjD,MAAM,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;QACtC,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;OACzB,MAAM,IAAI,CAAC,KAAKE,SAAO,EAAE;QACxB,IAAI,OAAO,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,QAAQ,EAAE;UACZ,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SACxB,MAAM;UACL,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC5C;QACD,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;OAChC,MAAM;QACL,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,UAAUL,UAAO,EAAE;UAC1C,OAAOA,UAAO,CAAC,KAAK,CAAC,CAAC;SACvB,CAAC,EAAE,CAAC,CAAC,CAAC;OACR;KACF,MAAM;MACL,IAAI,CAAC,aAAa,CAACA,UAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;KACvC;GACF,CAAC;;EAEF,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE;IACrE,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;;;IAG3B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;MAC9B,IAAI,CAAC,UAAU,EAAE,CAAC;;MAElB,IAAI,KAAK,KAAK,QAAQ,EAAE;QACtB,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;OACxB,MAAM;QACL,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;OACzB;KACF;;IAED,IAAI,IAAI,CAAC,UAAU,KAAK,CAAC,EAAE;MACzB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;KAChC;GACF,CAAC;;EAEF,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,SAAS,aAAa,CAAC,OAAO,EAAE,CAAC,EAAE;IACtE,IAAI,UAAU,GAAG,IAAI,CAAC;;IAEtB,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,KAAK,EAAE;MAC7C,OAAO,UAAU,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;KACnD,EAAE,UAAU,MAAM,EAAE;MACnB,OAAO,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;KACnD,CAAC,CAAC;GACJ,CAAC;;EAEF,OAAO,UAAU,CAAC;CACnB,EAAE;;ACrHH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,AAAe,SAAS,GAAG,CAAC,OAAO,EAAE;EACnC,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC;;;CAC9C,DCjDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,AAAe,SAAS,IAAI,CAAC,OAAO,EAAE;;EAEpC,IAAI,WAAW,GAAG,IAAI,CAAC;;EAEvB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;IACrB,OAAO,IAAI,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE;MAC1C,OAAO,MAAM,CAAC,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAC,CAAC;KACjE,CAAC,CAAC;GACJ,MAAM;IACL,OAAO,IAAI,WAAW,CAAC,UAAU,OAAO,EAAE,MAAM,EAAE;MAChD,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;MAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;OACvD;KACF,CAAC,CAAC;GACJ;;;CACF,DCjFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,AAAe,SAASM,QAAM,CAAC,MAAM,EAAE;;EAErC,IAAI,WAAW,GAAG,IAAI,CAAC;EACvB,IAAI,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;EACpCC,MAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;EACzB,OAAO,OAAO,CAAC;;;CAChB,DC9BD,SAAS,aAAa,GAAG;EACvB,MAAM,IAAI,SAAS,CAAC,oFAAoF,CAAC,CAAC;CAC3G;;AAED,SAAS,QAAQ,GAAG;EAClB,MAAM,IAAI,SAAS,CAAC,uHAAuH,CAAC,CAAC;CAC9I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0GD,IAAIF,SAAO,GAAG,YAAY;EACxB,SAAS,OAAO,CAAC,QAAQ,EAAE;IACzB,IAAI,CAAC,UAAU,CAAC,GAAG,MAAM,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IACvC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;;IAEvB,IAAI,IAAI,KAAK,QAAQ,EAAE;MACrB,OAAO,QAAQ,KAAK,UAAU,IAAI,aAAa,EAAE,CAAC;MAClD,IAAI,YAAY,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAE,CAAC;KAC1E;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4LD,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG,SAAS,MAAM,CAAC,WAAW,EAAE;IACrD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;GACrC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CF,OAAO,CAAC,SAAS,CAAC,OAAO,GAAG,SAAS,QAAQ,CAAC,QAAQ,EAAE;IACtD,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,IAAI,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;;IAEtC,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;MACxB,OAAO,OAAO,CAAC,IAAI,CAAC,UAAU,KAAK,EAAE;QACnC,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY;UACtD,OAAO,KAAK,CAAC;SACd,CAAC,CAAC;OACJ,EAAE,UAAU,MAAM,EAAE;QACnB,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY;UACtD,MAAM,MAAM,CAAC;SACd,CAAC,CAAC;OACJ,CAAC,CAAC;KACJ;;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;GACzC,CAAC;;EAEF,OAAO,OAAO,CAAC;CAChB,EAAE,CAAC;;AAEJA,SAAO,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC;AAC9B,AACAA,SAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AAClBA,SAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AACpBA,SAAO,CAAC,OAAO,GAAGG,SAAO,CAAC;AAC1BH,SAAO,CAAC,MAAM,GAAGI,QAAM,CAAC;AACxBJ,SAAO,CAAC,aAAa,GAAG,YAAY,CAAC;AACrCA,SAAO,CAAC,QAAQ,GAAG,OAAO,CAAC;AAC3BA,SAAO,CAAC,KAAK,GAAG,IAAI;;AC5YpB;AACA,AAEe,SAAS,QAAQ,GAAG;EACjC,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC;;EAEnB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,KAAK,GAAG,MAAM,CAAC;GAChB,MAAM,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;IACtC,KAAK,GAAG,IAAI,CAAC;GACd,MAAM;IACL,IAAI;MACF,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;KACnC,CAAC,OAAO,CAAC,EAAE;MACV,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;KAC7F;GACF;;EAED,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;;EAEtB,IAAI,CAAC,EAAE;IACL,IAAI,eAAe,GAAG,IAAI,CAAC;IAC3B,IAAI;MACF,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KAC/D,CAAC,OAAO,CAAC,EAAE;;KAEX;;IAED,IAAI,eAAe,KAAK,kBAAkB,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;MACrD,OAAO;KACR;GACF;;EAED,KAAK,CAAC,OAAO,GAAGA,SAAO,CAAC;;;CACzB,DC/BD;AACAA,SAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC5BA,SAAO,CAAC,OAAO,GAAGA,SAAO,CAAC;;ACJ1BA,SAAO,CAAC,QAAQ,EAAE,CAAC;;;;;;;;","file":"es6-promise.auto.min.js"} \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.js new file mode 100644 index 0000000..72fa0da --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.js @@ -0,0 +1,1174 @@ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version v4.2.8+1e68dce6 + */ + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.ES6Promise = factory()); +}(this, (function () { 'use strict'; + +function objectOrFunction(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); +} + +function isFunction(x) { + return typeof x === 'function'; +} + + + +var _isArray = void 0; +if (Array.isArray) { + _isArray = Array.isArray; +} else { + _isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; +} + +var isArray = _isArray; + +var len = 0; +var vertxNext = void 0; +var customSchedulerFn = void 0; + +var asap = function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (customSchedulerFn) { + customSchedulerFn(flush); + } else { + scheduleFlush(); + } + } +}; + +function setScheduler(scheduleFn) { + customSchedulerFn = scheduleFn; +} + +function setAsap(asapFn) { + asap = asapFn; +} + +var browserWindow = typeof window !== 'undefined' ? window : undefined; +var browserGlobal = browserWindow || {}; +var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; +var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + +// test for web worker but not in IE10 +var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; + +// node +function useNextTick() { + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // see https://github.com/cujojs/when/issues/410 for details + return function () { + return process.nextTick(flush); + }; +} + +// vertx +function useVertxTimer() { + if (typeof vertxNext !== 'undefined') { + return function () { + vertxNext(flush); + }; + } + + return useSetTimeout(); +} + +function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function () { + node.data = iterations = ++iterations % 2; + }; +} + +// web worker +function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function () { + return channel.port2.postMessage(0); + }; +} + +function useSetTimeout() { + // Store setTimeout reference so es6-promise will be unaffected by + // other code modifying setTimeout (like sinon.useFakeTimers()) + var globalSetTimeout = setTimeout; + return function () { + return globalSetTimeout(flush, 1); + }; +} + +var queue = new Array(1000); +function flush() { + for (var i = 0; i < len; i += 2) { + var callback = queue[i]; + var arg = queue[i + 1]; + + callback(arg); + + queue[i] = undefined; + queue[i + 1] = undefined; + } + + len = 0; +} + +function attemptVertx() { + try { + var vertx = Function('return this')().require('vertx'); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch (e) { + return useSetTimeout(); + } +} + +var scheduleFlush = void 0; +// Decide what async method to use to triggering processing of queued callbacks: +if (isNode) { + scheduleFlush = useNextTick(); +} else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); +} else if (isWorker) { + scheduleFlush = useMessageChannel(); +} else if (browserWindow === undefined && typeof require === 'function') { + scheduleFlush = attemptVertx(); +} else { + scheduleFlush = useSetTimeout(); +} + +function then(onFulfillment, onRejection) { + var parent = this; + + var child = new this.constructor(noop); + + if (child[PROMISE_ID] === undefined) { + makePromise(child); + } + + var _state = parent._state; + + + if (_state) { + var callback = arguments[_state - 1]; + asap(function () { + return invokeCallback(_state, child, callback, parent._result); + }); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + + return child; +} + +/** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` +*/ +function resolve$1(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(noop); + resolve(promise, object); + return promise; +} + +var PROMISE_ID = Math.random().toString(36).substring(2); + +function noop() {} + +var PENDING = void 0; +var FULFILLED = 1; +var REJECTED = 2; + +function selfFulfillment() { + return new TypeError("You cannot resolve a promise with itself"); +} + +function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); +} + +function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { + try { + then$$1.call(value, fulfillmentHandler, rejectionHandler); + } catch (e) { + return e; + } +} + +function handleForeignThenable(promise, thenable, then$$1) { + asap(function (promise) { + var sealed = false; + var error = tryThen(then$$1, thenable, function (value) { + if (sealed) { + return; + } + sealed = true; + if (thenable !== value) { + resolve(promise, value); + } else { + fulfill(promise, value); + } + }, function (reason) { + if (sealed) { + return; + } + sealed = true; + + reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + reject(promise, error); + } + }, promise); +} + +function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, function (value) { + return resolve(promise, value); + }, function (reason) { + return reject(promise, reason); + }); + } +} + +function handleMaybeThenable(promise, maybeThenable, then$$1) { + if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { + handleOwnThenable(promise, maybeThenable); + } else { + if (then$$1 === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then$$1)) { + handleForeignThenable(promise, maybeThenable, then$$1); + } else { + fulfill(promise, maybeThenable); + } + } +} + +function resolve(promise, value) { + if (promise === value) { + reject(promise, selfFulfillment()); + } else if (objectOrFunction(value)) { + var then$$1 = void 0; + try { + then$$1 = value.then; + } catch (error) { + reject(promise, error); + return; + } + handleMaybeThenable(promise, value, then$$1); + } else { + fulfill(promise, value); + } +} + +function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + publish(promise); +} + +function fulfill(promise, value) { + if (promise._state !== PENDING) { + return; + } + + promise._result = value; + promise._state = FULFILLED; + + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } +} + +function reject(promise, reason) { + if (promise._state !== PENDING) { + return; + } + promise._state = REJECTED; + promise._result = reason; + + asap(publishRejection, promise); +} + +function subscribe(parent, child, onFulfillment, onRejection) { + var _subscribers = parent._subscribers; + var length = _subscribers.length; + + + parent._onerror = null; + + _subscribers[length] = child; + _subscribers[length + FULFILLED] = onFulfillment; + _subscribers[length + REJECTED] = onRejection; + + if (length === 0 && parent._state) { + asap(publish, parent); + } +} + +function publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { + return; + } + + var child = void 0, + callback = void 0, + detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; +} + +function invokeCallback(settled, promise, callback, detail) { + var hasCallback = isFunction(callback), + value = void 0, + error = void 0, + succeeded = true; + + if (hasCallback) { + try { + value = callback(detail); + } catch (e) { + succeeded = false; + error = e; + } + + if (promise === value) { + reject(promise, cannotReturnOwn()); + return; + } + } else { + value = detail; + } + + if (promise._state !== PENDING) { + // noop + } else if (hasCallback && succeeded) { + resolve(promise, value); + } else if (succeeded === false) { + reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + reject(promise, value); + } +} + +function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value) { + resolve(promise, value); + }, function rejectPromise(reason) { + reject(promise, reason); + }); + } catch (e) { + reject(promise, e); + } +} + +var id = 0; +function nextId() { + return id++; +} + +function makePromise(promise) { + promise[PROMISE_ID] = id++; + promise._state = undefined; + promise._result = undefined; + promise._subscribers = []; +} + +function validationError() { + return new Error('Array Methods must be provided an Array'); +} + +var Enumerator = function () { + function Enumerator(Constructor, input) { + this._instanceConstructor = Constructor; + this.promise = new Constructor(noop); + + if (!this.promise[PROMISE_ID]) { + makePromise(this.promise); + } + + if (isArray(input)) { + this.length = input.length; + this._remaining = input.length; + + this._result = new Array(this.length); + + if (this.length === 0) { + fulfill(this.promise, this._result); + } else { + this.length = this.length || 0; + this._enumerate(input); + if (this._remaining === 0) { + fulfill(this.promise, this._result); + } + } + } else { + reject(this.promise, validationError()); + } + } + + Enumerator.prototype._enumerate = function _enumerate(input) { + for (var i = 0; this._state === PENDING && i < input.length; i++) { + this._eachEntry(input[i], i); + } + }; + + Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { + var c = this._instanceConstructor; + var resolve$$1 = c.resolve; + + + if (resolve$$1 === resolve$1) { + var _then = void 0; + var error = void 0; + var didError = false; + try { + _then = entry.then; + } catch (e) { + didError = true; + error = e; + } + + if (_then === then && entry._state !== PENDING) { + this._settledAt(entry._state, i, entry._result); + } else if (typeof _then !== 'function') { + this._remaining--; + this._result[i] = entry; + } else if (c === Promise$1) { + var promise = new c(noop); + if (didError) { + reject(promise, error); + } else { + handleMaybeThenable(promise, entry, _then); + } + this._willSettleAt(promise, i); + } else { + this._willSettleAt(new c(function (resolve$$1) { + return resolve$$1(entry); + }), i); + } + } else { + this._willSettleAt(resolve$$1(entry), i); + } + }; + + Enumerator.prototype._settledAt = function _settledAt(state, i, value) { + var promise = this.promise; + + + if (promise._state === PENDING) { + this._remaining--; + + if (state === REJECTED) { + reject(promise, value); + } else { + this._result[i] = value; + } + } + + if (this._remaining === 0) { + fulfill(promise, this._result); + } + }; + + Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { + var enumerator = this; + + subscribe(promise, undefined, function (value) { + return enumerator._settledAt(FULFILLED, i, value); + }, function (reason) { + return enumerator._settledAt(REJECTED, i, reason); + }); + }; + + return Enumerator; +}(); + +/** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = resolve(2); + let promise3 = resolve(3); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = reject(new Error("2")); + let promise3 = reject(new Error("3")); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static +*/ +function all(entries) { + return new Enumerator(this, entries).promise; +} + +/** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. +*/ +function race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + if (!isArray(entries)) { + return new Constructor(function (_, reject) { + return reject(new TypeError('You must pass an array to race.')); + }); + } else { + return new Constructor(function (resolve, reject) { + var length = entries.length; + for (var i = 0; i < length; i++) { + Constructor.resolve(entries[i]).then(resolve, reject); + } + }); + } +} + +/** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. +*/ +function reject$1(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(noop); + reject(promise, reason); + return promise; +} + +function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); +} + +function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); +} + +/** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + let promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + let xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {Function} resolver + Useful for tooling. + @constructor +*/ + +var Promise$1 = function () { + function Promise(resolver) { + this[PROMISE_ID] = nextId(); + this._result = this._state = undefined; + this._subscribers = []; + + if (noop !== resolver) { + typeof resolver !== 'function' && needsResolver(); + this instanceof Promise ? initializePromise(this, resolver) : needsNew(); + } + } + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + Chaining + -------- + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + Assimilation + ------------ + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + If the assimliated promise rejects, then the downstream promise will also reject. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + Simple Example + -------------- + Synchronous Example + ```javascript + let result; + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + Promise Example; + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + Advanced Example + -------------- + Synchronous Example + ```javascript + let author, books; + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + function foundBooks(books) { + } + function failure(reason) { + } + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + Promise Example; + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + + + Promise.prototype.catch = function _catch(onRejection) { + return this.then(null, onRejection); + }; + + /** + `finally` will be invoked regardless of the promise's fate just as native + try/catch/finally behaves + + Synchronous example: + + ```js + findAuthor() { + if (Math.random() > 0.5) { + throw new Error(); + } + return new Author(); + } + + try { + return findAuthor(); // succeed or fail + } catch(error) { + return findOtherAuther(); + } finally { + // always runs + // doesn't affect the return value + } + ``` + + Asynchronous example: + + ```js + findAuthor().catch(function(reason){ + return findOtherAuther(); + }).finally(function(){ + // author was either found, or not + }); + ``` + + @method finally + @param {Function} callback + @return {Promise} + */ + + + Promise.prototype.finally = function _finally(callback) { + var promise = this; + var constructor = promise.constructor; + + if (isFunction(callback)) { + return promise.then(function (value) { + return constructor.resolve(callback()).then(function () { + return value; + }); + }, function (reason) { + return constructor.resolve(callback()).then(function () { + throw reason; + }); + }); + } + + return promise.then(callback, callback); + }; + + return Promise; +}(); + +Promise$1.prototype.then = then; +Promise$1.all = all; +Promise$1.race = race; +Promise$1.resolve = resolve$1; +Promise$1.reject = reject$1; +Promise$1._setScheduler = setScheduler; +Promise$1._setAsap = setAsap; +Promise$1._asap = asap; + +/*global self*/ +function polyfill() { + var local = void 0; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P) { + var promiseToString = null; + try { + promiseToString = Object.prototype.toString.call(P.resolve()); + } catch (e) { + // silently ignored + } + + if (promiseToString === '[object Promise]' && !P.cast) { + return; + } + } + + local.Promise = Promise$1; +} + +// Strange compat.. +Promise$1.polyfill = polyfill; +Promise$1.Promise = Promise$1; + +return Promise$1; + +}))); + + + +//# sourceMappingURL=es6-promise.map diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.map b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.map new file mode 100644 index 0000000..27db414 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.map @@ -0,0 +1 @@ +{"version":3,"sources":["config/versionTemplate.txt","lib/es6-promise/utils.js","lib/es6-promise/asap.js","lib/es6-promise/then.js","lib/es6-promise/promise/resolve.js","lib/es6-promise/-internal.js","lib/es6-promise/enumerator.js","lib/es6-promise/promise/all.js","lib/es6-promise/promise/race.js","lib/es6-promise/promise/reject.js","lib/es6-promise/promise.js","lib/es6-promise/polyfill.js","lib/es6-promise.js"],"sourcesContent":["/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n * @version v4.2.8+1e68dce6\n */\n","export function objectOrFunction(x) {\n var type = typeof x;\n return x !== null && (type === 'object' || type === 'function');\n}\n\nexport function isFunction(x) {\n return typeof x === 'function';\n}\n\nexport function isMaybeThenable(x) {\n return x !== null && typeof x === 'object';\n}\n\nvar _isArray = void 0;\nif (Array.isArray) {\n _isArray = Array.isArray;\n} else {\n _isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n}\n\nexport var isArray = _isArray;","var len = 0;\nvar vertxNext = void 0;\nvar customSchedulerFn = void 0;\n\nexport var asap = function asap(callback, arg) {\n queue[len] = callback;\n queue[len + 1] = arg;\n len += 2;\n if (len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (customSchedulerFn) {\n customSchedulerFn(flush);\n } else {\n scheduleFlush();\n }\n }\n};\n\nexport function setScheduler(scheduleFn) {\n customSchedulerFn = scheduleFn;\n}\n\nexport function setAsap(asapFn) {\n asap = asapFn;\n}\n\nvar browserWindow = typeof window !== 'undefined' ? window : undefined;\nvar browserGlobal = browserWindow || {};\nvar BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\nvar isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n// test for web worker but not in IE10\nvar isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';\n\n// node\nfunction useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function () {\n return process.nextTick(flush);\n };\n}\n\n// vertx\nfunction useVertxTimer() {\n if (typeof vertxNext !== 'undefined') {\n return function () {\n vertxNext(flush);\n };\n }\n\n return useSetTimeout();\n}\n\nfunction useMutationObserver() {\n var iterations = 0;\n var observer = new BrowserMutationObserver(flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function () {\n node.data = iterations = ++iterations % 2;\n };\n}\n\n// web worker\nfunction useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n return function () {\n return channel.port2.postMessage(0);\n };\n}\n\nfunction useSetTimeout() {\n // Store setTimeout reference so es6-promise will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var globalSetTimeout = setTimeout;\n return function () {\n return globalSetTimeout(flush, 1);\n };\n}\n\nvar queue = new Array(1000);\nfunction flush() {\n for (var i = 0; i < len; i += 2) {\n var callback = queue[i];\n var arg = queue[i + 1];\n\n callback(arg);\n\n queue[i] = undefined;\n queue[i + 1] = undefined;\n }\n\n len = 0;\n}\n\nfunction attemptVertx() {\n try {\n var vertx = Function('return this')().require('vertx');\n vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return useVertxTimer();\n } catch (e) {\n return useSetTimeout();\n }\n}\n\nvar scheduleFlush = void 0;\n// Decide what async method to use to triggering processing of queued callbacks:\nif (isNode) {\n scheduleFlush = useNextTick();\n} else if (BrowserMutationObserver) {\n scheduleFlush = useMutationObserver();\n} else if (isWorker) {\n scheduleFlush = useMessageChannel();\n} else if (browserWindow === undefined && typeof require === 'function') {\n scheduleFlush = attemptVertx();\n} else {\n scheduleFlush = useSetTimeout();\n}","import { invokeCallback, subscribe, FULFILLED, REJECTED, noop, makePromise, PROMISE_ID } from './-internal';\n\nimport { asap } from './asap';\n\nexport default function then(onFulfillment, onRejection) {\n var parent = this;\n\n var child = new this.constructor(noop);\n\n if (child[PROMISE_ID] === undefined) {\n makePromise(child);\n }\n\n var _state = parent._state;\n\n\n if (_state) {\n var callback = arguments[_state - 1];\n asap(function () {\n return invokeCallback(_state, child, callback, parent._result);\n });\n } else {\n subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n}","import { noop, resolve as _resolve } from '../-internal';\n\n/**\n `Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n resolve(1);\n });\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.resolve(1);\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n @method resolve\n @static\n @param {Any} value value that the returned promise will be resolved with\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n*/\nexport default function resolve(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(noop);\n _resolve(promise, object);\n return promise;\n}","import { objectOrFunction, isFunction } from './utils';\n\nimport { asap } from './asap';\n\nimport originalThen from './then';\nimport originalResolve from './promise/resolve';\n\nexport var PROMISE_ID = Math.random().toString(36).substring(2);\n\nfunction noop() {}\n\nvar PENDING = void 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\n\nfunction selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n}\n\nfunction cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n}\n\nfunction tryThen(then, value, fulfillmentHandler, rejectionHandler) {\n try {\n then.call(value, fulfillmentHandler, rejectionHandler);\n } catch (e) {\n return e;\n }\n}\n\nfunction handleForeignThenable(promise, thenable, then) {\n asap(function (promise) {\n var sealed = false;\n var error = tryThen(then, thenable, function (value) {\n if (sealed) {\n return;\n }\n sealed = true;\n if (thenable !== value) {\n resolve(promise, value);\n } else {\n fulfill(promise, value);\n }\n }, function (reason) {\n if (sealed) {\n return;\n }\n sealed = true;\n\n reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n reject(promise, error);\n }\n }, promise);\n}\n\nfunction handleOwnThenable(promise, thenable) {\n if (thenable._state === FULFILLED) {\n fulfill(promise, thenable._result);\n } else if (thenable._state === REJECTED) {\n reject(promise, thenable._result);\n } else {\n subscribe(thenable, undefined, function (value) {\n return resolve(promise, value);\n }, function (reason) {\n return reject(promise, reason);\n });\n }\n}\n\nfunction handleMaybeThenable(promise, maybeThenable, then) {\n if (maybeThenable.constructor === promise.constructor && then === originalThen && maybeThenable.constructor.resolve === originalResolve) {\n handleOwnThenable(promise, maybeThenable);\n } else {\n if (then === undefined) {\n fulfill(promise, maybeThenable);\n } else if (isFunction(then)) {\n handleForeignThenable(promise, maybeThenable, then);\n } else {\n fulfill(promise, maybeThenable);\n }\n }\n}\n\nfunction resolve(promise, value) {\n if (promise === value) {\n reject(promise, selfFulfillment());\n } else if (objectOrFunction(value)) {\n var then = void 0;\n try {\n then = value.then;\n } catch (error) {\n reject(promise, error);\n return;\n }\n handleMaybeThenable(promise, value, then);\n } else {\n fulfill(promise, value);\n }\n}\n\nfunction publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n publish(promise);\n}\n\nfunction fulfill(promise, value) {\n if (promise._state !== PENDING) {\n return;\n }\n\n promise._result = value;\n promise._state = FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n asap(publish, promise);\n }\n}\n\nfunction reject(promise, reason) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._state = REJECTED;\n promise._result = reason;\n\n asap(publishRejection, promise);\n}\n\nfunction subscribe(parent, child, onFulfillment, onRejection) {\n var _subscribers = parent._subscribers;\n var length = _subscribers.length;\n\n\n parent._onerror = null;\n\n _subscribers[length] = child;\n _subscribers[length + FULFILLED] = onFulfillment;\n _subscribers[length + REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n asap(publish, parent);\n }\n}\n\nfunction publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) {\n return;\n }\n\n var child = void 0,\n callback = void 0,\n detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n}\n\nfunction invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback),\n value = void 0,\n error = void 0,\n succeeded = true;\n\n if (hasCallback) {\n try {\n value = callback(detail);\n } catch (e) {\n succeeded = false;\n error = e;\n }\n\n if (promise === value) {\n reject(promise, cannotReturnOwn());\n return;\n }\n } else {\n value = detail;\n }\n\n if (promise._state !== PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n resolve(promise, value);\n } else if (succeeded === false) {\n reject(promise, error);\n } else if (settled === FULFILLED) {\n fulfill(promise, value);\n } else if (settled === REJECTED) {\n reject(promise, value);\n }\n}\n\nfunction initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value) {\n resolve(promise, value);\n }, function rejectPromise(reason) {\n reject(promise, reason);\n });\n } catch (e) {\n reject(promise, e);\n }\n}\n\nvar id = 0;\nfunction nextId() {\n return id++;\n}\n\nfunction makePromise(promise) {\n promise[PROMISE_ID] = id++;\n promise._state = undefined;\n promise._result = undefined;\n promise._subscribers = [];\n}\n\nexport { nextId, makePromise, noop, resolve, reject, fulfill, subscribe, publish, publishRejection, initializePromise, invokeCallback, FULFILLED, REJECTED, PENDING, handleMaybeThenable };","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nimport { isArray, isMaybeThenable } from './utils';\nimport { noop, reject, fulfill, subscribe, FULFILLED, REJECTED, PENDING, handleMaybeThenable } from './-internal';\n\nimport then from './then';\nimport Promise from './promise';\nimport originalResolve from './promise/resolve';\nimport originalThen from './then';\nimport { makePromise, PROMISE_ID } from './-internal';\n\nfunction validationError() {\n return new Error('Array Methods must be provided an Array');\n};\n\nvar Enumerator = function () {\n function Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(noop);\n\n if (!this.promise[PROMISE_ID]) {\n makePromise(this.promise);\n }\n\n if (isArray(input)) {\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate(input);\n if (this._remaining === 0) {\n fulfill(this.promise, this._result);\n }\n }\n } else {\n reject(this.promise, validationError());\n }\n }\n\n Enumerator.prototype._enumerate = function _enumerate(input) {\n for (var i = 0; this._state === PENDING && i < input.length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {\n var c = this._instanceConstructor;\n var resolve = c.resolve;\n\n\n if (resolve === originalResolve) {\n var _then = void 0;\n var error = void 0;\n var didError = false;\n try {\n _then = entry.then;\n } catch (e) {\n didError = true;\n error = e;\n }\n\n if (_then === originalThen && entry._state !== PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof _then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === Promise) {\n var promise = new c(noop);\n if (didError) {\n reject(promise, error);\n } else {\n handleMaybeThenable(promise, entry, _then);\n }\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function (resolve) {\n return resolve(entry);\n }), i);\n }\n } else {\n this._willSettleAt(resolve(entry), i);\n }\n };\n\n Enumerator.prototype._settledAt = function _settledAt(state, i, value) {\n var promise = this.promise;\n\n\n if (promise._state === PENDING) {\n this._remaining--;\n\n if (state === REJECTED) {\n reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n fulfill(promise, this._result);\n }\n };\n\n Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {\n var enumerator = this;\n\n subscribe(promise, undefined, function (value) {\n return enumerator._settledAt(FULFILLED, i, value);\n }, function (reason) {\n return enumerator._settledAt(REJECTED, i, reason);\n });\n };\n\n return Enumerator;\n}();\n\nexport default Enumerator;\n;","import Enumerator from '../enumerator';\n\n/**\n `Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = resolve(2);\n let promise3 = resolve(3);\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n\n If any of the `promises` given to `all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises's\n rejection handler. For example:\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = reject(new Error(\"2\"));\n let promise3 = reject(new Error(\"3\"));\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === \"2\"\n });\n ```\n\n @method all\n @static\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n*/\nexport default function all(entries) {\n return new Enumerator(this, entries).promise;\n}","import { isArray } from \"../utils\";\n\n/**\n `Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n\n Example:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 2');\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // result === 'promise 2' because it was resolved before promise1\n // was resolved.\n });\n ```\n\n `Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error('promise 2'));\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === 'promise 2' because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n\n An example real-world use case is implementing timeouts:\n\n ```javascript\n Promise.race([ajax('foo.json'), timeout(5000)])\n ```\n\n @method race\n @static\n @param {Array} promises array of promises to observe\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n*/\nexport default function race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (!isArray(entries)) {\n return new Constructor(function (_, reject) {\n return reject(new TypeError('You must pass an array to race.'));\n });\n } else {\n return new Constructor(function (resolve, reject) {\n var length = entries.length;\n for (var i = 0; i < length; i++) {\n Constructor.resolve(entries[i]).then(resolve, reject);\n }\n });\n }\n}","import { noop, reject as _reject } from '../-internal';\n\n/**\n `Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n reject(new Error('WHOOPS'));\n });\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.reject(new Error('WHOOPS'));\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n @method reject\n @static\n @param {Any} reason value that the returned promise will be rejected with.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n*/\nexport default function reject(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(noop);\n _reject(promise, reason);\n return promise;\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nimport { isFunction } from './utils';\nimport { noop, nextId, PROMISE_ID, initializePromise } from './-internal';\nimport { asap, setAsap, setScheduler } from './asap';\n\nimport all from './promise/all';\nimport race from './promise/race';\nimport Resolve from './promise/resolve';\nimport Reject from './promise/reject';\nimport then from './then';\n\nfunction needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n}\n\nfunction needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n}\n\n/**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n let promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n let xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise.prototype.then = then;\nexport default Promise;\nPromise.all = all;\nPromise.race = race;\nPromise.resolve = Resolve;\nPromise.reject = Reject;\nPromise._setScheduler = setScheduler;\nPromise._setAsap = setAsap;\nPromise._asap = asap;","/*global self*/\nimport Promise from './promise';\n\nexport default function polyfill() {\n var local = void 0;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise;\n}","import Promise from './es6-promise/promise';\nimport polyfill from './es6-promise/polyfill';\n\n// Strange compat..\nPromise.polyfill = polyfill;\nPromise.Promise = Promise;\nexport default Promise;"],"names":["resolve","_resolve","then","originalThen","originalResolve","Promise","reject","_reject","Resolve","Reject"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACNO,SAAS,gBAAgB,CAAC,CAAC,EAAE;EAClC,IAAI,IAAI,GAAG,OAAO,CAAC,CAAC;EACpB,OAAO,CAAC,KAAK,IAAI,KAAK,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,UAAU,CAAC,CAAC;CACjE;;AAED,AAAO,SAAS,UAAU,CAAC,CAAC,EAAE;EAC5B,OAAO,OAAO,CAAC,KAAK,UAAU,CAAC;CAChC;;AAED,AAEC;;AAED,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC;AACtB,IAAI,KAAK,CAAC,OAAO,EAAE;EACjB,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;CAC1B,MAAM;EACL,QAAQ,GAAG,UAAU,CAAC,EAAE;IACtB,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC;GAC/D,CAAC;CACH;;AAED,AAAO,IAAI,OAAO,GAAG,QAAQ;;ACtB7B,IAAI,GAAG,GAAG,CAAC,CAAC;AACZ,IAAI,SAAS,GAAG,KAAK,CAAC,CAAC;AACvB,IAAI,iBAAiB,GAAG,KAAK,CAAC,CAAC;;AAE/B,AAAO,IAAI,IAAI,GAAG,SAAS,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;EAC7C,KAAK,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;EACtB,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;EACrB,GAAG,IAAI,CAAC,CAAC;EACT,IAAI,GAAG,KAAK,CAAC,EAAE;;;;IAIb,IAAI,iBAAiB,EAAE;MACrB,iBAAiB,CAAC,KAAK,CAAC,CAAC;KAC1B,MAAM;MACL,aAAa,EAAE,CAAC;KACjB;GACF;CACF,CAAC;;AAEF,AAAO,SAAS,YAAY,CAAC,UAAU,EAAE;EACvC,iBAAiB,GAAG,UAAU,CAAC;CAChC;;AAED,AAAO,SAAS,OAAO,CAAC,MAAM,EAAE;EAC9B,IAAI,GAAG,MAAM,CAAC;CACf;;AAED,IAAI,aAAa,GAAG,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AACvE,IAAI,aAAa,GAAG,aAAa,IAAI,EAAE,CAAC;AACxC,IAAI,uBAAuB,GAAG,aAAa,CAAC,gBAAgB,IAAI,aAAa,CAAC,sBAAsB,CAAC;AACrG,IAAI,MAAM,GAAG,OAAO,IAAI,KAAK,WAAW,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,kBAAkB,CAAC;;;AAG/H,IAAI,QAAQ,GAAG,OAAO,iBAAiB,KAAK,WAAW,IAAI,OAAO,aAAa,KAAK,WAAW,IAAI,OAAO,cAAc,KAAK,WAAW,CAAC;;;AAGzI,SAAS,WAAW,GAAG;;;EAGrB,OAAO,YAAY;IACjB,OAAO,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;GAChC,CAAC;CACH;;;AAGD,SAAS,aAAa,GAAG;EACvB,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE;IACpC,OAAO,YAAY;MACjB,SAAS,CAAC,KAAK,CAAC,CAAC;KAClB,CAAC;GACH;;EAED,OAAO,aAAa,EAAE,CAAC;CACxB;;AAED,SAAS,mBAAmB,GAAG;EAC7B,IAAI,UAAU,GAAG,CAAC,CAAC;EACnB,IAAI,QAAQ,GAAG,IAAI,uBAAuB,CAAC,KAAK,CAAC,CAAC;EAClD,IAAI,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;EACvC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;;EAEhD,OAAO,YAAY;IACjB,IAAI,CAAC,IAAI,GAAG,UAAU,GAAG,EAAE,UAAU,GAAG,CAAC,CAAC;GAC3C,CAAC;CACH;;;AAGD,SAAS,iBAAiB,GAAG;EAC3B,IAAI,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;EACnC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;EAChC,OAAO,YAAY;IACjB,OAAO,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;GACrC,CAAC;CACH;;AAED,SAAS,aAAa,GAAG;;;EAGvB,IAAI,gBAAgB,GAAG,UAAU,CAAC;EAClC,OAAO,YAAY;IACjB,OAAO,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;GACnC,CAAC;CACH;;AAED,IAAI,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;AAC5B,SAAS,KAAK,GAAG;EACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;IAC/B,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;;IAEvB,QAAQ,CAAC,GAAG,CAAC,CAAC;;IAEd,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACrB,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;GAC1B;;EAED,GAAG,GAAG,CAAC,CAAC;CACT;;AAED,SAAS,YAAY,GAAG;EACtB,IAAI;IACF,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,YAAY,CAAC;IAClD,OAAO,aAAa,EAAE,CAAC;GACxB,CAAC,OAAO,CAAC,EAAE;IACV,OAAO,aAAa,EAAE,CAAC;GACxB;CACF;;AAED,IAAI,aAAa,GAAG,KAAK,CAAC,CAAC;;AAE3B,IAAI,MAAM,EAAE;EACV,aAAa,GAAG,WAAW,EAAE,CAAC;CAC/B,MAAM,IAAI,uBAAuB,EAAE;EAClC,aAAa,GAAG,mBAAmB,EAAE,CAAC;CACvC,MAAM,IAAI,QAAQ,EAAE;EACnB,aAAa,GAAG,iBAAiB,EAAE,CAAC;CACrC,MAAM,IAAI,aAAa,KAAK,SAAS,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;EACvE,aAAa,GAAG,YAAY,EAAE,CAAC;CAChC,MAAM;EACL,aAAa,GAAG,aAAa,EAAE,CAAC;;;CACjC,DCtHc,SAAS,IAAI,CAAC,aAAa,EAAE,WAAW,EAAE;EACvD,IAAI,MAAM,GAAG,IAAI,CAAC;;EAElB,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;;EAEvC,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,SAAS,EAAE;IACnC,WAAW,CAAC,KAAK,CAAC,CAAC;GACpB;;EAED,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;;;EAG3B,IAAI,MAAM,EAAE;IACV,IAAI,QAAQ,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,IAAI,CAAC,YAAY;MACf,OAAO,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;KAChE,CAAC,CAAC;GACJ,MAAM;IACL,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;GACtD;;EAED,OAAO,KAAK,CAAC;;;CACd,DCxBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,AAAe,SAASA,SAAO,CAAC,MAAM,EAAE;;EAEtC,IAAI,WAAW,GAAG,IAAI,CAAC;;EAEvB,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,WAAW,KAAK,WAAW,EAAE;IAC9E,OAAO,MAAM,CAAC;GACf;;EAED,IAAI,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;EACpCC,OAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;EAC1B,OAAO,OAAO,CAAC;;;CAChB,DCrCM,IAAI,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;;AAEhE,SAAS,IAAI,GAAG,EAAE;;AAElB,IAAI,OAAO,GAAG,KAAK,CAAC,CAAC;AACrB,IAAI,SAAS,GAAG,CAAC,CAAC;AAClB,IAAI,QAAQ,GAAG,CAAC,CAAC;;AAEjB,SAAS,eAAe,GAAG;EACzB,OAAO,IAAI,SAAS,CAAC,0CAA0C,CAAC,CAAC;CAClE;;AAED,SAAS,eAAe,GAAG;EACzB,OAAO,IAAI,SAAS,CAAC,sDAAsD,CAAC,CAAC;CAC9E;;AAED,SAAS,OAAO,CAACC,OAAI,EAAE,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE;EAClE,IAAI;IACFA,OAAI,CAAC,IAAI,CAAC,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;GACxD,CAAC,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,CAAC;GACV;CACF;;AAED,SAAS,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAEA,OAAI,EAAE;EACtD,IAAI,CAAC,UAAU,OAAO,EAAE;IACtB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,KAAK,GAAG,OAAO,CAACA,OAAI,EAAE,QAAQ,EAAE,UAAU,KAAK,EAAE;MACnD,IAAI,MAAM,EAAE;QACV,OAAO;OACR;MACD,MAAM,GAAG,IAAI,CAAC;MACd,IAAI,QAAQ,KAAK,KAAK,EAAE;QACtB,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;OACzB,MAAM;QACL,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;OACzB;KACF,EAAE,UAAU,MAAM,EAAE;MACnB,IAAI,MAAM,EAAE;QACV,OAAO;OACR;MACD,MAAM,GAAG,IAAI,CAAC;;MAEd,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACzB,EAAE,UAAU,IAAI,OAAO,CAAC,MAAM,IAAI,kBAAkB,CAAC,CAAC,CAAC;;IAExD,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE;MACpB,MAAM,GAAG,IAAI,CAAC;MACd,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KACxB;GACF,EAAE,OAAO,CAAC,CAAC;CACb;;AAED,SAAS,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE;EAC5C,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE;IACjC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;GACpC,MAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE;IACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;GACnC,MAAM;IACL,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,KAAK,EAAE;MAC9C,OAAO,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KAChC,EAAE,UAAU,MAAM,EAAE;MACnB,OAAO,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC,CAAC;GACJ;CACF;;AAED,SAAS,mBAAmB,CAAC,OAAO,EAAE,aAAa,EAAEA,OAAI,EAAE;EACzD,IAAI,aAAa,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW,IAAIA,OAAI,KAAKC,IAAY,IAAI,aAAa,CAAC,WAAW,CAAC,OAAO,KAAKC,SAAe,EAAE;IACvI,iBAAiB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;GAC3C,MAAM;IACL,IAAIF,OAAI,KAAK,SAAS,EAAE;MACtB,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;KACjC,MAAM,IAAI,UAAU,CAACA,OAAI,CAAC,EAAE;MAC3B,qBAAqB,CAAC,OAAO,EAAE,aAAa,EAAEA,OAAI,CAAC,CAAC;KACrD,MAAM;MACL,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;KACjC;GACF;CACF;;AAED,SAAS,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE;EAC/B,IAAI,OAAO,KAAK,KAAK,EAAE;IACrB,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;GACpC,MAAM,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;IAClC,IAAIA,OAAI,GAAG,KAAK,CAAC,CAAC;IAClB,IAAI;MACFA,OAAI,GAAG,KAAK,CAAC,IAAI,CAAC;KACnB,CAAC,OAAO,KAAK,EAAE;MACd,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;MACvB,OAAO;KACR;IACD,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAEA,OAAI,CAAC,CAAC;GAC3C,MAAM;IACL,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACzB;CACF;;AAED,SAAS,gBAAgB,CAAC,OAAO,EAAE;EACjC,IAAI,OAAO,CAAC,QAAQ,EAAE;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;GACnC;;EAED,OAAO,CAAC,OAAO,CAAC,CAAC;CAClB;;AAED,SAAS,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE;EAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;IAC9B,OAAO;GACR;;EAED,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;EACxB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;;EAE3B,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;IACrC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;GACxB;CACF;;AAED,SAAS,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE;EAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;IAC9B,OAAO;GACR;EACD,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC;EAC1B,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC;;EAEzB,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;CACjC;;AAED,SAAS,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE;EAC5D,IAAI,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;EACvC,IAAI,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;;;EAGjC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;;EAEvB,YAAY,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;EAC7B,YAAY,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,aAAa,CAAC;EACjD,YAAY,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC;;EAE9C,IAAI,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE;IACjC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;GACvB;CACF;;AAED,SAAS,OAAO,CAAC,OAAO,EAAE;EACxB,IAAI,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;EACvC,IAAI,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;;EAE7B,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;IAC5B,OAAO;GACR;;EAED,IAAI,KAAK,GAAG,KAAK,CAAC;MACd,QAAQ,GAAG,KAAK,CAAC;MACjB,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;;EAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;IAC9C,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACvB,QAAQ,GAAG,WAAW,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;;IAEpC,IAAI,KAAK,EAAE;MACT,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KAClD,MAAM;MACL,QAAQ,CAAC,MAAM,CAAC,CAAC;KAClB;GACF;;EAED,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;CACjC;;AAED,SAAS,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;EAC1D,IAAI,WAAW,GAAG,UAAU,CAAC,QAAQ,CAAC;MAClC,KAAK,GAAG,KAAK,CAAC;MACd,KAAK,GAAG,KAAK,CAAC;MACd,SAAS,GAAG,IAAI,CAAC;;EAErB,IAAI,WAAW,EAAE;IACf,IAAI;MACF,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;KAC1B,CAAC,OAAO,CAAC,EAAE;MACV,SAAS,GAAG,KAAK,CAAC;MAClB,KAAK,GAAG,CAAC,CAAC;KACX;;IAED,IAAI,OAAO,KAAK,KAAK,EAAE;MACrB,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;MACnC,OAAO;KACR;GACF,MAAM;IACL,KAAK,GAAG,MAAM,CAAC;GAChB;;EAED,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;;GAE/B,MAAM,IAAI,WAAW,IAAI,SAAS,EAAE;IACnC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACzB,MAAM,IAAI,SAAS,KAAK,KAAK,EAAE;IAC9B,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACxB,MAAM,IAAI,OAAO,KAAK,SAAS,EAAE;IAChC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACzB,MAAM,IAAI,OAAO,KAAK,QAAQ,EAAE;IAC/B,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACxB;CACF;;AAED,SAAS,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE;EAC5C,IAAI;IACF,QAAQ,CAAC,SAAS,cAAc,CAAC,KAAK,EAAE;MACtC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KACzB,EAAE,SAAS,aAAa,CAAC,MAAM,EAAE;MAChC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACzB,CAAC,CAAC;GACJ,CAAC,OAAO,CAAC,EAAE;IACV,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;GACpB;CACF;;AAED,IAAI,EAAE,GAAG,CAAC,CAAC;AACX,SAAS,MAAM,GAAG;EAChB,OAAO,EAAE,EAAE,CAAC;CACb;;AAED,SAAS,WAAW,CAAC,OAAO,EAAE;EAC5B,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC;EAC3B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;EAC3B,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;EAC5B,OAAO,CAAC,YAAY,GAAG,EAAE,CAAC;CAC3B;;AChOD,SAAS,eAAe,GAAG;EACzB,OAAO,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;CAC7D,AAAC;;AAEF,IAAI,UAAU,GAAG,YAAY;EAC3B,SAAS,UAAU,CAAC,WAAW,EAAE,KAAK,EAAE;IACtC,IAAI,CAAC,oBAAoB,GAAG,WAAW,CAAC;IACxC,IAAI,CAAC,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;;IAErC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;MAC7B,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KAC3B;;IAED,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;MAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;MAC3B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;;MAE/B,IAAI,CAAC,OAAO,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;;MAEtC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;OACrC,MAAM;QACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvB,IAAI,IAAI,CAAC,UAAU,KAAK,CAAC,EAAE;UACzB,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;SACrC;OACF;KACF,MAAM;MACL,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;KACzC;GACF;;EAED,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAAK,EAAE;IAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;MAChE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC9B;GACF,CAAC;;EAEF,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE;IAC9D,IAAI,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC;IAClC,IAAIF,UAAO,GAAG,CAAC,CAAC,OAAO,CAAC;;;IAGxB,IAAIA,UAAO,KAAKI,SAAe,EAAE;MAC/B,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC;MACnB,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC;MACnB,IAAI,QAAQ,GAAG,KAAK,CAAC;MACrB,IAAI;QACF,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;OACpB,CAAC,OAAO,CAAC,EAAE;QACV,QAAQ,GAAG,IAAI,CAAC;QAChB,KAAK,GAAG,CAAC,CAAC;OACX;;MAED,IAAI,KAAK,KAAKD,IAAY,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE;QACtD,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;OACjD,MAAM,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;QACtC,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;OACzB,MAAM,IAAI,CAAC,KAAKE,SAAO,EAAE;QACxB,IAAI,OAAO,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,QAAQ,EAAE;UACZ,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SACxB,MAAM;UACL,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC5C;QACD,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;OAChC,MAAM;QACL,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,UAAUL,UAAO,EAAE;UAC1C,OAAOA,UAAO,CAAC,KAAK,CAAC,CAAC;SACvB,CAAC,EAAE,CAAC,CAAC,CAAC;OACR;KACF,MAAM;MACL,IAAI,CAAC,aAAa,CAACA,UAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;KACvC;GACF,CAAC;;EAEF,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE;IACrE,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;;;IAG3B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;MAC9B,IAAI,CAAC,UAAU,EAAE,CAAC;;MAElB,IAAI,KAAK,KAAK,QAAQ,EAAE;QACtB,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;OACxB,MAAM;QACL,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;OACzB;KACF;;IAED,IAAI,IAAI,CAAC,UAAU,KAAK,CAAC,EAAE;MACzB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;KAChC;GACF,CAAC;;EAEF,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,SAAS,aAAa,CAAC,OAAO,EAAE,CAAC,EAAE;IACtE,IAAI,UAAU,GAAG,IAAI,CAAC;;IAEtB,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,KAAK,EAAE;MAC7C,OAAO,UAAU,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;KACnD,EAAE,UAAU,MAAM,EAAE;MACnB,OAAO,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;KACnD,CAAC,CAAC;GACJ,CAAC;;EAEF,OAAO,UAAU,CAAC;CACnB,EAAE;;ACrHH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,AAAe,SAAS,GAAG,CAAC,OAAO,EAAE;EACnC,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC;;;CAC9C,DCjDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,AAAe,SAAS,IAAI,CAAC,OAAO,EAAE;;EAEpC,IAAI,WAAW,GAAG,IAAI,CAAC;;EAEvB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;IACrB,OAAO,IAAI,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE;MAC1C,OAAO,MAAM,CAAC,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAC,CAAC;KACjE,CAAC,CAAC;GACJ,MAAM;IACL,OAAO,IAAI,WAAW,CAAC,UAAU,OAAO,EAAE,MAAM,EAAE;MAChD,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;MAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;OACvD;KACF,CAAC,CAAC;GACJ;;;CACF,DCjFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,AAAe,SAASM,QAAM,CAAC,MAAM,EAAE;;EAErC,IAAI,WAAW,GAAG,IAAI,CAAC;EACvB,IAAI,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;EACpCC,MAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;EACzB,OAAO,OAAO,CAAC;;;CAChB,DC9BD,SAAS,aAAa,GAAG;EACvB,MAAM,IAAI,SAAS,CAAC,oFAAoF,CAAC,CAAC;CAC3G;;AAED,SAAS,QAAQ,GAAG;EAClB,MAAM,IAAI,SAAS,CAAC,uHAAuH,CAAC,CAAC;CAC9I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0GD,IAAIF,SAAO,GAAG,YAAY;EACxB,SAAS,OAAO,CAAC,QAAQ,EAAE;IACzB,IAAI,CAAC,UAAU,CAAC,GAAG,MAAM,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IACvC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;;IAEvB,IAAI,IAAI,KAAK,QAAQ,EAAE;MACrB,OAAO,QAAQ,KAAK,UAAU,IAAI,aAAa,EAAE,CAAC;MAClD,IAAI,YAAY,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAE,CAAC;KAC1E;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4LD,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG,SAAS,MAAM,CAAC,WAAW,EAAE;IACrD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;GACrC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CF,OAAO,CAAC,SAAS,CAAC,OAAO,GAAG,SAAS,QAAQ,CAAC,QAAQ,EAAE;IACtD,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,IAAI,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;;IAEtC,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;MACxB,OAAO,OAAO,CAAC,IAAI,CAAC,UAAU,KAAK,EAAE;QACnC,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY;UACtD,OAAO,KAAK,CAAC;SACd,CAAC,CAAC;OACJ,EAAE,UAAU,MAAM,EAAE;QACnB,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY;UACtD,MAAM,MAAM,CAAC;SACd,CAAC,CAAC;OACJ,CAAC,CAAC;KACJ;;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;GACzC,CAAC;;EAEF,OAAO,OAAO,CAAC;CAChB,EAAE,CAAC;;AAEJA,SAAO,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC;AAC9B,AACAA,SAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AAClBA,SAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AACpBA,SAAO,CAAC,OAAO,GAAGG,SAAO,CAAC;AAC1BH,SAAO,CAAC,MAAM,GAAGI,QAAM,CAAC;AACxBJ,SAAO,CAAC,aAAa,GAAG,YAAY,CAAC;AACrCA,SAAO,CAAC,QAAQ,GAAG,OAAO,CAAC;AAC3BA,SAAO,CAAC,KAAK,GAAG,IAAI;;AC5YpB;AACA,AAEe,SAAS,QAAQ,GAAG;EACjC,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC;;EAEnB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,KAAK,GAAG,MAAM,CAAC;GAChB,MAAM,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;IACtC,KAAK,GAAG,IAAI,CAAC;GACd,MAAM;IACL,IAAI;MACF,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;KACnC,CAAC,OAAO,CAAC,EAAE;MACV,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;KAC7F;GACF;;EAED,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;;EAEtB,IAAI,CAAC,EAAE;IACL,IAAI,eAAe,GAAG,IAAI,CAAC;IAC3B,IAAI;MACF,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KAC/D,CAAC,OAAO,CAAC,EAAE;;KAEX;;IAED,IAAI,eAAe,KAAK,kBAAkB,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;MACrD,OAAO;KACR;GACF;;EAED,KAAK,CAAC,OAAO,GAAGA,SAAO,CAAC;;;CACzB,DC/BD;AACAA,SAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC5BA,SAAO,CAAC,OAAO,GAAGA,SAAO,CAAC;;;;;;;;","file":"es6-promise.js"} \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.min.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.min.js new file mode 100644 index 0000000..6af5903 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/dist/es6-promise.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){W=t}function r(t){z=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof U?function(){U(a)}:c()}function s(){var t=0,e=new H(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise.prototype.then = then;\nexport default Promise;\nPromise.all = all;\nPromise.race = race;\nPromise.resolve = Resolve;\nPromise.reject = Reject;\nPromise._setScheduler = setScheduler;\nPromise._setAsap = setAsap;\nPromise._asap = asap;","/*global self*/\nimport Promise from './promise';\n\nexport default function polyfill() {\n var local = void 0;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise;\n}","import Promise from './es6-promise/promise';\nimport polyfill from './es6-promise/polyfill';\n\n// Strange compat..\nPromise.polyfill = polyfill;\nPromise.Promise = Promise;\nexport default Promise;"],"names":["resolve","_resolve","then","originalThen","originalResolve","Promise","reject","_reject","Resolve","Reject"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACNO,SAAS,gBAAgB,CAAC,CAAC,EAAE;EAClC,IAAI,IAAI,GAAG,OAAO,CAAC,CAAC;EACpB,OAAO,CAAC,KAAK,IAAI,KAAK,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,UAAU,CAAC,CAAC;CACjE;;AAED,AAAO,SAAS,UAAU,CAAC,CAAC,EAAE;EAC5B,OAAO,OAAO,CAAC,KAAK,UAAU,CAAC;CAChC;;AAED,AAEC;;AAED,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC;AACtB,IAAI,KAAK,CAAC,OAAO,EAAE;EACjB,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;CAC1B,MAAM;EACL,QAAQ,GAAG,UAAU,CAAC,EAAE;IACtB,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC;GAC/D,CAAC;CACH;;AAED,AAAO,IAAI,OAAO,GAAG,QAAQ;;ACtB7B,IAAI,GAAG,GAAG,CAAC,CAAC;AACZ,IAAI,SAAS,GAAG,KAAK,CAAC,CAAC;AACvB,IAAI,iBAAiB,GAAG,KAAK,CAAC,CAAC;;AAE/B,AAAO,IAAI,IAAI,GAAG,SAAS,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;EAC7C,KAAK,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;EACtB,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;EACrB,GAAG,IAAI,CAAC,CAAC;EACT,IAAI,GAAG,KAAK,CAAC,EAAE;;;;IAIb,IAAI,iBAAiB,EAAE;MACrB,iBAAiB,CAAC,KAAK,CAAC,CAAC;KAC1B,MAAM;MACL,aAAa,EAAE,CAAC;KACjB;GACF;CACF,CAAC;;AAEF,AAAO,SAAS,YAAY,CAAC,UAAU,EAAE;EACvC,iBAAiB,GAAG,UAAU,CAAC;CAChC;;AAED,AAAO,SAAS,OAAO,CAAC,MAAM,EAAE;EAC9B,IAAI,GAAG,MAAM,CAAC;CACf;;AAED,IAAI,aAAa,GAAG,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AACvE,IAAI,aAAa,GAAG,aAAa,IAAI,EAAE,CAAC;AACxC,IAAI,uBAAuB,GAAG,aAAa,CAAC,gBAAgB,IAAI,aAAa,CAAC,sBAAsB,CAAC;AACrG,IAAI,MAAM,GAAG,OAAO,IAAI,KAAK,WAAW,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,kBAAkB,CAAC;;;AAG/H,IAAI,QAAQ,GAAG,OAAO,iBAAiB,KAAK,WAAW,IAAI,OAAO,aAAa,KAAK,WAAW,IAAI,OAAO,cAAc,KAAK,WAAW,CAAC;;;AAGzI,SAAS,WAAW,GAAG;;;EAGrB,OAAO,YAAY;IACjB,OAAO,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;GAChC,CAAC;CACH;;;AAGD,SAAS,aAAa,GAAG;EACvB,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE;IACpC,OAAO,YAAY;MACjB,SAAS,CAAC,KAAK,CAAC,CAAC;KAClB,CAAC;GACH;;EAED,OAAO,aAAa,EAAE,CAAC;CACxB;;AAED,SAAS,mBAAmB,GAAG;EAC7B,IAAI,UAAU,GAAG,CAAC,CAAC;EACnB,IAAI,QAAQ,GAAG,IAAI,uBAAuB,CAAC,KAAK,CAAC,CAAC;EAClD,IAAI,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;EACvC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;;EAEhD,OAAO,YAAY;IACjB,IAAI,CAAC,IAAI,GAAG,UAAU,GAAG,EAAE,UAAU,GAAG,CAAC,CAAC;GAC3C,CAAC;CACH;;;AAGD,SAAS,iBAAiB,GAAG;EAC3B,IAAI,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;EACnC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;EAChC,OAAO,YAAY;IACjB,OAAO,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;GACrC,CAAC;CACH;;AAED,SAAS,aAAa,GAAG;;;EAGvB,IAAI,gBAAgB,GAAG,UAAU,CAAC;EAClC,OAAO,YAAY;IACjB,OAAO,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;GACnC,CAAC;CACH;;AAED,IAAI,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;AAC5B,SAAS,KAAK,GAAG;EACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;IAC/B,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;;IAEvB,QAAQ,CAAC,GAAG,CAAC,CAAC;;IAEd,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACrB,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;GAC1B;;EAED,GAAG,GAAG,CAAC,CAAC;CACT;;AAED,SAAS,YAAY,GAAG;EACtB,IAAI;IACF,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,YAAY,CAAC;IAClD,OAAO,aAAa,EAAE,CAAC;GACxB,CAAC,OAAO,CAAC,EAAE;IACV,OAAO,aAAa,EAAE,CAAC;GACxB;CACF;;AAED,IAAI,aAAa,GAAG,KAAK,CAAC,CAAC;;AAE3B,IAAI,MAAM,EAAE;EACV,aAAa,GAAG,WAAW,EAAE,CAAC;CAC/B,MAAM,IAAI,uBAAuB,EAAE;EAClC,aAAa,GAAG,mBAAmB,EAAE,CAAC;CACvC,MAAM,IAAI,QAAQ,EAAE;EACnB,aAAa,GAAG,iBAAiB,EAAE,CAAC;CACrC,MAAM,IAAI,aAAa,KAAK,SAAS,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;EACvE,aAAa,GAAG,YAAY,EAAE,CAAC;CAChC,MAAM;EACL,aAAa,GAAG,aAAa,EAAE,CAAC;;;CACjC,DCtHc,SAAS,IAAI,CAAC,aAAa,EAAE,WAAW,EAAE;EACvD,IAAI,MAAM,GAAG,IAAI,CAAC;;EAElB,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;;EAEvC,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,SAAS,EAAE;IACnC,WAAW,CAAC,KAAK,CAAC,CAAC;GACpB;;EAED,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;;;EAG3B,IAAI,MAAM,EAAE;IACV,IAAI,QAAQ,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,IAAI,CAAC,YAAY;MACf,OAAO,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;KAChE,CAAC,CAAC;GACJ,MAAM;IACL,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;GACtD;;EAED,OAAO,KAAK,CAAC;;;CACd,DCxBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,AAAe,SAASA,SAAO,CAAC,MAAM,EAAE;;EAEtC,IAAI,WAAW,GAAG,IAAI,CAAC;;EAEvB,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,WAAW,KAAK,WAAW,EAAE;IAC9E,OAAO,MAAM,CAAC;GACf;;EAED,IAAI,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;EACpCC,OAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;EAC1B,OAAO,OAAO,CAAC;;;CAChB,DCrCM,IAAI,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;;AAEhE,SAAS,IAAI,GAAG,EAAE;;AAElB,IAAI,OAAO,GAAG,KAAK,CAAC,CAAC;AACrB,IAAI,SAAS,GAAG,CAAC,CAAC;AAClB,IAAI,QAAQ,GAAG,CAAC,CAAC;;AAEjB,SAAS,eAAe,GAAG;EACzB,OAAO,IAAI,SAAS,CAAC,0CAA0C,CAAC,CAAC;CAClE;;AAED,SAAS,eAAe,GAAG;EACzB,OAAO,IAAI,SAAS,CAAC,sDAAsD,CAAC,CAAC;CAC9E;;AAED,SAAS,OAAO,CAACC,OAAI,EAAE,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE;EAClE,IAAI;IACFA,OAAI,CAAC,IAAI,CAAC,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;GACxD,CAAC,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,CAAC;GACV;CACF;;AAED,SAAS,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAEA,OAAI,EAAE;EACtD,IAAI,CAAC,UAAU,OAAO,EAAE;IACtB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,KAAK,GAAG,OAAO,CAACA,OAAI,EAAE,QAAQ,EAAE,UAAU,KAAK,EAAE;MACnD,IAAI,MAAM,EAAE;QACV,OAAO;OACR;MACD,MAAM,GAAG,IAAI,CAAC;MACd,IAAI,QAAQ,KAAK,KAAK,EAAE;QACtB,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;OACzB,MAAM;QACL,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;OACzB;KACF,EAAE,UAAU,MAAM,EAAE;MACnB,IAAI,MAAM,EAAE;QACV,OAAO;OACR;MACD,MAAM,GAAG,IAAI,CAAC;;MAEd,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACzB,EAAE,UAAU,IAAI,OAAO,CAAC,MAAM,IAAI,kBAAkB,CAAC,CAAC,CAAC;;IAExD,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE;MACpB,MAAM,GAAG,IAAI,CAAC;MACd,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KACxB;GACF,EAAE,OAAO,CAAC,CAAC;CACb;;AAED,SAAS,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE;EAC5C,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE;IACjC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;GACpC,MAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE;IACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;GACnC,MAAM;IACL,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,KAAK,EAAE;MAC9C,OAAO,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KAChC,EAAE,UAAU,MAAM,EAAE;MACnB,OAAO,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC,CAAC;GACJ;CACF;;AAED,SAAS,mBAAmB,CAAC,OAAO,EAAE,aAAa,EAAEA,OAAI,EAAE;EACzD,IAAI,aAAa,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW,IAAIA,OAAI,KAAKC,IAAY,IAAI,aAAa,CAAC,WAAW,CAAC,OAAO,KAAKC,SAAe,EAAE;IACvI,iBAAiB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;GAC3C,MAAM;IACL,IAAIF,OAAI,KAAK,SAAS,EAAE;MACtB,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;KACjC,MAAM,IAAI,UAAU,CAACA,OAAI,CAAC,EAAE;MAC3B,qBAAqB,CAAC,OAAO,EAAE,aAAa,EAAEA,OAAI,CAAC,CAAC;KACrD,MAAM;MACL,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;KACjC;GACF;CACF;;AAED,SAAS,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE;EAC/B,IAAI,OAAO,KAAK,KAAK,EAAE;IACrB,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;GACpC,MAAM,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;IAClC,IAAIA,OAAI,GAAG,KAAK,CAAC,CAAC;IAClB,IAAI;MACFA,OAAI,GAAG,KAAK,CAAC,IAAI,CAAC;KACnB,CAAC,OAAO,KAAK,EAAE;MACd,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;MACvB,OAAO;KACR;IACD,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAEA,OAAI,CAAC,CAAC;GAC3C,MAAM;IACL,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACzB;CACF;;AAED,SAAS,gBAAgB,CAAC,OAAO,EAAE;EACjC,IAAI,OAAO,CAAC,QAAQ,EAAE;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;GACnC;;EAED,OAAO,CAAC,OAAO,CAAC,CAAC;CAClB;;AAED,SAAS,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE;EAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;IAC9B,OAAO;GACR;;EAED,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;EACxB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;;EAE3B,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;IACrC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;GACxB;CACF;;AAED,SAAS,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE;EAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;IAC9B,OAAO;GACR;EACD,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC;EAC1B,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC;;EAEzB,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;CACjC;;AAED,SAAS,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE;EAC5D,IAAI,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;EACvC,IAAI,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;;;EAGjC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;;EAEvB,YAAY,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;EAC7B,YAAY,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,aAAa,CAAC;EACjD,YAAY,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC;;EAE9C,IAAI,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE;IACjC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;GACvB;CACF;;AAED,SAAS,OAAO,CAAC,OAAO,EAAE;EACxB,IAAI,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;EACvC,IAAI,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;;EAE7B,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;IAC5B,OAAO;GACR;;EAED,IAAI,KAAK,GAAG,KAAK,CAAC;MACd,QAAQ,GAAG,KAAK,CAAC;MACjB,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;;EAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;IAC9C,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACvB,QAAQ,GAAG,WAAW,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;;IAEpC,IAAI,KAAK,EAAE;MACT,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KAClD,MAAM;MACL,QAAQ,CAAC,MAAM,CAAC,CAAC;KAClB;GACF;;EAED,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;CACjC;;AAED,SAAS,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;EAC1D,IAAI,WAAW,GAAG,UAAU,CAAC,QAAQ,CAAC;MAClC,KAAK,GAAG,KAAK,CAAC;MACd,KAAK,GAAG,KAAK,CAAC;MACd,SAAS,GAAG,IAAI,CAAC;;EAErB,IAAI,WAAW,EAAE;IACf,IAAI;MACF,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;KAC1B,CAAC,OAAO,CAAC,EAAE;MACV,SAAS,GAAG,KAAK,CAAC;MAClB,KAAK,GAAG,CAAC,CAAC;KACX;;IAED,IAAI,OAAO,KAAK,KAAK,EAAE;MACrB,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;MACnC,OAAO;KACR;GACF,MAAM;IACL,KAAK,GAAG,MAAM,CAAC;GAChB;;EAED,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;;GAE/B,MAAM,IAAI,WAAW,IAAI,SAAS,EAAE;IACnC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACzB,MAAM,IAAI,SAAS,KAAK,KAAK,EAAE;IAC9B,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACxB,MAAM,IAAI,OAAO,KAAK,SAAS,EAAE;IAChC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACzB,MAAM,IAAI,OAAO,KAAK,QAAQ,EAAE;IAC/B,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;GACxB;CACF;;AAED,SAAS,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE;EAC5C,IAAI;IACF,QAAQ,CAAC,SAAS,cAAc,CAAC,KAAK,EAAE;MACtC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KACzB,EAAE,SAAS,aAAa,CAAC,MAAM,EAAE;MAChC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACzB,CAAC,CAAC;GACJ,CAAC,OAAO,CAAC,EAAE;IACV,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;GACpB;CACF;;AAED,IAAI,EAAE,GAAG,CAAC,CAAC;AACX,SAAS,MAAM,GAAG;EAChB,OAAO,EAAE,EAAE,CAAC;CACb;;AAED,SAAS,WAAW,CAAC,OAAO,EAAE;EAC5B,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC;EAC3B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;EAC3B,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;EAC5B,OAAO,CAAC,YAAY,GAAG,EAAE,CAAC;CAC3B;;AChOD,SAAS,eAAe,GAAG;EACzB,OAAO,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;CAC7D,AAAC;;AAEF,IAAI,UAAU,GAAG,YAAY;EAC3B,SAAS,UAAU,CAAC,WAAW,EAAE,KAAK,EAAE;IACtC,IAAI,CAAC,oBAAoB,GAAG,WAAW,CAAC;IACxC,IAAI,CAAC,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;;IAErC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;MAC7B,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KAC3B;;IAED,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;MAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;MAC3B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;;MAE/B,IAAI,CAAC,OAAO,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;;MAEtC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;OACrC,MAAM;QACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvB,IAAI,IAAI,CAAC,UAAU,KAAK,CAAC,EAAE;UACzB,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;SACrC;OACF;KACF,MAAM;MACL,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;KACzC;GACF;;EAED,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAAK,EAAE;IAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;MAChE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC9B;GACF,CAAC;;EAEF,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE;IAC9D,IAAI,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC;IAClC,IAAIF,UAAO,GAAG,CAAC,CAAC,OAAO,CAAC;;;IAGxB,IAAIA,UAAO,KAAKI,SAAe,EAAE;MAC/B,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC;MACnB,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC;MACnB,IAAI,QAAQ,GAAG,KAAK,CAAC;MACrB,IAAI;QACF,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;OACpB,CAAC,OAAO,CAAC,EAAE;QACV,QAAQ,GAAG,IAAI,CAAC;QAChB,KAAK,GAAG,CAAC,CAAC;OACX;;MAED,IAAI,KAAK,KAAKD,IAAY,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE;QACtD,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;OACjD,MAAM,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;QACtC,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;OACzB,MAAM,IAAI,CAAC,KAAKE,SAAO,EAAE;QACxB,IAAI,OAAO,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,QAAQ,EAAE;UACZ,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SACxB,MAAM;UACL,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC5C;QACD,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;OAChC,MAAM;QACL,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,UAAUL,UAAO,EAAE;UAC1C,OAAOA,UAAO,CAAC,KAAK,CAAC,CAAC;SACvB,CAAC,EAAE,CAAC,CAAC,CAAC;OACR;KACF,MAAM;MACL,IAAI,CAAC,aAAa,CAACA,UAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;KACvC;GACF,CAAC;;EAEF,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE;IACrE,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;;;IAG3B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE;MAC9B,IAAI,CAAC,UAAU,EAAE,CAAC;;MAElB,IAAI,KAAK,KAAK,QAAQ,EAAE;QACtB,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;OACxB,MAAM;QACL,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;OACzB;KACF;;IAED,IAAI,IAAI,CAAC,UAAU,KAAK,CAAC,EAAE;MACzB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;KAChC;GACF,CAAC;;EAEF,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,SAAS,aAAa,CAAC,OAAO,EAAE,CAAC,EAAE;IACtE,IAAI,UAAU,GAAG,IAAI,CAAC;;IAEtB,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,KAAK,EAAE;MAC7C,OAAO,UAAU,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;KACnD,EAAE,UAAU,MAAM,EAAE;MACnB,OAAO,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;KACnD,CAAC,CAAC;GACJ,CAAC;;EAEF,OAAO,UAAU,CAAC;CACnB,EAAE;;ACrHH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,AAAe,SAAS,GAAG,CAAC,OAAO,EAAE;EACnC,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC;;;CAC9C,DCjDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,AAAe,SAAS,IAAI,CAAC,OAAO,EAAE;;EAEpC,IAAI,WAAW,GAAG,IAAI,CAAC;;EAEvB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;IACrB,OAAO,IAAI,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE;MAC1C,OAAO,MAAM,CAAC,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAC,CAAC;KACjE,CAAC,CAAC;GACJ,MAAM;IACL,OAAO,IAAI,WAAW,CAAC,UAAU,OAAO,EAAE,MAAM,EAAE;MAChD,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;MAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;OACvD;KACF,CAAC,CAAC;GACJ;;;CACF,DCjFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,AAAe,SAASM,QAAM,CAAC,MAAM,EAAE;;EAErC,IAAI,WAAW,GAAG,IAAI,CAAC;EACvB,IAAI,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;EACpCC,MAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;EACzB,OAAO,OAAO,CAAC;;;CAChB,DC9BD,SAAS,aAAa,GAAG;EACvB,MAAM,IAAI,SAAS,CAAC,oFAAoF,CAAC,CAAC;CAC3G;;AAED,SAAS,QAAQ,GAAG;EAClB,MAAM,IAAI,SAAS,CAAC,uHAAuH,CAAC,CAAC;CAC9I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0GD,IAAIF,SAAO,GAAG,YAAY;EACxB,SAAS,OAAO,CAAC,QAAQ,EAAE;IACzB,IAAI,CAAC,UAAU,CAAC,GAAG,MAAM,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IACvC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;;IAEvB,IAAI,IAAI,KAAK,QAAQ,EAAE;MACrB,OAAO,QAAQ,KAAK,UAAU,IAAI,aAAa,EAAE,CAAC;MAClD,IAAI,YAAY,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAE,CAAC;KAC1E;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4LD,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG,SAAS,MAAM,CAAC,WAAW,EAAE;IACrD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;GACrC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CF,OAAO,CAAC,SAAS,CAAC,OAAO,GAAG,SAAS,QAAQ,CAAC,QAAQ,EAAE;IACtD,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,IAAI,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;;IAEtC,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;MACxB,OAAO,OAAO,CAAC,IAAI,CAAC,UAAU,KAAK,EAAE;QACnC,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY;UACtD,OAAO,KAAK,CAAC;SACd,CAAC,CAAC;OACJ,EAAE,UAAU,MAAM,EAAE;QACnB,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY;UACtD,MAAM,MAAM,CAAC;SACd,CAAC,CAAC;OACJ,CAAC,CAAC;KACJ;;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;GACzC,CAAC;;EAEF,OAAO,OAAO,CAAC;CAChB,EAAE,CAAC;;AAEJA,SAAO,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC;AAC9B,AACAA,SAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AAClBA,SAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AACpBA,SAAO,CAAC,OAAO,GAAGG,SAAO,CAAC;AAC1BH,SAAO,CAAC,MAAM,GAAGI,QAAM,CAAC;AACxBJ,SAAO,CAAC,aAAa,GAAG,YAAY,CAAC;AACrCA,SAAO,CAAC,QAAQ,GAAG,OAAO,CAAC;AAC3BA,SAAO,CAAC,KAAK,GAAG,IAAI;;AC5YpB;AACA,AAEe,SAAS,QAAQ,GAAG;EACjC,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC;;EAEnB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,KAAK,GAAG,MAAM,CAAC;GAChB,MAAM,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;IACtC,KAAK,GAAG,IAAI,CAAC;GACd,MAAM;IACL,IAAI;MACF,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;KACnC,CAAC,OAAO,CAAC,EAAE;MACV,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;KAC7F;GACF;;EAED,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;;EAEtB,IAAI,CAAC,EAAE;IACL,IAAI,eAAe,GAAG,IAAI,CAAC;IAC3B,IAAI;MACF,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KAC/D,CAAC,OAAO,CAAC,EAAE;;KAEX;;IAED,IAAI,eAAe,KAAK,kBAAkB,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;MACrD,OAAO;KACR;GACF;;EAED,KAAK,CAAC,OAAO,GAAGA,SAAO,CAAC;;;CACzB,DC/BD;AACAA,SAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC5BA,SAAO,CAAC,OAAO,GAAGA,SAAO,CAAC;;;;;;;;","file":"es6-promise.min.js"} \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/es6-promise.d.ts b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/es6-promise.d.ts new file mode 100644 index 0000000..e4200df --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/es6-promise.d.ts @@ -0,0 +1,85 @@ +export interface Thenable { + then (onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; + then (onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Thenable; +} + +export class Promise implements Thenable { + /** + * If you call resolve in the body of the callback passed to the constructor, + * your promise is fulfilled with result object passed to resolve. + * If you call reject your promise is rejected with the object passed to resolve. + * For consistency and debugging (eg stack traces), obj should be an instanceof Error. + * Any errors thrown in the constructor callback will be implicitly passed to reject(). + */ + constructor (callback: (resolve : (value?: R | Thenable) => void, reject: (error?: any) => void) => void); + + /** + * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. + * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. + * Both callbacks have a single parameter , the fulfillment value or rejection reason. + * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. + * If an error is thrown in the callback, the returned promise rejects with that error. + * + * @param onFulfilled called when/if "promise" resolves + * @param onRejected called when/if "promise" rejects + */ + then (onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise; + then (onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Promise; + + /** + * Sugar for promise.then(undefined, onRejected) + * + * @param onRejected called when/if "promise" rejects + */ + catch (onRejected?: (error: any) => U | Thenable): Promise; + + /** + * onSettled is invoked when/if the "promise" settles (either rejects or fulfills). + * The returned promise is settled when the `Thenable` returned by `onFinally` settles; + * it is rejected if `onFinally` throws or rejects; otherwise it assumes the state of the + * original Promise. + * + * @param onFinally called when/if "promise" settles + + */ + finally (onFinally?: () => any | Thenable): Promise; + + /** + * Make a new promise from the thenable. + * A thenable is promise-like in as far as it has a "then" method. + */ + static resolve (): Promise; + static resolve (value: R | Thenable): Promise; + + /** + * Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error + */ + static reject (error: any): Promise; + + /** + * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. + * the array passed to all can be a mixture of promise-like objects and other objects. + * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. + */ + static all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable, T10 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + static all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + static all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + static all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + static all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6]>; + static all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable]): Promise<[T1, T2, T3, T4, T5]>; + static all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable ]): Promise<[T1, T2, T3, T4]>; + static all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable]): Promise<[T1, T2, T3]>; + static all(values: [T1 | Thenable, T2 | Thenable]): Promise<[T1, T2]>; + static all(values: [T1 | Thenable]): Promise<[T1]>; + static all(values: Array>): Promise; + + /** + * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. + */ + static race (promises: (R | Thenable)[]): Promise; +} + +/** + * The polyfill method will patch the global environment (in this case to the Promise name) when called. + */ +export function polyfill (): void; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise.auto.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise.auto.js new file mode 100644 index 0000000..7799786 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise.auto.js @@ -0,0 +1,3 @@ +import Promise from './es6-promise'; +Promise.polyfill(); +export default Promise; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise.js new file mode 100644 index 0000000..4f4d840 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise.js @@ -0,0 +1,7 @@ +import Promise from './es6-promise/promise'; +import polyfill from './es6-promise/polyfill'; + +// Strange compat.. +Promise.polyfill = polyfill; +Promise.Promise = Promise; +export default Promise; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/-internal.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/-internal.js new file mode 100644 index 0000000..6bd75a8 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/-internal.js @@ -0,0 +1,243 @@ +import { + objectOrFunction, + isFunction +} from './utils'; + +import { + asap +} from './asap'; + +import originalThen from './then'; +import originalResolve from './promise/resolve'; + +export const PROMISE_ID = Math.random().toString(36).substring(2); + +function noop() {} + +const PENDING = void 0; +const FULFILLED = 1; +const REJECTED = 2; + +function selfFulfillment() { + return new TypeError("You cannot resolve a promise with itself"); +} + +function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); +} + +function tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } +} + +function handleForeignThenable(promise, thenable, then) { + asap(promise => { + let sealed = false; + let error = tryThen(then, thenable, value => { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + resolve(promise, value); + } else { + fulfill(promise, value); + } + }, reason => { + if (sealed) { return; } + sealed = true; + + reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + reject(promise, error); + } + }, promise); +} + +function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, value => resolve(promise, value), + reason => reject(promise, reason)) + } +} + +function handleMaybeThenable(promise, maybeThenable, then) { + if (maybeThenable.constructor === promise.constructor && + then === originalThen && + maybeThenable.constructor.resolve === originalResolve) { + handleOwnThenable(promise, maybeThenable); + } else { + if (then === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then)) { + handleForeignThenable(promise, maybeThenable, then); + } else { + fulfill(promise, maybeThenable); + } + } +} + +function resolve(promise, value) { + if (promise === value) { + reject(promise, selfFulfillment()); + } else if (objectOrFunction(value)) { + let then; + try { + then = value.then; + } catch (error) { + reject(promise, error); + return; + } + handleMaybeThenable(promise, value, then); + } else { + fulfill(promise, value); + } +} + +function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + publish(promise); +} + +function fulfill(promise, value) { + if (promise._state !== PENDING) { return; } + + promise._result = value; + promise._state = FULFILLED; + + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } +} + +function reject(promise, reason) { + if (promise._state !== PENDING) { return; } + promise._state = REJECTED; + promise._result = reason; + + asap(publishRejection, promise); +} + +function subscribe(parent, child, onFulfillment, onRejection) { + let { _subscribers } = parent; + let { length } = _subscribers; + + parent._onerror = null; + + _subscribers[length] = child; + _subscribers[length + FULFILLED] = onFulfillment; + _subscribers[length + REJECTED] = onRejection; + + if (length === 0 && parent._state) { + asap(publish, parent); + } +} + +function publish(promise) { + let subscribers = promise._subscribers; + let settled = promise._state; + + if (subscribers.length === 0) { return; } + + let child, callback, detail = promise._result; + + for (let i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; +} + +function invokeCallback(settled, promise, callback, detail) { + let hasCallback = isFunction(callback), + value, error, succeeded = true; + + if (hasCallback) { + try { + value = callback(detail); + } catch (e) { + succeeded = false; + error = e; + } + + if (promise === value) { + reject(promise, cannotReturnOwn()); + return; + } + } else { + value = detail; + } + + if (promise._state !== PENDING) { + // noop + } else if (hasCallback && succeeded) { + resolve(promise, value); + } else if (succeeded === false) { + reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + reject(promise, value); + } +} + +function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + resolve(promise, value); + }, function rejectPromise(reason) { + reject(promise, reason); + }); + } catch(e) { + reject(promise, e); + } +} + +let id = 0; +function nextId() { + return id++; +} + +function makePromise(promise) { + promise[PROMISE_ID] = id++; + promise._state = undefined; + promise._result = undefined; + promise._subscribers = []; +} + +export { + nextId, + makePromise, + noop, + resolve, + reject, + fulfill, + subscribe, + publish, + publishRejection, + initializePromise, + invokeCallback, + FULFILLED, + REJECTED, + PENDING, + handleMaybeThenable +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/asap.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/asap.js new file mode 100644 index 0000000..0483201 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/asap.js @@ -0,0 +1,119 @@ +let len = 0; +let vertxNext; +let customSchedulerFn; + +export var asap = function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (customSchedulerFn) { + customSchedulerFn(flush); + } else { + scheduleFlush(); + } + } +} + +export function setScheduler(scheduleFn) { + customSchedulerFn = scheduleFn; +} + +export function setAsap(asapFn) { + asap = asapFn; +} + +const browserWindow = (typeof window !== 'undefined') ? window : undefined; +const browserGlobal = browserWindow || {}; +const BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; +const isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + +// test for web worker but not in IE10 +const isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + +// node +function useNextTick() { + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // see https://github.com/cujojs/when/issues/410 for details + return () => process.nextTick(flush); +} + +// vertx +function useVertxTimer() { + if (typeof vertxNext !== 'undefined') { + return function() { + vertxNext(flush); + }; + } + + return useSetTimeout(); +} + +function useMutationObserver() { + let iterations = 0; + const observer = new BrowserMutationObserver(flush); + const node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return () => { + node.data = (iterations = ++iterations % 2); + }; +} + +// web worker +function useMessageChannel() { + const channel = new MessageChannel(); + channel.port1.onmessage = flush; + return () => channel.port2.postMessage(0); +} + +function useSetTimeout() { + // Store setTimeout reference so es6-promise will be unaffected by + // other code modifying setTimeout (like sinon.useFakeTimers()) + const globalSetTimeout = setTimeout; + return () => globalSetTimeout(flush, 1); +} + +const queue = new Array(1000); +function flush() { + for (let i = 0; i < len; i+=2) { + let callback = queue[i]; + let arg = queue[i+1]; + + callback(arg); + + queue[i] = undefined; + queue[i+1] = undefined; + } + + len = 0; +} + +function attemptVertx() { + try { + const vertx = Function('return this')().require('vertx'); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch(e) { + return useSetTimeout(); + } +} + +let scheduleFlush; +// Decide what async method to use to triggering processing of queued callbacks: +if (isNode) { + scheduleFlush = useNextTick(); +} else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); +} else if (isWorker) { + scheduleFlush = useMessageChannel(); +} else if (browserWindow === undefined && typeof require === 'function') { + scheduleFlush = attemptVertx(); +} else { + scheduleFlush = useSetTimeout(); +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/enumerator.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/enumerator.js new file mode 100644 index 0000000..be2e093 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/enumerator.js @@ -0,0 +1,124 @@ +import { + isArray, + isMaybeThenable +} from './utils'; +import { + noop, + reject, + fulfill, + subscribe, + FULFILLED, + REJECTED, + PENDING, + handleMaybeThenable +} from './-internal'; + +import then from './then'; +import Promise from './promise'; +import originalResolve from './promise/resolve'; +import originalThen from './then'; +import { makePromise, PROMISE_ID } from './-internal'; + +function validationError() { + return new Error('Array Methods must be provided an Array'); +}; + +export default class Enumerator { + constructor(Constructor, input) { + this._instanceConstructor = Constructor; + this.promise = new Constructor(noop); + + if (!this.promise[PROMISE_ID]) { + makePromise(this.promise); + } + + if (isArray(input)) { + this.length = input.length; + this._remaining = input.length; + + this._result = new Array(this.length); + + if (this.length === 0) { + fulfill(this.promise, this._result); + } else { + this.length = this.length || 0; + this._enumerate(input); + if (this._remaining === 0) { + fulfill(this.promise, this._result); + } + } + } else { + reject(this.promise, validationError()); + } + } + _enumerate(input) { + for (let i = 0; this._state === PENDING && i < input.length; i++) { + this._eachEntry(input[i], i); + } + } + + _eachEntry(entry, i) { + let c = this._instanceConstructor; + let { resolve } = c; + + if (resolve === originalResolve) { + let then; + let error; + let didError = false; + try { + then = entry.then; + } catch (e) { + didError = true; + error = e; + } + + if (then === originalThen && + entry._state !== PENDING) { + this._settledAt(entry._state, i, entry._result); + } else if (typeof then !== 'function') { + this._remaining--; + this._result[i] = entry; + } else if (c === Promise) { + let promise = new c(noop); + if (didError) { + reject(promise, error); + } else { + handleMaybeThenable(promise, entry, then); + } + this._willSettleAt(promise, i); + } else { + this._willSettleAt(new c(resolve => resolve(entry)), i); + } + } else { + this._willSettleAt(resolve(entry), i); + } + } + + _settledAt(state, i, value) { + let { promise } = this; + + if (promise._state === PENDING) { + this._remaining--; + + if (state === REJECTED) { + reject(promise, value); + } else { + this._result[i] = value; + } + } + + if (this._remaining === 0) { + fulfill(promise, this._result); + } + } + + _willSettleAt(promise, i) { + let enumerator = this; + + subscribe( + promise, undefined, + value => enumerator._settledAt(FULFILLED, i, value), + reason => enumerator._settledAt(REJECTED, i, reason) + ); + } +}; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/polyfill.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/polyfill.js new file mode 100644 index 0000000..30db73c --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/polyfill.js @@ -0,0 +1,35 @@ +/*global self*/ +import Promise from './promise'; + +export default function polyfill() { + let local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + let P = local.Promise; + + if (P) { + var promiseToString = null; + try { + promiseToString = Object.prototype.toString.call(P.resolve()); + } catch(e) { + // silently ignored + } + + if (promiseToString === '[object Promise]' && !P.cast){ + return; + } + } + + local.Promise = Promise; +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise.js new file mode 100644 index 0000000..ae17036 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise.js @@ -0,0 +1,431 @@ +import { + isFunction +} from './utils'; +import { + noop, + nextId, + PROMISE_ID, + initializePromise +} from './-internal'; +import { + asap, + setAsap, + setScheduler +} from './asap'; + +import all from './promise/all'; +import race from './promise/race'; +import Resolve from './promise/resolve'; +import Reject from './promise/reject'; +import then from './then'; + +function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); +} + +function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); +} + +/** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + let promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + let xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {Function} resolver + Useful for tooling. + @constructor +*/ + +class Promise { + constructor(resolver) { + this[PROMISE_ID] = nextId(); + this._result = this._state = undefined; + this._subscribers = []; + + if (noop !== resolver) { + typeof resolver !== 'function' && needsResolver(); + this instanceof Promise ? initializePromise(this, resolver) : needsNew(); + } + } + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + let result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + let author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + catch(onRejection) { + return this.then(null, onRejection); + } + +/** + `finally` will be invoked regardless of the promise's fate just as native + try/catch/finally behaves + + Synchronous example: + + ```js + findAuthor() { + if (Math.random() > 0.5) { + throw new Error(); + } + return new Author(); + } + + try { + return findAuthor(); // succeed or fail + } catch(error) { + return findOtherAuther(); + } finally { + // always runs + // doesn't affect the return value + } + ``` + + Asynchronous example: + + ```js + findAuthor().catch(function(reason){ + return findOtherAuther(); + }).finally(function(){ + // author was either found, or not + }); + ``` + + @method finally + @param {Function} callback + @return {Promise} +*/ + finally(callback) { + let promise = this; + let constructor = promise.constructor; + + if ( isFunction(callback) ) { + return promise.then(value => constructor.resolve(callback()).then(() => value), + reason => constructor.resolve(callback()).then(() => { throw reason; })); + } + + return promise.then(callback, callback); + } +} + +Promise.prototype.then = then; +export default Promise; +Promise.all = all; +Promise.race = race; +Promise.resolve = Resolve; +Promise.reject = Reject; +Promise._setScheduler = setScheduler; +Promise._setAsap = setAsap; +Promise._asap = asap; + diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/all.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/all.js new file mode 100644 index 0000000..9ca3c06 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/all.js @@ -0,0 +1,52 @@ +import Enumerator from '../enumerator'; + +/** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = resolve(2); + let promise3 = resolve(3); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = reject(new Error("2")); + let promise3 = reject(new Error("3")); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static +*/ +export default function all(entries) { + return new Enumerator(this, entries).promise; +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/race.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/race.js new file mode 100644 index 0000000..166dc82 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/race.js @@ -0,0 +1,84 @@ +import { + isArray +} from "../utils"; + +/** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. +*/ +export default function race(entries) { + /*jshint validthis:true */ + let Constructor = this; + + if (!isArray(entries)) { + return new Constructor((_, reject) => reject(new TypeError('You must pass an array to race.'))); + } else { + return new Constructor((resolve, reject) => { + let length = entries.length; + for (let i = 0; i < length; i++) { + Constructor.resolve(entries[i]).then(resolve, reject); + } + }); + } +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/reject.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/reject.js new file mode 100644 index 0000000..cd55faa --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/reject.js @@ -0,0 +1,46 @@ +import { + noop, + reject as _reject +} from '../-internal'; + +/** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. +*/ +export default function reject(reason) { + /*jshint validthis:true */ + let Constructor = this; + let promise = new Constructor(noop); + _reject(promise, reason); + return promise; +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/resolve.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/resolve.js new file mode 100644 index 0000000..f4642b6 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/promise/resolve.js @@ -0,0 +1,48 @@ +import { + noop, + resolve as _resolve +} from '../-internal'; + +/** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` +*/ +export default function resolve(object) { + /*jshint validthis:true */ + let Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + let promise = new Constructor(noop); + _resolve(promise, object); + return promise; +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/then.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/then.js new file mode 100644 index 0000000..b2b79f0 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/then.js @@ -0,0 +1,32 @@ +import { + invokeCallback, + subscribe, + FULFILLED, + REJECTED, + noop, + makePromise, + PROMISE_ID +} from './-internal'; + +import { asap } from './asap'; + +export default function then(onFulfillment, onRejection) { + const parent = this; + + const child = new this.constructor(noop); + + if (child[PROMISE_ID] === undefined) { + makePromise(child); + } + + const { _state } = parent; + + if (_state) { + const callback = arguments[_state - 1]; + asap(() => invokeCallback(_state, child, callback, parent._result)); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + + return child; +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/utils.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/utils.js new file mode 100644 index 0000000..72545c5 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/lib/es6-promise/utils.js @@ -0,0 +1,21 @@ +export function objectOrFunction(x) { + let type = typeof x; + return x !== null && (type === 'object' || type === 'function'); +} + +export function isFunction(x) { + return typeof x === 'function'; +} + +export function isMaybeThenable(x) { + return x !== null && typeof x === 'object'; +} + +let _isArray; +if (Array.isArray) { + _isArray = Array.isArray; +} else { + _isArray = x => Object.prototype.toString.call(x) === '[object Array]'; +} + +export const isArray = _isArray; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/package.json b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/package.json new file mode 100644 index 0000000..b9b3b22 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promise/package.json @@ -0,0 +1,78 @@ +{ + "name": "es6-promise", + "description": "A lightweight library that provides tools for organizing asynchronous code", + "version": "4.2.8", + "author": "Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)", + "browser": { + "vertx": false + }, + "bugs": { + "url": "https://github.com/stefanpenner/es6-promise/issues" + }, + "dependencies": {}, + "devDependencies": { + "babel-plugin-transform-es2015-arrow-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoping": "^6.24.1", + "babel-plugin-transform-es2015-classes": "^6.24.1", + "babel-plugin-transform-es2015-computed-properties": "^6.24.1", + "babel-plugin-transform-es2015-constants": "^6.1.4", + "babel-plugin-transform-es2015-destructuring": "^6.23.0", + "babel-plugin-transform-es2015-parameters": "^6.24.1", + "babel-plugin-transform-es2015-shorthand-properties": "^6.24.1", + "babel-plugin-transform-es2015-spread": "^6.22.0", + "babel-plugin-transform-es2015-template-literals": "^6.22.0", + "babel6-plugin-strip-class-callcheck": "^6.0.0", + "broccoli-babel-transpiler": "^6.0.0", + "broccoli-concat": "^3.1.0", + "broccoli-merge-trees": "^2.0.0", + "broccoli-rollup": "^2.0.0", + "broccoli-stew": "^1.5.0", + "broccoli-uglify-js": "^0.2.0", + "broccoli-watchify": "^1.0.1", + "ember-cli": "2.18.0-beta.2", + "ember-cli-dependency-checker": "^2.1.0", + "git-repo-version": "1.0.1", + "json3": "^3.3.2", + "mocha": "^4.0.1", + "promises-aplus-tests-phantom": "^2.1.0-revise" + }, + "directories": { + "lib": "lib" + }, + "files": [ + "dist", + "lib", + "es6-promise.d.ts", + "auto.js", + "!dist/test" + ], + "homepage": "https://github.com/stefanpenner/es6-promise", + "jsdelivr": "dist/es6-promise.auto.min.js", + "keywords": [ + "futures", + "polyfill", + "promise", + "promises" + ], + "license": "MIT", + "main": "dist/es6-promise.js", + "namespace": "es6-promise", + "repository": { + "type": "git", + "url": "git://github.com/stefanpenner/es6-promise.git" + }, + "scripts": { + "build": "ember build --environment production", + "prepublishOnly": "ember build --environment production", + "start": "ember s", + "test": "ember test", + "test:browser": "ember test --launch PhantomJS", + "test:node": "ember test --launch Mocha", + "test:server": "ember test --server" + }, + "spm": { + "main": "dist/es6-promise.js" + }, + "typings": "es6-promise.d.ts", + "unpkg": "dist/es6-promise.auto.min.js" +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/README.md b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/README.md new file mode 100644 index 0000000..4141cc8 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/README.md @@ -0,0 +1,89 @@ +[![Travis CI](https://travis-ci.org/digitaldesignlabs/es6-promisify.svg)](https://travis-ci.org/digitaldesignlabs/es6-promisify) + +# es6-promisify + +Converts callback-based functions to Promise-based functions. + +## Install + +Install with [npm](https://npmjs.org/package/es6-promisify) + +```bash +npm install --save es6-promisify +``` + +## Example + +```js +"use strict"; + +// Declare variables +const promisify = require("es6-promisify"); +const fs = require("fs"); + +// Convert the stat function +const stat = promisify(fs.stat); + +// Now usable as a promise! +stat("example.txt").then(function (stats) { + console.log("Got stats", stats); +}).catch(function (err) { + console.error("Yikes!", err); +}); +``` + +## Promisify methods +```js +"use strict"; + +// Declare variables +const promisify = require("es6-promisify"); +const redis = require("redis").createClient(6379, "localhost"); + +// Create a promise-based version of send_command +const client = promisify(redis.send_command, redis); + +// Send commands to redis and get a promise back +client("ping").then(function (pong) { + console.log("Got", pong); +}).catch(function (err) { + console.error("Unexpected error", err); +}).then(function () { + redis.quit(); +}); +``` + +## Handle callback multiple arguments +```js +"use strict"; + +// Declare functions +function test(cb) { + return cb(undefined, 1, 2, 3); +} + +// Declare variables +const promisify = require("es6-promisify"); + +// Create promise-based version of test +const single = promisify(test); +const multi = promisify(test, {multiArgs: true}); + +// Discards additional arguments +single().then(function (result) { + console.log(result); // 1 +}); + +// Returns all arguments as an array +multi().then(function (result) { + console.log(result); // [1, 2, 3] +}); +``` + +### Tests +Test with nodeunit +```bash +$ npm test +``` + +Published under the [MIT License](http://opensource.org/licenses/MIT). diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/dist/promise.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/dist/promise.js new file mode 100644 index 0000000..2fe5c61 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/dist/promise.js @@ -0,0 +1,73 @@ +"use strict"; + +/* global self, window, module, global, require */ +module.exports = function () { + + "use strict"; + + var globalObject = void 0; + + function isFunction(x) { + return typeof x === "function"; + } + + // Seek the global object + if (global !== undefined) { + globalObject = global; + } else if (window !== undefined && window.document) { + globalObject = window; + } else { + globalObject = self; + } + + // Test for any native promise implementation, and if that + // implementation appears to conform to the specificaton. + // This code mostly nicked from the es6-promise module polyfill + // and then fooled with. + var hasPromiseSupport = function () { + + // No promise object at all, and it's a non-starter + if (!globalObject.hasOwnProperty("Promise")) { + return false; + } + + // There is a Promise object. Does it conform to the spec? + var P = globalObject.Promise; + + // Some of these methods are missing from + // Firefox/Chrome experimental implementations + if (!P.hasOwnProperty("resolve") || !P.hasOwnProperty("reject")) { + return false; + } + + if (!P.hasOwnProperty("all") || !P.hasOwnProperty("race")) { + return false; + } + + // Older version of the spec had a resolver object + // as the arg rather than a function + return function () { + + var resolve = void 0; + + var p = new globalObject.Promise(function (r) { + resolve = r; + }); + + if (p) { + return isFunction(resolve); + } + + return false; + }(); + }(); + + // Export the native Promise implementation if it + // looks like it matches the spec + if (hasPromiseSupport) { + return globalObject.Promise; + } + + // Otherwise, return the es6-promise polyfill by @jaffathecake. + return require("es6-promise").Promise; +}(); \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/dist/promisify.js b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/dist/promisify.js new file mode 100644 index 0000000..ce38041 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/dist/promisify.js @@ -0,0 +1,85 @@ +"use strict"; + +/* global module, require */ +module.exports = function () { + + "use strict"; + + // Get a promise object. This may be native, or it may be polyfilled + + var ES6Promise = require("./promise.js"); + + /** + * thatLooksLikeAPromiseToMe() + * + * Duck-types a promise. + * + * @param {object} o + * @return {bool} True if this resembles a promise + */ + function thatLooksLikeAPromiseToMe(o) { + return o && typeof o.then === "function" && typeof o.catch === "function"; + } + + /** + * promisify() + * + * Transforms callback-based function -- func(arg1, arg2 .. argN, callback) -- into + * an ES6-compatible Promise. Promisify provides a default callback of the form (error, result) + * and rejects when `error` is truthy. You can also supply settings object as the second argument. + * + * @param {function} original - The function to promisify + * @param {object} settings - Settings object + * @param {object} settings.thisArg - A `this` context to use. If not set, assume `settings` _is_ `thisArg` + * @param {bool} settings.multiArgs - Should multiple arguments be returned as an array? + * @return {function} A promisified version of `original` + */ + return function promisify(original, settings) { + + return function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var returnMultipleArguments = settings && settings.multiArgs; + + var target = void 0; + if (settings && settings.thisArg) { + target = settings.thisArg; + } else if (settings) { + target = settings; + } + + // Return the promisified function + return new ES6Promise(function (resolve, reject) { + + // Append the callback bound to the context + args.push(function callback(err) { + + if (err) { + return reject(err); + } + + for (var _len2 = arguments.length, values = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + values[_key2 - 1] = arguments[_key2]; + } + + if (false === !!returnMultipleArguments) { + return resolve(values[0]); + } + + resolve(values); + }); + + // Call the function + var response = original.apply(target, args); + + // If it looks like original already returns a promise, + // then just resolve with that promise. Hopefully, the callback function we added will just be ignored. + if (thatLooksLikeAPromiseToMe(response)) { + resolve(response); + } + }); + }; + }; +}(); \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/package.json b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/package.json new file mode 100644 index 0000000..429f521 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/es6-promisify/package.json @@ -0,0 +1,41 @@ +{ + "name": "es6-promisify", + "version": "5.0.0", + "description": "Converts callback-based functions to ES6 Promises", + "main": "dist/promisify.js", + "author": "Mike Hall ", + "keywords": [ + "promises", + "es6", + "promisify" + ], + "license": "MIT", + "dependencies": { + "es6-promise": "^4.0.3" + }, + "scripts": { + "pretest": "./node_modules/eslint/bin/eslint.js ./lib/*.js ./tests/*.js", + "test": "gulp && nodeunit tests" + }, + "bugs": "http://github.com/digitaldesignlabs/es6-promisify/issues", + "files": [ + "dist/promisify.js", + "dist/promise.js" + ], + "repository": { + "type": "git", + "url": "https://github.com/digitaldesignlabs/es6-promisify.git" + }, + "devDependencies": { + "babel-preset-es2015": "^6.9.0", + "eslint": "^2.13.1", + "gulp": "^3.9.1", + "gulp-babel": "^6.1.2", + "nodeunit": "^0.10.0" + }, + "greenkeeper": { + "ignore": [ + "eslint" + ] + } +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/esprima/ChangeLog b/coc/extensions/node_modules/coc-yaml/node_modules/esprima/ChangeLog new file mode 100644 index 0000000..fafe1c9 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/esprima/ChangeLog @@ -0,0 +1,235 @@ +2018-06-17: Version 4.0.1 + + * Fix parsing async get/set in a class (issue 1861, 1875) + * Account for different return statement argument (issue 1829, 1897, 1928) + * Correct the handling of HTML comment when parsing a module (issue 1841) + * Fix incorrect parse async with proto-identifier-shorthand (issue 1847) + * Fix negative column in binary expression (issue 1844) + * Fix incorrect YieldExpression in object methods (issue 1834) + * Various documentation fixes + +2017-06-10: Version 4.0.0 + + * Support ES2017 async function and await expression (issue 1079) + * Support ES2017 trailing commas in function parameters (issue 1550) + * Explicitly distinguish parsing a module vs a script (issue 1576) + * Fix JSX non-empty container (issue 1786) + * Allow JSX element in a yield expression (issue 1765) + * Allow `in` expression in a concise body with a function body (issue 1793) + * Setter function argument must not be a rest parameter (issue 1693) + * Limit strict mode directive to functions with a simple parameter list (issue 1677) + * Prohibit any escape sequence in a reserved word (issue 1612) + * Only permit hex digits in hex escape sequence (issue 1619) + * Prohibit labelled class/generator/function declaration (issue 1484) + * Limit function declaration as if statement clause only in non-strict mode (issue 1657) + * Tolerate missing ) in a with and do-while statement (issue 1481) + +2016-12-22: Version 3.1.3 + + * Support binding patterns as rest element (issue 1681) + * Account for different possible arguments of a yield expression (issue 1469) + +2016-11-24: Version 3.1.2 + + * Ensure that import specifier is more restrictive (issue 1615) + * Fix duplicated JSX tokens (issue 1613) + * Scan template literal in a JSX expression container (issue 1622) + * Improve XHTML entity scanning in JSX (issue 1629) + +2016-10-31: Version 3.1.1 + + * Fix assignment expression problem in an export declaration (issue 1596) + * Fix incorrect tokenization of hex digits (issue 1605) + +2016-10-09: Version 3.1.0 + + * Do not implicitly collect comments when comment attachment is specified (issue 1553) + * Fix incorrect handling of duplicated proto shorthand fields (issue 1485) + * Prohibit initialization in some variants of for statements (issue 1309, 1561) + * Fix incorrect parsing of export specifier (issue 1578) + * Fix ESTree compatibility for assignment pattern (issue 1575) + +2016-09-03: Version 3.0.0 + + * Support ES2016 exponentiation expression (issue 1490) + * Support JSX syntax (issue 1467) + * Use the latest Unicode 8.0 (issue 1475) + * Add the support for syntax node delegate (issue 1435) + * Fix ESTree compatibility on meta property (issue 1338) + * Fix ESTree compatibility on default parameter value (issue 1081) + * Fix ESTree compatibility on try handler (issue 1030) + +2016-08-23: Version 2.7.3 + + * Fix tokenizer confusion with a comment (issue 1493, 1516) + +2016-02-02: Version 2.7.2 + + * Fix out-of-bound error location in an invalid string literal (issue 1457) + * Fix shorthand object destructuring defaults in variable declarations (issue 1459) + +2015-12-10: Version 2.7.1 + + * Do not allow trailing comma in a variable declaration (issue 1360) + * Fix assignment to `let` in non-strict mode (issue 1376) + * Fix missing delegate property in YieldExpression (issue 1407) + +2015-10-22: Version 2.7.0 + + * Fix the handling of semicolon in a break statement (issue 1044) + * Run the test suite with major web browsers (issue 1259, 1317) + * Allow `let` as an identifier in non-strict mode (issue 1289) + * Attach orphaned comments as `innerComments` (issue 1328) + * Add the support for token delegator (issue 1332) + +2015-09-01: Version 2.6.0 + + * Properly allow or prohibit `let` in a binding identifier/pattern (issue 1048, 1098) + * Add sourceType field for Program node (issue 1159) + * Ensure that strict mode reserved word binding throw an error (issue 1171) + * Run the test suite with Node.js and IE 11 on Windows (issue 1294) + * Allow binding pattern with no initializer in a for statement (issue 1301) + +2015-07-31: Version 2.5.0 + + * Run the test suite in a browser environment (issue 1004) + * Ensure a comma between imported default binding and named imports (issue 1046) + * Distinguish `yield` as a keyword vs an identifier (issue 1186) + * Support ES6 meta property `new.target` (issue 1203) + * Fix the syntax node for yield with expression (issue 1223) + * Fix the check of duplicated proto in property names (issue 1225) + * Fix ES6 Unicode escape in identifier name (issue 1229) + * Support ES6 IdentifierStart and IdentifierPart (issue 1232) + * Treat await as a reserved word when parsing as a module (issue 1234) + * Recognize identifier characters from Unicode SMP (issue 1244) + * Ensure that export and import can be followed by a comma (issue 1250) + * Fix yield operator precedence (issue 1262) + +2015-07-01: Version 2.4.1 + + * Fix some cases of comment attachment (issue 1071, 1175) + * Fix the handling of destructuring in function arguments (issue 1193) + * Fix invalid ranges in assignment expression (issue 1201) + +2015-06-26: Version 2.4.0 + + * Support ES6 for-of iteration (issue 1047) + * Support ES6 spread arguments (issue 1169) + * Minimize npm payload (issue 1191) + +2015-06-16: Version 2.3.0 + + * Support ES6 generator (issue 1033) + * Improve parsing of regular expressions with `u` flag (issue 1179) + +2015-04-17: Version 2.2.0 + + * Support ES6 import and export declarations (issue 1000) + * Fix line terminator before arrow not recognized as error (issue 1009) + * Support ES6 destructuring (issue 1045) + * Support ES6 template literal (issue 1074) + * Fix the handling of invalid/incomplete string escape sequences (issue 1106) + * Fix ES3 static member access restriction (issue 1120) + * Support for `super` in ES6 class (issue 1147) + +2015-03-09: Version 2.1.0 + + * Support ES6 class (issue 1001) + * Support ES6 rest parameter (issue 1011) + * Expand the location of property getter, setter, and methods (issue 1029) + * Enable TryStatement transition to a single handler (issue 1031) + * Support ES6 computed property name (issue 1037) + * Tolerate unclosed block comment (issue 1041) + * Support ES6 lexical declaration (issue 1065) + +2015-02-06: Version 2.0.0 + + * Support ES6 arrow function (issue 517) + * Support ES6 Unicode code point escape (issue 521) + * Improve the speed and accuracy of comment attachment (issue 522) + * Support ES6 default parameter (issue 519) + * Support ES6 regular expression flags (issue 557) + * Fix scanning of implicit octal literals (issue 565) + * Fix the handling of automatic semicolon insertion (issue 574) + * Support ES6 method definition (issue 620) + * Support ES6 octal integer literal (issue 621) + * Support ES6 binary integer literal (issue 622) + * Support ES6 object literal property value shorthand (issue 624) + +2015-03-03: Version 1.2.5 + + * Fix scanning of implicit octal literals (issue 565) + +2015-02-05: Version 1.2.4 + + * Fix parsing of LeftHandSideExpression in ForInStatement (issue 560) + * Fix the handling of automatic semicolon insertion (issue 574) + +2015-01-18: Version 1.2.3 + + * Fix division by this (issue 616) + +2014-05-18: Version 1.2.2 + + * Fix duplicated tokens when collecting comments (issue 537) + +2014-05-04: Version 1.2.1 + + * Ensure that Program node may still have leading comments (issue 536) + +2014-04-29: Version 1.2.0 + + * Fix semicolon handling for expression statement (issue 462, 533) + * Disallow escaped characters in regular expression flags (issue 503) + * Performance improvement for location tracking (issue 520) + * Improve the speed of comment attachment (issue 522) + +2014-03-26: Version 1.1.1 + + * Fix token handling of forward slash after an array literal (issue 512) + +2014-03-23: Version 1.1.0 + + * Optionally attach comments to the owning syntax nodes (issue 197) + * Simplify binary parsing with stack-based shift reduce (issue 352) + * Always include the raw source of literals (issue 376) + * Add optional input source information (issue 386) + * Tokenizer API for pure lexical scanning (issue 398) + * Improve the web site and its online demos (issue 337, 400, 404) + * Performance improvement for location tracking (issue 417, 424) + * Support HTML comment syntax (issue 451) + * Drop support for legacy browsers (issue 474) + +2013-08-27: Version 1.0.4 + + * Minimize the payload for packages (issue 362) + * Fix missing cases on an empty switch statement (issue 436) + * Support escaped ] in regexp literal character classes (issue 442) + * Tolerate invalid left-hand side expression (issue 130) + +2013-05-17: Version 1.0.3 + + * Variable declaration needs at least one declarator (issue 391) + * Fix benchmark's variance unit conversion (issue 397) + * IE < 9: \v should be treated as vertical tab (issue 405) + * Unary expressions should always have prefix: true (issue 418) + * Catch clause should only accept an identifier (issue 423) + * Tolerate setters without parameter (issue 426) + +2012-11-02: Version 1.0.2 + + Improvement: + + * Fix esvalidate JUnit output upon a syntax error (issue 374) + +2012-10-28: Version 1.0.1 + + Improvements: + + * esvalidate understands shebang in a Unix shell script (issue 361) + * esvalidate treats fatal parsing failure as an error (issue 361) + * Reduce Node.js package via .npmignore (issue 362) + +2012-10-22: Version 1.0.0 + + Initial release. diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/esprima/LICENSE.BSD b/coc/extensions/node_modules/coc-yaml/node_modules/esprima/LICENSE.BSD new file mode 100644 index 0000000..7a55160 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/esprima/LICENSE.BSD @@ -0,0 +1,21 @@ +Copyright JS Foundation and other contributors, https://js.foundation/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 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. diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/esprima/README.md b/coc/extensions/node_modules/coc-yaml/node_modules/esprima/README.md new file mode 100644 index 0000000..8fb25e6 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/esprima/README.md @@ -0,0 +1,46 @@ +[![NPM version](https://img.shields.io/npm/v/esprima.svg)](https://www.npmjs.com/package/esprima) +[![npm download](https://img.shields.io/npm/dm/esprima.svg)](https://www.npmjs.com/package/esprima) +[![Build Status](https://img.shields.io/travis/jquery/esprima/master.svg)](https://travis-ci.org/jquery/esprima) +[![Coverage Status](https://img.shields.io/codecov/c/github/jquery/esprima/master.svg)](https://codecov.io/github/jquery/esprima) + +**Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance, +standard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) +parser written in ECMAScript (also popularly known as +[JavaScript](https://en.wikipedia.org/wiki/JavaScript)). +Esprima is created and maintained by [Ariya Hidayat](https://twitter.com/ariyahidayat), +with the help of [many contributors](https://github.com/jquery/esprima/contributors). + +### Features + +- Full support for ECMAScript 2017 ([ECMA-262 8th Edition](http://www.ecma-international.org/publications/standards/Ecma-262.htm)) +- Sensible [syntax tree format](https://github.com/estree/estree/blob/master/es5.md) as standardized by [ESTree project](https://github.com/estree/estree) +- Experimental support for [JSX](https://facebook.github.io/jsx/), a syntax extension for [React](https://facebook.github.io/react/) +- Optional tracking of syntax node location (index-based and line-column) +- [Heavily tested](http://esprima.org/test/ci.html) (~1500 [unit tests](https://github.com/jquery/esprima/tree/master/test/fixtures) with [full code coverage](https://codecov.io/github/jquery/esprima)) + +### API + +Esprima can be used to perform [lexical analysis](https://en.wikipedia.org/wiki/Lexical_analysis) (tokenization) or [syntactic analysis](https://en.wikipedia.org/wiki/Parsing) (parsing) of a JavaScript program. + +A simple example on Node.js REPL: + +```javascript +> var esprima = require('esprima'); +> var program = 'const answer = 42'; + +> esprima.tokenize(program); +[ { type: 'Keyword', value: 'const' }, + { type: 'Identifier', value: 'answer' }, + { type: 'Punctuator', value: '=' }, + { type: 'Numeric', value: '42' } ] + +> esprima.parseScript(program); +{ type: 'Program', + body: + [ { type: 'VariableDeclaration', + declarations: [Object], + kind: 'const' } ], + sourceType: 'script' } +``` + +For more information, please read the [complete documentation](http://esprima.org/doc). \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/esprima/bin/esparse.js b/coc/extensions/node_modules/coc-yaml/node_modules/esprima/bin/esparse.js new file mode 100755 index 0000000..45d05fb --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/esprima/bin/esparse.js @@ -0,0 +1,139 @@ +#!/usr/bin/env node +/* + Copyright JS Foundation and other contributors, https://js.foundation/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 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. +*/ + +/*jslint sloppy:true node:true rhino:true */ + +var fs, esprima, fname, forceFile, content, options, syntax; + +if (typeof require === 'function') { + fs = require('fs'); + try { + esprima = require('esprima'); + } catch (e) { + esprima = require('../'); + } +} else if (typeof load === 'function') { + try { + load('esprima.js'); + } catch (e) { + load('../esprima.js'); + } +} + +// Shims to Node.js objects when running under Rhino. +if (typeof console === 'undefined' && typeof process === 'undefined') { + console = { log: print }; + fs = { readFileSync: readFile }; + process = { argv: arguments, exit: quit }; + process.argv.unshift('esparse.js'); + process.argv.unshift('rhino'); +} + +function showUsage() { + console.log('Usage:'); + console.log(' esparse [options] [file.js]'); + console.log(); + console.log('Available options:'); + console.log(); + console.log(' --comment Gather all line and block comments in an array'); + console.log(' --loc Include line-column location info for each syntax node'); + console.log(' --range Include index-based range for each syntax node'); + console.log(' --raw Display the raw value of literals'); + console.log(' --tokens List all tokens in an array'); + console.log(' --tolerant Tolerate errors on a best-effort basis (experimental)'); + console.log(' -v, --version Shows program version'); + console.log(); + process.exit(1); +} + +options = {}; + +process.argv.splice(2).forEach(function (entry) { + + if (forceFile || entry === '-' || entry.slice(0, 1) !== '-') { + if (typeof fname === 'string') { + console.log('Error: more than one input file.'); + process.exit(1); + } else { + fname = entry; + } + } else if (entry === '-h' || entry === '--help') { + showUsage(); + } else if (entry === '-v' || entry === '--version') { + console.log('ECMAScript Parser (using Esprima version', esprima.version, ')'); + console.log(); + process.exit(0); + } else if (entry === '--comment') { + options.comment = true; + } else if (entry === '--loc') { + options.loc = true; + } else if (entry === '--range') { + options.range = true; + } else if (entry === '--raw') { + options.raw = true; + } else if (entry === '--tokens') { + options.tokens = true; + } else if (entry === '--tolerant') { + options.tolerant = true; + } else if (entry === '--') { + forceFile = true; + } else { + console.log('Error: unknown option ' + entry + '.'); + process.exit(1); + } +}); + +// Special handling for regular expression literal since we need to +// convert it to a string literal, otherwise it will be decoded +// as object "{}" and the regular expression would be lost. +function adjustRegexLiteral(key, value) { + if (key === 'value' && value instanceof RegExp) { + value = value.toString(); + } + return value; +} + +function run(content) { + syntax = esprima.parse(content, options); + console.log(JSON.stringify(syntax, adjustRegexLiteral, 4)); +} + +try { + if (fname && (fname !== '-' || forceFile)) { + run(fs.readFileSync(fname, 'utf-8')); + } else { + var content = ''; + process.stdin.resume(); + process.stdin.on('data', function(chunk) { + content += chunk; + }); + process.stdin.on('end', function() { + run(content); + }); + } +} catch (e) { + console.log('Error: ' + e.message); + process.exit(1); +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/esprima/bin/esvalidate.js b/coc/extensions/node_modules/coc-yaml/node_modules/esprima/bin/esvalidate.js new file mode 100755 index 0000000..d49a7e4 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/esprima/bin/esvalidate.js @@ -0,0 +1,236 @@ +#!/usr/bin/env node +/* + Copyright JS Foundation and other contributors, https://js.foundation/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 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. +*/ + +/*jslint sloppy:true plusplus:true node:true rhino:true */ +/*global phantom:true */ + +var fs, system, esprima, options, fnames, forceFile, count; + +if (typeof esprima === 'undefined') { + // PhantomJS can only require() relative files + if (typeof phantom === 'object') { + fs = require('fs'); + system = require('system'); + esprima = require('./esprima'); + } else if (typeof require === 'function') { + fs = require('fs'); + try { + esprima = require('esprima'); + } catch (e) { + esprima = require('../'); + } + } else if (typeof load === 'function') { + try { + load('esprima.js'); + } catch (e) { + load('../esprima.js'); + } + } +} + +// Shims to Node.js objects when running under PhantomJS 1.7+. +if (typeof phantom === 'object') { + fs.readFileSync = fs.read; + process = { + argv: [].slice.call(system.args), + exit: phantom.exit, + on: function (evt, callback) { + callback(); + } + }; + process.argv.unshift('phantomjs'); +} + +// Shims to Node.js objects when running under Rhino. +if (typeof console === 'undefined' && typeof process === 'undefined') { + console = { log: print }; + fs = { readFileSync: readFile }; + process = { + argv: arguments, + exit: quit, + on: function (evt, callback) { + callback(); + } + }; + process.argv.unshift('esvalidate.js'); + process.argv.unshift('rhino'); +} + +function showUsage() { + console.log('Usage:'); + console.log(' esvalidate [options] [file.js...]'); + console.log(); + console.log('Available options:'); + console.log(); + console.log(' --format=type Set the report format, plain (default) or junit'); + console.log(' -v, --version Print program version'); + console.log(); + process.exit(1); +} + +options = { + format: 'plain' +}; + +fnames = []; + +process.argv.splice(2).forEach(function (entry) { + + if (forceFile || entry === '-' || entry.slice(0, 1) !== '-') { + fnames.push(entry); + } else if (entry === '-h' || entry === '--help') { + showUsage(); + } else if (entry === '-v' || entry === '--version') { + console.log('ECMAScript Validator (using Esprima version', esprima.version, ')'); + console.log(); + process.exit(0); + } else if (entry.slice(0, 9) === '--format=') { + options.format = entry.slice(9); + if (options.format !== 'plain' && options.format !== 'junit') { + console.log('Error: unknown report format ' + options.format + '.'); + process.exit(1); + } + } else if (entry === '--') { + forceFile = true; + } else { + console.log('Error: unknown option ' + entry + '.'); + process.exit(1); + } +}); + +if (fnames.length === 0) { + fnames.push(''); +} + +if (options.format === 'junit') { + console.log(''); + console.log(''); +} + +count = 0; + +function run(fname, content) { + var timestamp, syntax, name; + try { + if (typeof content !== 'string') { + throw content; + } + + if (content[0] === '#' && content[1] === '!') { + content = '//' + content.substr(2, content.length); + } + + timestamp = Date.now(); + syntax = esprima.parse(content, { tolerant: true }); + + if (options.format === 'junit') { + + name = fname; + if (name.lastIndexOf('/') >= 0) { + name = name.slice(name.lastIndexOf('/') + 1); + } + + console.log(''); + + syntax.errors.forEach(function (error) { + var msg = error.message; + msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); + console.log(' '); + console.log(' ' + + error.message + '(' + name + ':' + error.lineNumber + ')' + + ''); + console.log(' '); + }); + + console.log(''); + + } else if (options.format === 'plain') { + + syntax.errors.forEach(function (error) { + var msg = error.message; + msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); + msg = fname + ':' + error.lineNumber + ': ' + msg; + console.log(msg); + ++count; + }); + + } + } catch (e) { + ++count; + if (options.format === 'junit') { + console.log(''); + console.log(' '); + console.log(' ' + + e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') + + ')'); + console.log(' '); + console.log(''); + } else { + console.log(fname + ':' + e.lineNumber + ': ' + e.message.replace(/^Line\ [0-9]*\:\ /, '')); + } + } +} + +fnames.forEach(function (fname) { + var content = ''; + try { + if (fname && (fname !== '-' || forceFile)) { + content = fs.readFileSync(fname, 'utf-8'); + } else { + fname = ''; + process.stdin.resume(); + process.stdin.on('data', function(chunk) { + content += chunk; + }); + process.stdin.on('end', function() { + run(fname, content); + }); + return; + } + } catch (e) { + content = e; + } + run(fname, content); +}); + +process.on('exit', function () { + if (options.format === 'junit') { + console.log(''); + } + + if (count > 0) { + process.exit(1); + } + + if (count === 0 && typeof phantom === 'object') { + process.exit(0); + } +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/esprima/dist/esprima.js b/coc/extensions/node_modules/coc-yaml/node_modules/esprima/dist/esprima.js new file mode 100644 index 0000000..2af3eee --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/esprima/dist/esprima.js @@ -0,0 +1,6709 @@ +(function webpackUniversalModuleDefinition(root, factory) { +/* istanbul ignore next */ + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); +/* istanbul ignore next */ + else if(typeof exports === 'object') + exports["esprima"] = factory(); + else + root["esprima"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/* istanbul ignore if */ +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + /* + Copyright JS Foundation and other contributors, https://js.foundation/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 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. + */ + Object.defineProperty(exports, "__esModule", { value: true }); + var comment_handler_1 = __webpack_require__(1); + var jsx_parser_1 = __webpack_require__(3); + var parser_1 = __webpack_require__(8); + var tokenizer_1 = __webpack_require__(15); + function parse(code, options, delegate) { + var commentHandler = null; + var proxyDelegate = function (node, metadata) { + if (delegate) { + delegate(node, metadata); + } + if (commentHandler) { + commentHandler.visit(node, metadata); + } + }; + var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null; + var collectComment = false; + if (options) { + collectComment = (typeof options.comment === 'boolean' && options.comment); + var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment); + if (collectComment || attachComment) { + commentHandler = new comment_handler_1.CommentHandler(); + commentHandler.attach = attachComment; + options.comment = true; + parserDelegate = proxyDelegate; + } + } + var isModule = false; + if (options && typeof options.sourceType === 'string') { + isModule = (options.sourceType === 'module'); + } + var parser; + if (options && typeof options.jsx === 'boolean' && options.jsx) { + parser = new jsx_parser_1.JSXParser(code, options, parserDelegate); + } + else { + parser = new parser_1.Parser(code, options, parserDelegate); + } + var program = isModule ? parser.parseModule() : parser.parseScript(); + var ast = program; + if (collectComment && commentHandler) { + ast.comments = commentHandler.comments; + } + if (parser.config.tokens) { + ast.tokens = parser.tokens; + } + if (parser.config.tolerant) { + ast.errors = parser.errorHandler.errors; + } + return ast; + } + exports.parse = parse; + function parseModule(code, options, delegate) { + var parsingOptions = options || {}; + parsingOptions.sourceType = 'module'; + return parse(code, parsingOptions, delegate); + } + exports.parseModule = parseModule; + function parseScript(code, options, delegate) { + var parsingOptions = options || {}; + parsingOptions.sourceType = 'script'; + return parse(code, parsingOptions, delegate); + } + exports.parseScript = parseScript; + function tokenize(code, options, delegate) { + var tokenizer = new tokenizer_1.Tokenizer(code, options); + var tokens; + tokens = []; + try { + while (true) { + var token = tokenizer.getNextToken(); + if (!token) { + break; + } + if (delegate) { + token = delegate(token); + } + tokens.push(token); + } + } + catch (e) { + tokenizer.errorHandler.tolerate(e); + } + if (tokenizer.errorHandler.tolerant) { + tokens.errors = tokenizer.errors(); + } + return tokens; + } + exports.tokenize = tokenize; + var syntax_1 = __webpack_require__(2); + exports.Syntax = syntax_1.Syntax; + // Sync with *.json manifests. + exports.version = '4.0.1'; + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var syntax_1 = __webpack_require__(2); + var CommentHandler = (function () { + function CommentHandler() { + this.attach = false; + this.comments = []; + this.stack = []; + this.leading = []; + this.trailing = []; + } + CommentHandler.prototype.insertInnerComments = function (node, metadata) { + // innnerComments for properties empty block + // `function a() {/** comments **\/}` + if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) { + var innerComments = []; + for (var i = this.leading.length - 1; i >= 0; --i) { + var entry = this.leading[i]; + if (metadata.end.offset >= entry.start) { + innerComments.unshift(entry.comment); + this.leading.splice(i, 1); + this.trailing.splice(i, 1); + } + } + if (innerComments.length) { + node.innerComments = innerComments; + } + } + }; + CommentHandler.prototype.findTrailingComments = function (metadata) { + var trailingComments = []; + if (this.trailing.length > 0) { + for (var i = this.trailing.length - 1; i >= 0; --i) { + var entry_1 = this.trailing[i]; + if (entry_1.start >= metadata.end.offset) { + trailingComments.unshift(entry_1.comment); + } + } + this.trailing.length = 0; + return trailingComments; + } + var entry = this.stack[this.stack.length - 1]; + if (entry && entry.node.trailingComments) { + var firstComment = entry.node.trailingComments[0]; + if (firstComment && firstComment.range[0] >= metadata.end.offset) { + trailingComments = entry.node.trailingComments; + delete entry.node.trailingComments; + } + } + return trailingComments; + }; + CommentHandler.prototype.findLeadingComments = function (metadata) { + var leadingComments = []; + var target; + while (this.stack.length > 0) { + var entry = this.stack[this.stack.length - 1]; + if (entry && entry.start >= metadata.start.offset) { + target = entry.node; + this.stack.pop(); + } + else { + break; + } + } + if (target) { + var count = target.leadingComments ? target.leadingComments.length : 0; + for (var i = count - 1; i >= 0; --i) { + var comment = target.leadingComments[i]; + if (comment.range[1] <= metadata.start.offset) { + leadingComments.unshift(comment); + target.leadingComments.splice(i, 1); + } + } + if (target.leadingComments && target.leadingComments.length === 0) { + delete target.leadingComments; + } + return leadingComments; + } + for (var i = this.leading.length - 1; i >= 0; --i) { + var entry = this.leading[i]; + if (entry.start <= metadata.start.offset) { + leadingComments.unshift(entry.comment); + this.leading.splice(i, 1); + } + } + return leadingComments; + }; + CommentHandler.prototype.visitNode = function (node, metadata) { + if (node.type === syntax_1.Syntax.Program && node.body.length > 0) { + return; + } + this.insertInnerComments(node, metadata); + var trailingComments = this.findTrailingComments(metadata); + var leadingComments = this.findLeadingComments(metadata); + if (leadingComments.length > 0) { + node.leadingComments = leadingComments; + } + if (trailingComments.length > 0) { + node.trailingComments = trailingComments; + } + this.stack.push({ + node: node, + start: metadata.start.offset + }); + }; + CommentHandler.prototype.visitComment = function (node, metadata) { + var type = (node.type[0] === 'L') ? 'Line' : 'Block'; + var comment = { + type: type, + value: node.value + }; + if (node.range) { + comment.range = node.range; + } + if (node.loc) { + comment.loc = node.loc; + } + this.comments.push(comment); + if (this.attach) { + var entry = { + comment: { + type: type, + value: node.value, + range: [metadata.start.offset, metadata.end.offset] + }, + start: metadata.start.offset + }; + if (node.loc) { + entry.comment.loc = node.loc; + } + node.type = type; + this.leading.push(entry); + this.trailing.push(entry); + } + }; + CommentHandler.prototype.visit = function (node, metadata) { + if (node.type === 'LineComment') { + this.visitComment(node, metadata); + } + else if (node.type === 'BlockComment') { + this.visitComment(node, metadata); + } + else if (this.attach) { + this.visitNode(node, metadata); + } + }; + return CommentHandler; + }()); + exports.CommentHandler = CommentHandler; + + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForOfStatement: 'ForOfStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchCase: 'SwitchCase', + SwitchStatement: 'SwitchStatement', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; + + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; +/* istanbul ignore next */ + var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + var character_1 = __webpack_require__(4); + var JSXNode = __webpack_require__(5); + var jsx_syntax_1 = __webpack_require__(6); + var Node = __webpack_require__(7); + var parser_1 = __webpack_require__(8); + var token_1 = __webpack_require__(13); + var xhtml_entities_1 = __webpack_require__(14); + token_1.TokenName[100 /* Identifier */] = 'JSXIdentifier'; + token_1.TokenName[101 /* Text */] = 'JSXText'; + // Fully qualified element name, e.g. returns "svg:path" + function getQualifiedElementName(elementName) { + var qualifiedName; + switch (elementName.type) { + case jsx_syntax_1.JSXSyntax.JSXIdentifier: + var id = elementName; + qualifiedName = id.name; + break; + case jsx_syntax_1.JSXSyntax.JSXNamespacedName: + var ns = elementName; + qualifiedName = getQualifiedElementName(ns.namespace) + ':' + + getQualifiedElementName(ns.name); + break; + case jsx_syntax_1.JSXSyntax.JSXMemberExpression: + var expr = elementName; + qualifiedName = getQualifiedElementName(expr.object) + '.' + + getQualifiedElementName(expr.property); + break; + /* istanbul ignore next */ + default: + break; + } + return qualifiedName; + } + var JSXParser = (function (_super) { + __extends(JSXParser, _super); + function JSXParser(code, options, delegate) { + return _super.call(this, code, options, delegate) || this; + } + JSXParser.prototype.parsePrimaryExpression = function () { + return this.match('<') ? this.parseJSXRoot() : _super.prototype.parsePrimaryExpression.call(this); + }; + JSXParser.prototype.startJSX = function () { + // Unwind the scanner before the lookahead token. + this.scanner.index = this.startMarker.index; + this.scanner.lineNumber = this.startMarker.line; + this.scanner.lineStart = this.startMarker.index - this.startMarker.column; + }; + JSXParser.prototype.finishJSX = function () { + // Prime the next lookahead. + this.nextToken(); + }; + JSXParser.prototype.reenterJSX = function () { + this.startJSX(); + this.expectJSX('}'); + // Pop the closing '}' added from the lookahead. + if (this.config.tokens) { + this.tokens.pop(); + } + }; + JSXParser.prototype.createJSXNode = function () { + this.collectComments(); + return { + index: this.scanner.index, + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + }; + }; + JSXParser.prototype.createJSXChildNode = function () { + return { + index: this.scanner.index, + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + }; + }; + JSXParser.prototype.scanXHTMLEntity = function (quote) { + var result = '&'; + var valid = true; + var terminated = false; + var numeric = false; + var hex = false; + while (!this.scanner.eof() && valid && !terminated) { + var ch = this.scanner.source[this.scanner.index]; + if (ch === quote) { + break; + } + terminated = (ch === ';'); + result += ch; + ++this.scanner.index; + if (!terminated) { + switch (result.length) { + case 2: + // e.g. '{' + numeric = (ch === '#'); + break; + case 3: + if (numeric) { + // e.g. 'A' + hex = (ch === 'x'); + valid = hex || character_1.Character.isDecimalDigit(ch.charCodeAt(0)); + numeric = numeric && !hex; + } + break; + default: + valid = valid && !(numeric && !character_1.Character.isDecimalDigit(ch.charCodeAt(0))); + valid = valid && !(hex && !character_1.Character.isHexDigit(ch.charCodeAt(0))); + break; + } + } + } + if (valid && terminated && result.length > 2) { + // e.g. 'A' becomes just '#x41' + var str = result.substr(1, result.length - 2); + if (numeric && str.length > 1) { + result = String.fromCharCode(parseInt(str.substr(1), 10)); + } + else if (hex && str.length > 2) { + result = String.fromCharCode(parseInt('0' + str.substr(1), 16)); + } + else if (!numeric && !hex && xhtml_entities_1.XHTMLEntities[str]) { + result = xhtml_entities_1.XHTMLEntities[str]; + } + } + return result; + }; + // Scan the next JSX token. This replaces Scanner#lex when in JSX mode. + JSXParser.prototype.lexJSX = function () { + var cp = this.scanner.source.charCodeAt(this.scanner.index); + // < > / : = { } + if (cp === 60 || cp === 62 || cp === 47 || cp === 58 || cp === 61 || cp === 123 || cp === 125) { + var value = this.scanner.source[this.scanner.index++]; + return { + type: 7 /* Punctuator */, + value: value, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: this.scanner.index - 1, + end: this.scanner.index + }; + } + // " ' + if (cp === 34 || cp === 39) { + var start = this.scanner.index; + var quote = this.scanner.source[this.scanner.index++]; + var str = ''; + while (!this.scanner.eof()) { + var ch = this.scanner.source[this.scanner.index++]; + if (ch === quote) { + break; + } + else if (ch === '&') { + str += this.scanXHTMLEntity(quote); + } + else { + str += ch; + } + } + return { + type: 8 /* StringLiteral */, + value: str, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: start, + end: this.scanner.index + }; + } + // ... or . + if (cp === 46) { + var n1 = this.scanner.source.charCodeAt(this.scanner.index + 1); + var n2 = this.scanner.source.charCodeAt(this.scanner.index + 2); + var value = (n1 === 46 && n2 === 46) ? '...' : '.'; + var start = this.scanner.index; + this.scanner.index += value.length; + return { + type: 7 /* Punctuator */, + value: value, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: start, + end: this.scanner.index + }; + } + // ` + if (cp === 96) { + // Only placeholder, since it will be rescanned as a real assignment expression. + return { + type: 10 /* Template */, + value: '', + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: this.scanner.index, + end: this.scanner.index + }; + } + // Identifer can not contain backslash (char code 92). + if (character_1.Character.isIdentifierStart(cp) && (cp !== 92)) { + var start = this.scanner.index; + ++this.scanner.index; + while (!this.scanner.eof()) { + var ch = this.scanner.source.charCodeAt(this.scanner.index); + if (character_1.Character.isIdentifierPart(ch) && (ch !== 92)) { + ++this.scanner.index; + } + else if (ch === 45) { + // Hyphen (char code 45) can be part of an identifier. + ++this.scanner.index; + } + else { + break; + } + } + var id = this.scanner.source.slice(start, this.scanner.index); + return { + type: 100 /* Identifier */, + value: id, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: start, + end: this.scanner.index + }; + } + return this.scanner.lex(); + }; + JSXParser.prototype.nextJSXToken = function () { + this.collectComments(); + this.startMarker.index = this.scanner.index; + this.startMarker.line = this.scanner.lineNumber; + this.startMarker.column = this.scanner.index - this.scanner.lineStart; + var token = this.lexJSX(); + this.lastMarker.index = this.scanner.index; + this.lastMarker.line = this.scanner.lineNumber; + this.lastMarker.column = this.scanner.index - this.scanner.lineStart; + if (this.config.tokens) { + this.tokens.push(this.convertToken(token)); + } + return token; + }; + JSXParser.prototype.nextJSXText = function () { + this.startMarker.index = this.scanner.index; + this.startMarker.line = this.scanner.lineNumber; + this.startMarker.column = this.scanner.index - this.scanner.lineStart; + var start = this.scanner.index; + var text = ''; + while (!this.scanner.eof()) { + var ch = this.scanner.source[this.scanner.index]; + if (ch === '{' || ch === '<') { + break; + } + ++this.scanner.index; + text += ch; + if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { + ++this.scanner.lineNumber; + if (ch === '\r' && this.scanner.source[this.scanner.index] === '\n') { + ++this.scanner.index; + } + this.scanner.lineStart = this.scanner.index; + } + } + this.lastMarker.index = this.scanner.index; + this.lastMarker.line = this.scanner.lineNumber; + this.lastMarker.column = this.scanner.index - this.scanner.lineStart; + var token = { + type: 101 /* Text */, + value: text, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: start, + end: this.scanner.index + }; + if ((text.length > 0) && this.config.tokens) { + this.tokens.push(this.convertToken(token)); + } + return token; + }; + JSXParser.prototype.peekJSXToken = function () { + var state = this.scanner.saveState(); + this.scanner.scanComments(); + var next = this.lexJSX(); + this.scanner.restoreState(state); + return next; + }; + // Expect the next JSX token to match the specified punctuator. + // If not, an exception will be thrown. + JSXParser.prototype.expectJSX = function (value) { + var token = this.nextJSXToken(); + if (token.type !== 7 /* Punctuator */ || token.value !== value) { + this.throwUnexpectedToken(token); + } + }; + // Return true if the next JSX token matches the specified punctuator. + JSXParser.prototype.matchJSX = function (value) { + var next = this.peekJSXToken(); + return next.type === 7 /* Punctuator */ && next.value === value; + }; + JSXParser.prototype.parseJSXIdentifier = function () { + var node = this.createJSXNode(); + var token = this.nextJSXToken(); + if (token.type !== 100 /* Identifier */) { + this.throwUnexpectedToken(token); + } + return this.finalize(node, new JSXNode.JSXIdentifier(token.value)); + }; + JSXParser.prototype.parseJSXElementName = function () { + var node = this.createJSXNode(); + var elementName = this.parseJSXIdentifier(); + if (this.matchJSX(':')) { + var namespace = elementName; + this.expectJSX(':'); + var name_1 = this.parseJSXIdentifier(); + elementName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_1)); + } + else if (this.matchJSX('.')) { + while (this.matchJSX('.')) { + var object = elementName; + this.expectJSX('.'); + var property = this.parseJSXIdentifier(); + elementName = this.finalize(node, new JSXNode.JSXMemberExpression(object, property)); + } + } + return elementName; + }; + JSXParser.prototype.parseJSXAttributeName = function () { + var node = this.createJSXNode(); + var attributeName; + var identifier = this.parseJSXIdentifier(); + if (this.matchJSX(':')) { + var namespace = identifier; + this.expectJSX(':'); + var name_2 = this.parseJSXIdentifier(); + attributeName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_2)); + } + else { + attributeName = identifier; + } + return attributeName; + }; + JSXParser.prototype.parseJSXStringLiteralAttribute = function () { + var node = this.createJSXNode(); + var token = this.nextJSXToken(); + if (token.type !== 8 /* StringLiteral */) { + this.throwUnexpectedToken(token); + } + var raw = this.getTokenRaw(token); + return this.finalize(node, new Node.Literal(token.value, raw)); + }; + JSXParser.prototype.parseJSXExpressionAttribute = function () { + var node = this.createJSXNode(); + this.expectJSX('{'); + this.finishJSX(); + if (this.match('}')) { + this.tolerateError('JSX attributes must only be assigned a non-empty expression'); + } + var expression = this.parseAssignmentExpression(); + this.reenterJSX(); + return this.finalize(node, new JSXNode.JSXExpressionContainer(expression)); + }; + JSXParser.prototype.parseJSXAttributeValue = function () { + return this.matchJSX('{') ? this.parseJSXExpressionAttribute() : + this.matchJSX('<') ? this.parseJSXElement() : this.parseJSXStringLiteralAttribute(); + }; + JSXParser.prototype.parseJSXNameValueAttribute = function () { + var node = this.createJSXNode(); + var name = this.parseJSXAttributeName(); + var value = null; + if (this.matchJSX('=')) { + this.expectJSX('='); + value = this.parseJSXAttributeValue(); + } + return this.finalize(node, new JSXNode.JSXAttribute(name, value)); + }; + JSXParser.prototype.parseJSXSpreadAttribute = function () { + var node = this.createJSXNode(); + this.expectJSX('{'); + this.expectJSX('...'); + this.finishJSX(); + var argument = this.parseAssignmentExpression(); + this.reenterJSX(); + return this.finalize(node, new JSXNode.JSXSpreadAttribute(argument)); + }; + JSXParser.prototype.parseJSXAttributes = function () { + var attributes = []; + while (!this.matchJSX('/') && !this.matchJSX('>')) { + var attribute = this.matchJSX('{') ? this.parseJSXSpreadAttribute() : + this.parseJSXNameValueAttribute(); + attributes.push(attribute); + } + return attributes; + }; + JSXParser.prototype.parseJSXOpeningElement = function () { + var node = this.createJSXNode(); + this.expectJSX('<'); + var name = this.parseJSXElementName(); + var attributes = this.parseJSXAttributes(); + var selfClosing = this.matchJSX('/'); + if (selfClosing) { + this.expectJSX('/'); + } + this.expectJSX('>'); + return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes)); + }; + JSXParser.prototype.parseJSXBoundaryElement = function () { + var node = this.createJSXNode(); + this.expectJSX('<'); + if (this.matchJSX('/')) { + this.expectJSX('/'); + var name_3 = this.parseJSXElementName(); + this.expectJSX('>'); + return this.finalize(node, new JSXNode.JSXClosingElement(name_3)); + } + var name = this.parseJSXElementName(); + var attributes = this.parseJSXAttributes(); + var selfClosing = this.matchJSX('/'); + if (selfClosing) { + this.expectJSX('/'); + } + this.expectJSX('>'); + return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes)); + }; + JSXParser.prototype.parseJSXEmptyExpression = function () { + var node = this.createJSXChildNode(); + this.collectComments(); + this.lastMarker.index = this.scanner.index; + this.lastMarker.line = this.scanner.lineNumber; + this.lastMarker.column = this.scanner.index - this.scanner.lineStart; + return this.finalize(node, new JSXNode.JSXEmptyExpression()); + }; + JSXParser.prototype.parseJSXExpressionContainer = function () { + var node = this.createJSXNode(); + this.expectJSX('{'); + var expression; + if (this.matchJSX('}')) { + expression = this.parseJSXEmptyExpression(); + this.expectJSX('}'); + } + else { + this.finishJSX(); + expression = this.parseAssignmentExpression(); + this.reenterJSX(); + } + return this.finalize(node, new JSXNode.JSXExpressionContainer(expression)); + }; + JSXParser.prototype.parseJSXChildren = function () { + var children = []; + while (!this.scanner.eof()) { + var node = this.createJSXChildNode(); + var token = this.nextJSXText(); + if (token.start < token.end) { + var raw = this.getTokenRaw(token); + var child = this.finalize(node, new JSXNode.JSXText(token.value, raw)); + children.push(child); + } + if (this.scanner.source[this.scanner.index] === '{') { + var container = this.parseJSXExpressionContainer(); + children.push(container); + } + else { + break; + } + } + return children; + }; + JSXParser.prototype.parseComplexJSXElement = function (el) { + var stack = []; + while (!this.scanner.eof()) { + el.children = el.children.concat(this.parseJSXChildren()); + var node = this.createJSXChildNode(); + var element = this.parseJSXBoundaryElement(); + if (element.type === jsx_syntax_1.JSXSyntax.JSXOpeningElement) { + var opening = element; + if (opening.selfClosing) { + var child = this.finalize(node, new JSXNode.JSXElement(opening, [], null)); + el.children.push(child); + } + else { + stack.push(el); + el = { node: node, opening: opening, closing: null, children: [] }; + } + } + if (element.type === jsx_syntax_1.JSXSyntax.JSXClosingElement) { + el.closing = element; + var open_1 = getQualifiedElementName(el.opening.name); + var close_1 = getQualifiedElementName(el.closing.name); + if (open_1 !== close_1) { + this.tolerateError('Expected corresponding JSX closing tag for %0', open_1); + } + if (stack.length > 0) { + var child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing)); + el = stack[stack.length - 1]; + el.children.push(child); + stack.pop(); + } + else { + break; + } + } + } + return el; + }; + JSXParser.prototype.parseJSXElement = function () { + var node = this.createJSXNode(); + var opening = this.parseJSXOpeningElement(); + var children = []; + var closing = null; + if (!opening.selfClosing) { + var el = this.parseComplexJSXElement({ node: node, opening: opening, closing: closing, children: children }); + children = el.children; + closing = el.closing; + } + return this.finalize(node, new JSXNode.JSXElement(opening, children, closing)); + }; + JSXParser.prototype.parseJSXRoot = function () { + // Pop the opening '<' added from the lookahead. + if (this.config.tokens) { + this.tokens.pop(); + } + this.startJSX(); + var element = this.parseJSXElement(); + this.finishJSX(); + return element; + }; + JSXParser.prototype.isStartOfExpression = function () { + return _super.prototype.isStartOfExpression.call(this) || this.match('<'); + }; + return JSXParser; + }(parser_1.Parser)); + exports.JSXParser = JSXParser; + + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + // See also tools/generate-unicode-regex.js. + var Regex = { + // Unicode v8.0.0 NonAsciiIdentifierStart: + NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/, + // Unicode v8.0.0 NonAsciiIdentifierPart: + NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ + }; + exports.Character = { + /* tslint:disable:no-bitwise */ + fromCodePoint: function (cp) { + return (cp < 0x10000) ? String.fromCharCode(cp) : + String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) + + String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023)); + }, + // https://tc39.github.io/ecma262/#sec-white-space + isWhiteSpace: function (cp) { + return (cp === 0x20) || (cp === 0x09) || (cp === 0x0B) || (cp === 0x0C) || (cp === 0xA0) || + (cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0); + }, + // https://tc39.github.io/ecma262/#sec-line-terminators + isLineTerminator: function (cp) { + return (cp === 0x0A) || (cp === 0x0D) || (cp === 0x2028) || (cp === 0x2029); + }, + // https://tc39.github.io/ecma262/#sec-names-and-keywords + isIdentifierStart: function (cp) { + return (cp === 0x24) || (cp === 0x5F) || + (cp >= 0x41 && cp <= 0x5A) || + (cp >= 0x61 && cp <= 0x7A) || + (cp === 0x5C) || + ((cp >= 0x80) && Regex.NonAsciiIdentifierStart.test(exports.Character.fromCodePoint(cp))); + }, + isIdentifierPart: function (cp) { + return (cp === 0x24) || (cp === 0x5F) || + (cp >= 0x41 && cp <= 0x5A) || + (cp >= 0x61 && cp <= 0x7A) || + (cp >= 0x30 && cp <= 0x39) || + (cp === 0x5C) || + ((cp >= 0x80) && Regex.NonAsciiIdentifierPart.test(exports.Character.fromCodePoint(cp))); + }, + // https://tc39.github.io/ecma262/#sec-literals-numeric-literals + isDecimalDigit: function (cp) { + return (cp >= 0x30 && cp <= 0x39); // 0..9 + }, + isHexDigit: function (cp) { + return (cp >= 0x30 && cp <= 0x39) || + (cp >= 0x41 && cp <= 0x46) || + (cp >= 0x61 && cp <= 0x66); // a..f + }, + isOctalDigit: function (cp) { + return (cp >= 0x30 && cp <= 0x37); // 0..7 + } + }; + + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var jsx_syntax_1 = __webpack_require__(6); + /* tslint:disable:max-classes-per-file */ + var JSXClosingElement = (function () { + function JSXClosingElement(name) { + this.type = jsx_syntax_1.JSXSyntax.JSXClosingElement; + this.name = name; + } + return JSXClosingElement; + }()); + exports.JSXClosingElement = JSXClosingElement; + var JSXElement = (function () { + function JSXElement(openingElement, children, closingElement) { + this.type = jsx_syntax_1.JSXSyntax.JSXElement; + this.openingElement = openingElement; + this.children = children; + this.closingElement = closingElement; + } + return JSXElement; + }()); + exports.JSXElement = JSXElement; + var JSXEmptyExpression = (function () { + function JSXEmptyExpression() { + this.type = jsx_syntax_1.JSXSyntax.JSXEmptyExpression; + } + return JSXEmptyExpression; + }()); + exports.JSXEmptyExpression = JSXEmptyExpression; + var JSXExpressionContainer = (function () { + function JSXExpressionContainer(expression) { + this.type = jsx_syntax_1.JSXSyntax.JSXExpressionContainer; + this.expression = expression; + } + return JSXExpressionContainer; + }()); + exports.JSXExpressionContainer = JSXExpressionContainer; + var JSXIdentifier = (function () { + function JSXIdentifier(name) { + this.type = jsx_syntax_1.JSXSyntax.JSXIdentifier; + this.name = name; + } + return JSXIdentifier; + }()); + exports.JSXIdentifier = JSXIdentifier; + var JSXMemberExpression = (function () { + function JSXMemberExpression(object, property) { + this.type = jsx_syntax_1.JSXSyntax.JSXMemberExpression; + this.object = object; + this.property = property; + } + return JSXMemberExpression; + }()); + exports.JSXMemberExpression = JSXMemberExpression; + var JSXAttribute = (function () { + function JSXAttribute(name, value) { + this.type = jsx_syntax_1.JSXSyntax.JSXAttribute; + this.name = name; + this.value = value; + } + return JSXAttribute; + }()); + exports.JSXAttribute = JSXAttribute; + var JSXNamespacedName = (function () { + function JSXNamespacedName(namespace, name) { + this.type = jsx_syntax_1.JSXSyntax.JSXNamespacedName; + this.namespace = namespace; + this.name = name; + } + return JSXNamespacedName; + }()); + exports.JSXNamespacedName = JSXNamespacedName; + var JSXOpeningElement = (function () { + function JSXOpeningElement(name, selfClosing, attributes) { + this.type = jsx_syntax_1.JSXSyntax.JSXOpeningElement; + this.name = name; + this.selfClosing = selfClosing; + this.attributes = attributes; + } + return JSXOpeningElement; + }()); + exports.JSXOpeningElement = JSXOpeningElement; + var JSXSpreadAttribute = (function () { + function JSXSpreadAttribute(argument) { + this.type = jsx_syntax_1.JSXSyntax.JSXSpreadAttribute; + this.argument = argument; + } + return JSXSpreadAttribute; + }()); + exports.JSXSpreadAttribute = JSXSpreadAttribute; + var JSXText = (function () { + function JSXText(value, raw) { + this.type = jsx_syntax_1.JSXSyntax.JSXText; + this.value = value; + this.raw = raw; + } + return JSXText; + }()); + exports.JSXText = JSXText; + + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.JSXSyntax = { + JSXAttribute: 'JSXAttribute', + JSXClosingElement: 'JSXClosingElement', + JSXElement: 'JSXElement', + JSXEmptyExpression: 'JSXEmptyExpression', + JSXExpressionContainer: 'JSXExpressionContainer', + JSXIdentifier: 'JSXIdentifier', + JSXMemberExpression: 'JSXMemberExpression', + JSXNamespacedName: 'JSXNamespacedName', + JSXOpeningElement: 'JSXOpeningElement', + JSXSpreadAttribute: 'JSXSpreadAttribute', + JSXText: 'JSXText' + }; + + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var syntax_1 = __webpack_require__(2); + /* tslint:disable:max-classes-per-file */ + var ArrayExpression = (function () { + function ArrayExpression(elements) { + this.type = syntax_1.Syntax.ArrayExpression; + this.elements = elements; + } + return ArrayExpression; + }()); + exports.ArrayExpression = ArrayExpression; + var ArrayPattern = (function () { + function ArrayPattern(elements) { + this.type = syntax_1.Syntax.ArrayPattern; + this.elements = elements; + } + return ArrayPattern; + }()); + exports.ArrayPattern = ArrayPattern; + var ArrowFunctionExpression = (function () { + function ArrowFunctionExpression(params, body, expression) { + this.type = syntax_1.Syntax.ArrowFunctionExpression; + this.id = null; + this.params = params; + this.body = body; + this.generator = false; + this.expression = expression; + this.async = false; + } + return ArrowFunctionExpression; + }()); + exports.ArrowFunctionExpression = ArrowFunctionExpression; + var AssignmentExpression = (function () { + function AssignmentExpression(operator, left, right) { + this.type = syntax_1.Syntax.AssignmentExpression; + this.operator = operator; + this.left = left; + this.right = right; + } + return AssignmentExpression; + }()); + exports.AssignmentExpression = AssignmentExpression; + var AssignmentPattern = (function () { + function AssignmentPattern(left, right) { + this.type = syntax_1.Syntax.AssignmentPattern; + this.left = left; + this.right = right; + } + return AssignmentPattern; + }()); + exports.AssignmentPattern = AssignmentPattern; + var AsyncArrowFunctionExpression = (function () { + function AsyncArrowFunctionExpression(params, body, expression) { + this.type = syntax_1.Syntax.ArrowFunctionExpression; + this.id = null; + this.params = params; + this.body = body; + this.generator = false; + this.expression = expression; + this.async = true; + } + return AsyncArrowFunctionExpression; + }()); + exports.AsyncArrowFunctionExpression = AsyncArrowFunctionExpression; + var AsyncFunctionDeclaration = (function () { + function AsyncFunctionDeclaration(id, params, body) { + this.type = syntax_1.Syntax.FunctionDeclaration; + this.id = id; + this.params = params; + this.body = body; + this.generator = false; + this.expression = false; + this.async = true; + } + return AsyncFunctionDeclaration; + }()); + exports.AsyncFunctionDeclaration = AsyncFunctionDeclaration; + var AsyncFunctionExpression = (function () { + function AsyncFunctionExpression(id, params, body) { + this.type = syntax_1.Syntax.FunctionExpression; + this.id = id; + this.params = params; + this.body = body; + this.generator = false; + this.expression = false; + this.async = true; + } + return AsyncFunctionExpression; + }()); + exports.AsyncFunctionExpression = AsyncFunctionExpression; + var AwaitExpression = (function () { + function AwaitExpression(argument) { + this.type = syntax_1.Syntax.AwaitExpression; + this.argument = argument; + } + return AwaitExpression; + }()); + exports.AwaitExpression = AwaitExpression; + var BinaryExpression = (function () { + function BinaryExpression(operator, left, right) { + var logical = (operator === '||' || operator === '&&'); + this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression; + this.operator = operator; + this.left = left; + this.right = right; + } + return BinaryExpression; + }()); + exports.BinaryExpression = BinaryExpression; + var BlockStatement = (function () { + function BlockStatement(body) { + this.type = syntax_1.Syntax.BlockStatement; + this.body = body; + } + return BlockStatement; + }()); + exports.BlockStatement = BlockStatement; + var BreakStatement = (function () { + function BreakStatement(label) { + this.type = syntax_1.Syntax.BreakStatement; + this.label = label; + } + return BreakStatement; + }()); + exports.BreakStatement = BreakStatement; + var CallExpression = (function () { + function CallExpression(callee, args) { + this.type = syntax_1.Syntax.CallExpression; + this.callee = callee; + this.arguments = args; + } + return CallExpression; + }()); + exports.CallExpression = CallExpression; + var CatchClause = (function () { + function CatchClause(param, body) { + this.type = syntax_1.Syntax.CatchClause; + this.param = param; + this.body = body; + } + return CatchClause; + }()); + exports.CatchClause = CatchClause; + var ClassBody = (function () { + function ClassBody(body) { + this.type = syntax_1.Syntax.ClassBody; + this.body = body; + } + return ClassBody; + }()); + exports.ClassBody = ClassBody; + var ClassDeclaration = (function () { + function ClassDeclaration(id, superClass, body) { + this.type = syntax_1.Syntax.ClassDeclaration; + this.id = id; + this.superClass = superClass; + this.body = body; + } + return ClassDeclaration; + }()); + exports.ClassDeclaration = ClassDeclaration; + var ClassExpression = (function () { + function ClassExpression(id, superClass, body) { + this.type = syntax_1.Syntax.ClassExpression; + this.id = id; + this.superClass = superClass; + this.body = body; + } + return ClassExpression; + }()); + exports.ClassExpression = ClassExpression; + var ComputedMemberExpression = (function () { + function ComputedMemberExpression(object, property) { + this.type = syntax_1.Syntax.MemberExpression; + this.computed = true; + this.object = object; + this.property = property; + } + return ComputedMemberExpression; + }()); + exports.ComputedMemberExpression = ComputedMemberExpression; + var ConditionalExpression = (function () { + function ConditionalExpression(test, consequent, alternate) { + this.type = syntax_1.Syntax.ConditionalExpression; + this.test = test; + this.consequent = consequent; + this.alternate = alternate; + } + return ConditionalExpression; + }()); + exports.ConditionalExpression = ConditionalExpression; + var ContinueStatement = (function () { + function ContinueStatement(label) { + this.type = syntax_1.Syntax.ContinueStatement; + this.label = label; + } + return ContinueStatement; + }()); + exports.ContinueStatement = ContinueStatement; + var DebuggerStatement = (function () { + function DebuggerStatement() { + this.type = syntax_1.Syntax.DebuggerStatement; + } + return DebuggerStatement; + }()); + exports.DebuggerStatement = DebuggerStatement; + var Directive = (function () { + function Directive(expression, directive) { + this.type = syntax_1.Syntax.ExpressionStatement; + this.expression = expression; + this.directive = directive; + } + return Directive; + }()); + exports.Directive = Directive; + var DoWhileStatement = (function () { + function DoWhileStatement(body, test) { + this.type = syntax_1.Syntax.DoWhileStatement; + this.body = body; + this.test = test; + } + return DoWhileStatement; + }()); + exports.DoWhileStatement = DoWhileStatement; + var EmptyStatement = (function () { + function EmptyStatement() { + this.type = syntax_1.Syntax.EmptyStatement; + } + return EmptyStatement; + }()); + exports.EmptyStatement = EmptyStatement; + var ExportAllDeclaration = (function () { + function ExportAllDeclaration(source) { + this.type = syntax_1.Syntax.ExportAllDeclaration; + this.source = source; + } + return ExportAllDeclaration; + }()); + exports.ExportAllDeclaration = ExportAllDeclaration; + var ExportDefaultDeclaration = (function () { + function ExportDefaultDeclaration(declaration) { + this.type = syntax_1.Syntax.ExportDefaultDeclaration; + this.declaration = declaration; + } + return ExportDefaultDeclaration; + }()); + exports.ExportDefaultDeclaration = ExportDefaultDeclaration; + var ExportNamedDeclaration = (function () { + function ExportNamedDeclaration(declaration, specifiers, source) { + this.type = syntax_1.Syntax.ExportNamedDeclaration; + this.declaration = declaration; + this.specifiers = specifiers; + this.source = source; + } + return ExportNamedDeclaration; + }()); + exports.ExportNamedDeclaration = ExportNamedDeclaration; + var ExportSpecifier = (function () { + function ExportSpecifier(local, exported) { + this.type = syntax_1.Syntax.ExportSpecifier; + this.exported = exported; + this.local = local; + } + return ExportSpecifier; + }()); + exports.ExportSpecifier = ExportSpecifier; + var ExpressionStatement = (function () { + function ExpressionStatement(expression) { + this.type = syntax_1.Syntax.ExpressionStatement; + this.expression = expression; + } + return ExpressionStatement; + }()); + exports.ExpressionStatement = ExpressionStatement; + var ForInStatement = (function () { + function ForInStatement(left, right, body) { + this.type = syntax_1.Syntax.ForInStatement; + this.left = left; + this.right = right; + this.body = body; + this.each = false; + } + return ForInStatement; + }()); + exports.ForInStatement = ForInStatement; + var ForOfStatement = (function () { + function ForOfStatement(left, right, body) { + this.type = syntax_1.Syntax.ForOfStatement; + this.left = left; + this.right = right; + this.body = body; + } + return ForOfStatement; + }()); + exports.ForOfStatement = ForOfStatement; + var ForStatement = (function () { + function ForStatement(init, test, update, body) { + this.type = syntax_1.Syntax.ForStatement; + this.init = init; + this.test = test; + this.update = update; + this.body = body; + } + return ForStatement; + }()); + exports.ForStatement = ForStatement; + var FunctionDeclaration = (function () { + function FunctionDeclaration(id, params, body, generator) { + this.type = syntax_1.Syntax.FunctionDeclaration; + this.id = id; + this.params = params; + this.body = body; + this.generator = generator; + this.expression = false; + this.async = false; + } + return FunctionDeclaration; + }()); + exports.FunctionDeclaration = FunctionDeclaration; + var FunctionExpression = (function () { + function FunctionExpression(id, params, body, generator) { + this.type = syntax_1.Syntax.FunctionExpression; + this.id = id; + this.params = params; + this.body = body; + this.generator = generator; + this.expression = false; + this.async = false; + } + return FunctionExpression; + }()); + exports.FunctionExpression = FunctionExpression; + var Identifier = (function () { + function Identifier(name) { + this.type = syntax_1.Syntax.Identifier; + this.name = name; + } + return Identifier; + }()); + exports.Identifier = Identifier; + var IfStatement = (function () { + function IfStatement(test, consequent, alternate) { + this.type = syntax_1.Syntax.IfStatement; + this.test = test; + this.consequent = consequent; + this.alternate = alternate; + } + return IfStatement; + }()); + exports.IfStatement = IfStatement; + var ImportDeclaration = (function () { + function ImportDeclaration(specifiers, source) { + this.type = syntax_1.Syntax.ImportDeclaration; + this.specifiers = specifiers; + this.source = source; + } + return ImportDeclaration; + }()); + exports.ImportDeclaration = ImportDeclaration; + var ImportDefaultSpecifier = (function () { + function ImportDefaultSpecifier(local) { + this.type = syntax_1.Syntax.ImportDefaultSpecifier; + this.local = local; + } + return ImportDefaultSpecifier; + }()); + exports.ImportDefaultSpecifier = ImportDefaultSpecifier; + var ImportNamespaceSpecifier = (function () { + function ImportNamespaceSpecifier(local) { + this.type = syntax_1.Syntax.ImportNamespaceSpecifier; + this.local = local; + } + return ImportNamespaceSpecifier; + }()); + exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; + var ImportSpecifier = (function () { + function ImportSpecifier(local, imported) { + this.type = syntax_1.Syntax.ImportSpecifier; + this.local = local; + this.imported = imported; + } + return ImportSpecifier; + }()); + exports.ImportSpecifier = ImportSpecifier; + var LabeledStatement = (function () { + function LabeledStatement(label, body) { + this.type = syntax_1.Syntax.LabeledStatement; + this.label = label; + this.body = body; + } + return LabeledStatement; + }()); + exports.LabeledStatement = LabeledStatement; + var Literal = (function () { + function Literal(value, raw) { + this.type = syntax_1.Syntax.Literal; + this.value = value; + this.raw = raw; + } + return Literal; + }()); + exports.Literal = Literal; + var MetaProperty = (function () { + function MetaProperty(meta, property) { + this.type = syntax_1.Syntax.MetaProperty; + this.meta = meta; + this.property = property; + } + return MetaProperty; + }()); + exports.MetaProperty = MetaProperty; + var MethodDefinition = (function () { + function MethodDefinition(key, computed, value, kind, isStatic) { + this.type = syntax_1.Syntax.MethodDefinition; + this.key = key; + this.computed = computed; + this.value = value; + this.kind = kind; + this.static = isStatic; + } + return MethodDefinition; + }()); + exports.MethodDefinition = MethodDefinition; + var Module = (function () { + function Module(body) { + this.type = syntax_1.Syntax.Program; + this.body = body; + this.sourceType = 'module'; + } + return Module; + }()); + exports.Module = Module; + var NewExpression = (function () { + function NewExpression(callee, args) { + this.type = syntax_1.Syntax.NewExpression; + this.callee = callee; + this.arguments = args; + } + return NewExpression; + }()); + exports.NewExpression = NewExpression; + var ObjectExpression = (function () { + function ObjectExpression(properties) { + this.type = syntax_1.Syntax.ObjectExpression; + this.properties = properties; + } + return ObjectExpression; + }()); + exports.ObjectExpression = ObjectExpression; + var ObjectPattern = (function () { + function ObjectPattern(properties) { + this.type = syntax_1.Syntax.ObjectPattern; + this.properties = properties; + } + return ObjectPattern; + }()); + exports.ObjectPattern = ObjectPattern; + var Property = (function () { + function Property(kind, key, computed, value, method, shorthand) { + this.type = syntax_1.Syntax.Property; + this.key = key; + this.computed = computed; + this.value = value; + this.kind = kind; + this.method = method; + this.shorthand = shorthand; + } + return Property; + }()); + exports.Property = Property; + var RegexLiteral = (function () { + function RegexLiteral(value, raw, pattern, flags) { + this.type = syntax_1.Syntax.Literal; + this.value = value; + this.raw = raw; + this.regex = { pattern: pattern, flags: flags }; + } + return RegexLiteral; + }()); + exports.RegexLiteral = RegexLiteral; + var RestElement = (function () { + function RestElement(argument) { + this.type = syntax_1.Syntax.RestElement; + this.argument = argument; + } + return RestElement; + }()); + exports.RestElement = RestElement; + var ReturnStatement = (function () { + function ReturnStatement(argument) { + this.type = syntax_1.Syntax.ReturnStatement; + this.argument = argument; + } + return ReturnStatement; + }()); + exports.ReturnStatement = ReturnStatement; + var Script = (function () { + function Script(body) { + this.type = syntax_1.Syntax.Program; + this.body = body; + this.sourceType = 'script'; + } + return Script; + }()); + exports.Script = Script; + var SequenceExpression = (function () { + function SequenceExpression(expressions) { + this.type = syntax_1.Syntax.SequenceExpression; + this.expressions = expressions; + } + return SequenceExpression; + }()); + exports.SequenceExpression = SequenceExpression; + var SpreadElement = (function () { + function SpreadElement(argument) { + this.type = syntax_1.Syntax.SpreadElement; + this.argument = argument; + } + return SpreadElement; + }()); + exports.SpreadElement = SpreadElement; + var StaticMemberExpression = (function () { + function StaticMemberExpression(object, property) { + this.type = syntax_1.Syntax.MemberExpression; + this.computed = false; + this.object = object; + this.property = property; + } + return StaticMemberExpression; + }()); + exports.StaticMemberExpression = StaticMemberExpression; + var Super = (function () { + function Super() { + this.type = syntax_1.Syntax.Super; + } + return Super; + }()); + exports.Super = Super; + var SwitchCase = (function () { + function SwitchCase(test, consequent) { + this.type = syntax_1.Syntax.SwitchCase; + this.test = test; + this.consequent = consequent; + } + return SwitchCase; + }()); + exports.SwitchCase = SwitchCase; + var SwitchStatement = (function () { + function SwitchStatement(discriminant, cases) { + this.type = syntax_1.Syntax.SwitchStatement; + this.discriminant = discriminant; + this.cases = cases; + } + return SwitchStatement; + }()); + exports.SwitchStatement = SwitchStatement; + var TaggedTemplateExpression = (function () { + function TaggedTemplateExpression(tag, quasi) { + this.type = syntax_1.Syntax.TaggedTemplateExpression; + this.tag = tag; + this.quasi = quasi; + } + return TaggedTemplateExpression; + }()); + exports.TaggedTemplateExpression = TaggedTemplateExpression; + var TemplateElement = (function () { + function TemplateElement(value, tail) { + this.type = syntax_1.Syntax.TemplateElement; + this.value = value; + this.tail = tail; + } + return TemplateElement; + }()); + exports.TemplateElement = TemplateElement; + var TemplateLiteral = (function () { + function TemplateLiteral(quasis, expressions) { + this.type = syntax_1.Syntax.TemplateLiteral; + this.quasis = quasis; + this.expressions = expressions; + } + return TemplateLiteral; + }()); + exports.TemplateLiteral = TemplateLiteral; + var ThisExpression = (function () { + function ThisExpression() { + this.type = syntax_1.Syntax.ThisExpression; + } + return ThisExpression; + }()); + exports.ThisExpression = ThisExpression; + var ThrowStatement = (function () { + function ThrowStatement(argument) { + this.type = syntax_1.Syntax.ThrowStatement; + this.argument = argument; + } + return ThrowStatement; + }()); + exports.ThrowStatement = ThrowStatement; + var TryStatement = (function () { + function TryStatement(block, handler, finalizer) { + this.type = syntax_1.Syntax.TryStatement; + this.block = block; + this.handler = handler; + this.finalizer = finalizer; + } + return TryStatement; + }()); + exports.TryStatement = TryStatement; + var UnaryExpression = (function () { + function UnaryExpression(operator, argument) { + this.type = syntax_1.Syntax.UnaryExpression; + this.operator = operator; + this.argument = argument; + this.prefix = true; + } + return UnaryExpression; + }()); + exports.UnaryExpression = UnaryExpression; + var UpdateExpression = (function () { + function UpdateExpression(operator, argument, prefix) { + this.type = syntax_1.Syntax.UpdateExpression; + this.operator = operator; + this.argument = argument; + this.prefix = prefix; + } + return UpdateExpression; + }()); + exports.UpdateExpression = UpdateExpression; + var VariableDeclaration = (function () { + function VariableDeclaration(declarations, kind) { + this.type = syntax_1.Syntax.VariableDeclaration; + this.declarations = declarations; + this.kind = kind; + } + return VariableDeclaration; + }()); + exports.VariableDeclaration = VariableDeclaration; + var VariableDeclarator = (function () { + function VariableDeclarator(id, init) { + this.type = syntax_1.Syntax.VariableDeclarator; + this.id = id; + this.init = init; + } + return VariableDeclarator; + }()); + exports.VariableDeclarator = VariableDeclarator; + var WhileStatement = (function () { + function WhileStatement(test, body) { + this.type = syntax_1.Syntax.WhileStatement; + this.test = test; + this.body = body; + } + return WhileStatement; + }()); + exports.WhileStatement = WhileStatement; + var WithStatement = (function () { + function WithStatement(object, body) { + this.type = syntax_1.Syntax.WithStatement; + this.object = object; + this.body = body; + } + return WithStatement; + }()); + exports.WithStatement = WithStatement; + var YieldExpression = (function () { + function YieldExpression(argument, delegate) { + this.type = syntax_1.Syntax.YieldExpression; + this.argument = argument; + this.delegate = delegate; + } + return YieldExpression; + }()); + exports.YieldExpression = YieldExpression; + + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var assert_1 = __webpack_require__(9); + var error_handler_1 = __webpack_require__(10); + var messages_1 = __webpack_require__(11); + var Node = __webpack_require__(7); + var scanner_1 = __webpack_require__(12); + var syntax_1 = __webpack_require__(2); + var token_1 = __webpack_require__(13); + var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder'; + var Parser = (function () { + function Parser(code, options, delegate) { + if (options === void 0) { options = {}; } + this.config = { + range: (typeof options.range === 'boolean') && options.range, + loc: (typeof options.loc === 'boolean') && options.loc, + source: null, + tokens: (typeof options.tokens === 'boolean') && options.tokens, + comment: (typeof options.comment === 'boolean') && options.comment, + tolerant: (typeof options.tolerant === 'boolean') && options.tolerant + }; + if (this.config.loc && options.source && options.source !== null) { + this.config.source = String(options.source); + } + this.delegate = delegate; + this.errorHandler = new error_handler_1.ErrorHandler(); + this.errorHandler.tolerant = this.config.tolerant; + this.scanner = new scanner_1.Scanner(code, this.errorHandler); + this.scanner.trackComment = this.config.comment; + this.operatorPrecedence = { + ')': 0, + ';': 0, + ',': 0, + '=': 0, + ']': 0, + '||': 1, + '&&': 2, + '|': 3, + '^': 4, + '&': 5, + '==': 6, + '!=': 6, + '===': 6, + '!==': 6, + '<': 7, + '>': 7, + '<=': 7, + '>=': 7, + '<<': 8, + '>>': 8, + '>>>': 8, + '+': 9, + '-': 9, + '*': 11, + '/': 11, + '%': 11 + }; + this.lookahead = { + type: 2 /* EOF */, + value: '', + lineNumber: this.scanner.lineNumber, + lineStart: 0, + start: 0, + end: 0 + }; + this.hasLineTerminator = false; + this.context = { + isModule: false, + await: false, + allowIn: true, + allowStrictDirective: true, + allowYield: true, + firstCoverInitializedNameError: null, + isAssignmentTarget: false, + isBindingElement: false, + inFunctionBody: false, + inIteration: false, + inSwitch: false, + labelSet: {}, + strict: false + }; + this.tokens = []; + this.startMarker = { + index: 0, + line: this.scanner.lineNumber, + column: 0 + }; + this.lastMarker = { + index: 0, + line: this.scanner.lineNumber, + column: 0 + }; + this.nextToken(); + this.lastMarker = { + index: this.scanner.index, + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + }; + } + Parser.prototype.throwError = function (messageFormat) { + var values = []; + for (var _i = 1; _i < arguments.length; _i++) { + values[_i - 1] = arguments[_i]; + } + var args = Array.prototype.slice.call(arguments, 1); + var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { + assert_1.assert(idx < args.length, 'Message reference must be in range'); + return args[idx]; + }); + var index = this.lastMarker.index; + var line = this.lastMarker.line; + var column = this.lastMarker.column + 1; + throw this.errorHandler.createError(index, line, column, msg); + }; + Parser.prototype.tolerateError = function (messageFormat) { + var values = []; + for (var _i = 1; _i < arguments.length; _i++) { + values[_i - 1] = arguments[_i]; + } + var args = Array.prototype.slice.call(arguments, 1); + var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { + assert_1.assert(idx < args.length, 'Message reference must be in range'); + return args[idx]; + }); + var index = this.lastMarker.index; + var line = this.scanner.lineNumber; + var column = this.lastMarker.column + 1; + this.errorHandler.tolerateError(index, line, column, msg); + }; + // Throw an exception because of the token. + Parser.prototype.unexpectedTokenError = function (token, message) { + var msg = message || messages_1.Messages.UnexpectedToken; + var value; + if (token) { + if (!message) { + msg = (token.type === 2 /* EOF */) ? messages_1.Messages.UnexpectedEOS : + (token.type === 3 /* Identifier */) ? messages_1.Messages.UnexpectedIdentifier : + (token.type === 6 /* NumericLiteral */) ? messages_1.Messages.UnexpectedNumber : + (token.type === 8 /* StringLiteral */) ? messages_1.Messages.UnexpectedString : + (token.type === 10 /* Template */) ? messages_1.Messages.UnexpectedTemplate : + messages_1.Messages.UnexpectedToken; + if (token.type === 4 /* Keyword */) { + if (this.scanner.isFutureReservedWord(token.value)) { + msg = messages_1.Messages.UnexpectedReserved; + } + else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) { + msg = messages_1.Messages.StrictReservedWord; + } + } + } + value = token.value; + } + else { + value = 'ILLEGAL'; + } + msg = msg.replace('%0', value); + if (token && typeof token.lineNumber === 'number') { + var index = token.start; + var line = token.lineNumber; + var lastMarkerLineStart = this.lastMarker.index - this.lastMarker.column; + var column = token.start - lastMarkerLineStart + 1; + return this.errorHandler.createError(index, line, column, msg); + } + else { + var index = this.lastMarker.index; + var line = this.lastMarker.line; + var column = this.lastMarker.column + 1; + return this.errorHandler.createError(index, line, column, msg); + } + }; + Parser.prototype.throwUnexpectedToken = function (token, message) { + throw this.unexpectedTokenError(token, message); + }; + Parser.prototype.tolerateUnexpectedToken = function (token, message) { + this.errorHandler.tolerate(this.unexpectedTokenError(token, message)); + }; + Parser.prototype.collectComments = function () { + if (!this.config.comment) { + this.scanner.scanComments(); + } + else { + var comments = this.scanner.scanComments(); + if (comments.length > 0 && this.delegate) { + for (var i = 0; i < comments.length; ++i) { + var e = comments[i]; + var node = void 0; + node = { + type: e.multiLine ? 'BlockComment' : 'LineComment', + value: this.scanner.source.slice(e.slice[0], e.slice[1]) + }; + if (this.config.range) { + node.range = e.range; + } + if (this.config.loc) { + node.loc = e.loc; + } + var metadata = { + start: { + line: e.loc.start.line, + column: e.loc.start.column, + offset: e.range[0] + }, + end: { + line: e.loc.end.line, + column: e.loc.end.column, + offset: e.range[1] + } + }; + this.delegate(node, metadata); + } + } + } + }; + // From internal representation to an external structure + Parser.prototype.getTokenRaw = function (token) { + return this.scanner.source.slice(token.start, token.end); + }; + Parser.prototype.convertToken = function (token) { + var t = { + type: token_1.TokenName[token.type], + value: this.getTokenRaw(token) + }; + if (this.config.range) { + t.range = [token.start, token.end]; + } + if (this.config.loc) { + t.loc = { + start: { + line: this.startMarker.line, + column: this.startMarker.column + }, + end: { + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + } + }; + } + if (token.type === 9 /* RegularExpression */) { + var pattern = token.pattern; + var flags = token.flags; + t.regex = { pattern: pattern, flags: flags }; + } + return t; + }; + Parser.prototype.nextToken = function () { + var token = this.lookahead; + this.lastMarker.index = this.scanner.index; + this.lastMarker.line = this.scanner.lineNumber; + this.lastMarker.column = this.scanner.index - this.scanner.lineStart; + this.collectComments(); + if (this.scanner.index !== this.startMarker.index) { + this.startMarker.index = this.scanner.index; + this.startMarker.line = this.scanner.lineNumber; + this.startMarker.column = this.scanner.index - this.scanner.lineStart; + } + var next = this.scanner.lex(); + this.hasLineTerminator = (token.lineNumber !== next.lineNumber); + if (next && this.context.strict && next.type === 3 /* Identifier */) { + if (this.scanner.isStrictModeReservedWord(next.value)) { + next.type = 4 /* Keyword */; + } + } + this.lookahead = next; + if (this.config.tokens && next.type !== 2 /* EOF */) { + this.tokens.push(this.convertToken(next)); + } + return token; + }; + Parser.prototype.nextRegexToken = function () { + this.collectComments(); + var token = this.scanner.scanRegExp(); + if (this.config.tokens) { + // Pop the previous token, '/' or '/=' + // This is added from the lookahead token. + this.tokens.pop(); + this.tokens.push(this.convertToken(token)); + } + // Prime the next lookahead. + this.lookahead = token; + this.nextToken(); + return token; + }; + Parser.prototype.createNode = function () { + return { + index: this.startMarker.index, + line: this.startMarker.line, + column: this.startMarker.column + }; + }; + Parser.prototype.startNode = function (token, lastLineStart) { + if (lastLineStart === void 0) { lastLineStart = 0; } + var column = token.start - token.lineStart; + var line = token.lineNumber; + if (column < 0) { + column += lastLineStart; + line--; + } + return { + index: token.start, + line: line, + column: column + }; + }; + Parser.prototype.finalize = function (marker, node) { + if (this.config.range) { + node.range = [marker.index, this.lastMarker.index]; + } + if (this.config.loc) { + node.loc = { + start: { + line: marker.line, + column: marker.column, + }, + end: { + line: this.lastMarker.line, + column: this.lastMarker.column + } + }; + if (this.config.source) { + node.loc.source = this.config.source; + } + } + if (this.delegate) { + var metadata = { + start: { + line: marker.line, + column: marker.column, + offset: marker.index + }, + end: { + line: this.lastMarker.line, + column: this.lastMarker.column, + offset: this.lastMarker.index + } + }; + this.delegate(node, metadata); + } + return node; + }; + // Expect the next token to match the specified punctuator. + // If not, an exception will be thrown. + Parser.prototype.expect = function (value) { + var token = this.nextToken(); + if (token.type !== 7 /* Punctuator */ || token.value !== value) { + this.throwUnexpectedToken(token); + } + }; + // Quietly expect a comma when in tolerant mode, otherwise delegates to expect(). + Parser.prototype.expectCommaSeparator = function () { + if (this.config.tolerant) { + var token = this.lookahead; + if (token.type === 7 /* Punctuator */ && token.value === ',') { + this.nextToken(); + } + else if (token.type === 7 /* Punctuator */ && token.value === ';') { + this.nextToken(); + this.tolerateUnexpectedToken(token); + } + else { + this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken); + } + } + else { + this.expect(','); + } + }; + // Expect the next token to match the specified keyword. + // If not, an exception will be thrown. + Parser.prototype.expectKeyword = function (keyword) { + var token = this.nextToken(); + if (token.type !== 4 /* Keyword */ || token.value !== keyword) { + this.throwUnexpectedToken(token); + } + }; + // Return true if the next token matches the specified punctuator. + Parser.prototype.match = function (value) { + return this.lookahead.type === 7 /* Punctuator */ && this.lookahead.value === value; + }; + // Return true if the next token matches the specified keyword + Parser.prototype.matchKeyword = function (keyword) { + return this.lookahead.type === 4 /* Keyword */ && this.lookahead.value === keyword; + }; + // Return true if the next token matches the specified contextual keyword + // (where an identifier is sometimes a keyword depending on the context) + Parser.prototype.matchContextualKeyword = function (keyword) { + return this.lookahead.type === 3 /* Identifier */ && this.lookahead.value === keyword; + }; + // Return true if the next token is an assignment operator + Parser.prototype.matchAssign = function () { + if (this.lookahead.type !== 7 /* Punctuator */) { + return false; + } + var op = this.lookahead.value; + return op === '=' || + op === '*=' || + op === '**=' || + op === '/=' || + op === '%=' || + op === '+=' || + op === '-=' || + op === '<<=' || + op === '>>=' || + op === '>>>=' || + op === '&=' || + op === '^=' || + op === '|='; + }; + // Cover grammar support. + // + // When an assignment expression position starts with an left parenthesis, the determination of the type + // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead) + // or the first comma. This situation also defers the determination of all the expressions nested in the pair. + // + // There are three productions that can be parsed in a parentheses pair that needs to be determined + // after the outermost pair is closed. They are: + // + // 1. AssignmentExpression + // 2. BindingElements + // 3. AssignmentTargets + // + // In order to avoid exponential backtracking, we use two flags to denote if the production can be + // binding element or assignment target. + // + // The three productions have the relationship: + // + // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression + // + // with a single exception that CoverInitializedName when used directly in an Expression, generates + // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the + // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair. + // + // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not + // effect the current flags. This means the production the parser parses is only used as an expression. Therefore + // the CoverInitializedName check is conducted. + // + // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates + // the flags outside of the parser. This means the production the parser parses is used as a part of a potential + // pattern. The CoverInitializedName check is deferred. + Parser.prototype.isolateCoverGrammar = function (parseFunction) { + var previousIsBindingElement = this.context.isBindingElement; + var previousIsAssignmentTarget = this.context.isAssignmentTarget; + var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; + this.context.isBindingElement = true; + this.context.isAssignmentTarget = true; + this.context.firstCoverInitializedNameError = null; + var result = parseFunction.call(this); + if (this.context.firstCoverInitializedNameError !== null) { + this.throwUnexpectedToken(this.context.firstCoverInitializedNameError); + } + this.context.isBindingElement = previousIsBindingElement; + this.context.isAssignmentTarget = previousIsAssignmentTarget; + this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError; + return result; + }; + Parser.prototype.inheritCoverGrammar = function (parseFunction) { + var previousIsBindingElement = this.context.isBindingElement; + var previousIsAssignmentTarget = this.context.isAssignmentTarget; + var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; + this.context.isBindingElement = true; + this.context.isAssignmentTarget = true; + this.context.firstCoverInitializedNameError = null; + var result = parseFunction.call(this); + this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement; + this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget; + this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError; + return result; + }; + Parser.prototype.consumeSemicolon = function () { + if (this.match(';')) { + this.nextToken(); + } + else if (!this.hasLineTerminator) { + if (this.lookahead.type !== 2 /* EOF */ && !this.match('}')) { + this.throwUnexpectedToken(this.lookahead); + } + this.lastMarker.index = this.startMarker.index; + this.lastMarker.line = this.startMarker.line; + this.lastMarker.column = this.startMarker.column; + } + }; + // https://tc39.github.io/ecma262/#sec-primary-expression + Parser.prototype.parsePrimaryExpression = function () { + var node = this.createNode(); + var expr; + var token, raw; + switch (this.lookahead.type) { + case 3 /* Identifier */: + if ((this.context.isModule || this.context.await) && this.lookahead.value === 'await') { + this.tolerateUnexpectedToken(this.lookahead); + } + expr = this.matchAsyncFunction() ? this.parseFunctionExpression() : this.finalize(node, new Node.Identifier(this.nextToken().value)); + break; + case 6 /* NumericLiteral */: + case 8 /* StringLiteral */: + if (this.context.strict && this.lookahead.octal) { + this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral); + } + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + token = this.nextToken(); + raw = this.getTokenRaw(token); + expr = this.finalize(node, new Node.Literal(token.value, raw)); + break; + case 1 /* BooleanLiteral */: + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + token = this.nextToken(); + raw = this.getTokenRaw(token); + expr = this.finalize(node, new Node.Literal(token.value === 'true', raw)); + break; + case 5 /* NullLiteral */: + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + token = this.nextToken(); + raw = this.getTokenRaw(token); + expr = this.finalize(node, new Node.Literal(null, raw)); + break; + case 10 /* Template */: + expr = this.parseTemplateLiteral(); + break; + case 7 /* Punctuator */: + switch (this.lookahead.value) { + case '(': + this.context.isBindingElement = false; + expr = this.inheritCoverGrammar(this.parseGroupExpression); + break; + case '[': + expr = this.inheritCoverGrammar(this.parseArrayInitializer); + break; + case '{': + expr = this.inheritCoverGrammar(this.parseObjectInitializer); + break; + case '/': + case '/=': + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + this.scanner.index = this.startMarker.index; + token = this.nextRegexToken(); + raw = this.getTokenRaw(token); + expr = this.finalize(node, new Node.RegexLiteral(token.regex, raw, token.pattern, token.flags)); + break; + default: + expr = this.throwUnexpectedToken(this.nextToken()); + } + break; + case 4 /* Keyword */: + if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) { + expr = this.parseIdentifierName(); + } + else if (!this.context.strict && this.matchKeyword('let')) { + expr = this.finalize(node, new Node.Identifier(this.nextToken().value)); + } + else { + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + if (this.matchKeyword('function')) { + expr = this.parseFunctionExpression(); + } + else if (this.matchKeyword('this')) { + this.nextToken(); + expr = this.finalize(node, new Node.ThisExpression()); + } + else if (this.matchKeyword('class')) { + expr = this.parseClassExpression(); + } + else { + expr = this.throwUnexpectedToken(this.nextToken()); + } + } + break; + default: + expr = this.throwUnexpectedToken(this.nextToken()); + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-array-initializer + Parser.prototype.parseSpreadElement = function () { + var node = this.createNode(); + this.expect('...'); + var arg = this.inheritCoverGrammar(this.parseAssignmentExpression); + return this.finalize(node, new Node.SpreadElement(arg)); + }; + Parser.prototype.parseArrayInitializer = function () { + var node = this.createNode(); + var elements = []; + this.expect('['); + while (!this.match(']')) { + if (this.match(',')) { + this.nextToken(); + elements.push(null); + } + else if (this.match('...')) { + var element = this.parseSpreadElement(); + if (!this.match(']')) { + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + this.expect(','); + } + elements.push(element); + } + else { + elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); + if (!this.match(']')) { + this.expect(','); + } + } + } + this.expect(']'); + return this.finalize(node, new Node.ArrayExpression(elements)); + }; + // https://tc39.github.io/ecma262/#sec-object-initializer + Parser.prototype.parsePropertyMethod = function (params) { + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var previousStrict = this.context.strict; + var previousAllowStrictDirective = this.context.allowStrictDirective; + this.context.allowStrictDirective = params.simple; + var body = this.isolateCoverGrammar(this.parseFunctionSourceElements); + if (this.context.strict && params.firstRestricted) { + this.tolerateUnexpectedToken(params.firstRestricted, params.message); + } + if (this.context.strict && params.stricted) { + this.tolerateUnexpectedToken(params.stricted, params.message); + } + this.context.strict = previousStrict; + this.context.allowStrictDirective = previousAllowStrictDirective; + return body; + }; + Parser.prototype.parsePropertyMethodFunction = function () { + var isGenerator = false; + var node = this.createNode(); + var previousAllowYield = this.context.allowYield; + this.context.allowYield = true; + var params = this.parseFormalParameters(); + var method = this.parsePropertyMethod(params); + this.context.allowYield = previousAllowYield; + return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); + }; + Parser.prototype.parsePropertyMethodAsyncFunction = function () { + var node = this.createNode(); + var previousAllowYield = this.context.allowYield; + var previousAwait = this.context.await; + this.context.allowYield = false; + this.context.await = true; + var params = this.parseFormalParameters(); + var method = this.parsePropertyMethod(params); + this.context.allowYield = previousAllowYield; + this.context.await = previousAwait; + return this.finalize(node, new Node.AsyncFunctionExpression(null, params.params, method)); + }; + Parser.prototype.parseObjectPropertyKey = function () { + var node = this.createNode(); + var token = this.nextToken(); + var key; + switch (token.type) { + case 8 /* StringLiteral */: + case 6 /* NumericLiteral */: + if (this.context.strict && token.octal) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral); + } + var raw = this.getTokenRaw(token); + key = this.finalize(node, new Node.Literal(token.value, raw)); + break; + case 3 /* Identifier */: + case 1 /* BooleanLiteral */: + case 5 /* NullLiteral */: + case 4 /* Keyword */: + key = this.finalize(node, new Node.Identifier(token.value)); + break; + case 7 /* Punctuator */: + if (token.value === '[') { + key = this.isolateCoverGrammar(this.parseAssignmentExpression); + this.expect(']'); + } + else { + key = this.throwUnexpectedToken(token); + } + break; + default: + key = this.throwUnexpectedToken(token); + } + return key; + }; + Parser.prototype.isPropertyKey = function (key, value) { + return (key.type === syntax_1.Syntax.Identifier && key.name === value) || + (key.type === syntax_1.Syntax.Literal && key.value === value); + }; + Parser.prototype.parseObjectProperty = function (hasProto) { + var node = this.createNode(); + var token = this.lookahead; + var kind; + var key = null; + var value = null; + var computed = false; + var method = false; + var shorthand = false; + var isAsync = false; + if (token.type === 3 /* Identifier */) { + var id = token.value; + this.nextToken(); + computed = this.match('['); + isAsync = !this.hasLineTerminator && (id === 'async') && + !this.match(':') && !this.match('(') && !this.match('*') && !this.match(','); + key = isAsync ? this.parseObjectPropertyKey() : this.finalize(node, new Node.Identifier(id)); + } + else if (this.match('*')) { + this.nextToken(); + } + else { + computed = this.match('['); + key = this.parseObjectPropertyKey(); + } + var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); + if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'get' && lookaheadPropertyKey) { + kind = 'get'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + this.context.allowYield = false; + value = this.parseGetterMethod(); + } + else if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'set' && lookaheadPropertyKey) { + kind = 'set'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + value = this.parseSetterMethod(); + } + else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) { + kind = 'init'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + value = this.parseGeneratorMethod(); + method = true; + } + else { + if (!key) { + this.throwUnexpectedToken(this.lookahead); + } + kind = 'init'; + if (this.match(':') && !isAsync) { + if (!computed && this.isPropertyKey(key, '__proto__')) { + if (hasProto.value) { + this.tolerateError(messages_1.Messages.DuplicateProtoProperty); + } + hasProto.value = true; + } + this.nextToken(); + value = this.inheritCoverGrammar(this.parseAssignmentExpression); + } + else if (this.match('(')) { + value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction(); + method = true; + } + else if (token.type === 3 /* Identifier */) { + var id = this.finalize(node, new Node.Identifier(token.value)); + if (this.match('=')) { + this.context.firstCoverInitializedNameError = this.lookahead; + this.nextToken(); + shorthand = true; + var init = this.isolateCoverGrammar(this.parseAssignmentExpression); + value = this.finalize(node, new Node.AssignmentPattern(id, init)); + } + else { + shorthand = true; + value = id; + } + } + else { + this.throwUnexpectedToken(this.nextToken()); + } + } + return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand)); + }; + Parser.prototype.parseObjectInitializer = function () { + var node = this.createNode(); + this.expect('{'); + var properties = []; + var hasProto = { value: false }; + while (!this.match('}')) { + properties.push(this.parseObjectProperty(hasProto)); + if (!this.match('}')) { + this.expectCommaSeparator(); + } + } + this.expect('}'); + return this.finalize(node, new Node.ObjectExpression(properties)); + }; + // https://tc39.github.io/ecma262/#sec-template-literals + Parser.prototype.parseTemplateHead = function () { + assert_1.assert(this.lookahead.head, 'Template literal must start with a template head'); + var node = this.createNode(); + var token = this.nextToken(); + var raw = token.value; + var cooked = token.cooked; + return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail)); + }; + Parser.prototype.parseTemplateElement = function () { + if (this.lookahead.type !== 10 /* Template */) { + this.throwUnexpectedToken(); + } + var node = this.createNode(); + var token = this.nextToken(); + var raw = token.value; + var cooked = token.cooked; + return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail)); + }; + Parser.prototype.parseTemplateLiteral = function () { + var node = this.createNode(); + var expressions = []; + var quasis = []; + var quasi = this.parseTemplateHead(); + quasis.push(quasi); + while (!quasi.tail) { + expressions.push(this.parseExpression()); + quasi = this.parseTemplateElement(); + quasis.push(quasi); + } + return this.finalize(node, new Node.TemplateLiteral(quasis, expressions)); + }; + // https://tc39.github.io/ecma262/#sec-grouping-operator + Parser.prototype.reinterpretExpressionAsPattern = function (expr) { + switch (expr.type) { + case syntax_1.Syntax.Identifier: + case syntax_1.Syntax.MemberExpression: + case syntax_1.Syntax.RestElement: + case syntax_1.Syntax.AssignmentPattern: + break; + case syntax_1.Syntax.SpreadElement: + expr.type = syntax_1.Syntax.RestElement; + this.reinterpretExpressionAsPattern(expr.argument); + break; + case syntax_1.Syntax.ArrayExpression: + expr.type = syntax_1.Syntax.ArrayPattern; + for (var i = 0; i < expr.elements.length; i++) { + if (expr.elements[i] !== null) { + this.reinterpretExpressionAsPattern(expr.elements[i]); + } + } + break; + case syntax_1.Syntax.ObjectExpression: + expr.type = syntax_1.Syntax.ObjectPattern; + for (var i = 0; i < expr.properties.length; i++) { + this.reinterpretExpressionAsPattern(expr.properties[i].value); + } + break; + case syntax_1.Syntax.AssignmentExpression: + expr.type = syntax_1.Syntax.AssignmentPattern; + delete expr.operator; + this.reinterpretExpressionAsPattern(expr.left); + break; + default: + // Allow other node type for tolerant parsing. + break; + } + }; + Parser.prototype.parseGroupExpression = function () { + var expr; + this.expect('('); + if (this.match(')')) { + this.nextToken(); + if (!this.match('=>')) { + this.expect('=>'); + } + expr = { + type: ArrowParameterPlaceHolder, + params: [], + async: false + }; + } + else { + var startToken = this.lookahead; + var params = []; + if (this.match('...')) { + expr = this.parseRestElement(params); + this.expect(')'); + if (!this.match('=>')) { + this.expect('=>'); + } + expr = { + type: ArrowParameterPlaceHolder, + params: [expr], + async: false + }; + } + else { + var arrow = false; + this.context.isBindingElement = true; + expr = this.inheritCoverGrammar(this.parseAssignmentExpression); + if (this.match(',')) { + var expressions = []; + this.context.isAssignmentTarget = false; + expressions.push(expr); + while (this.lookahead.type !== 2 /* EOF */) { + if (!this.match(',')) { + break; + } + this.nextToken(); + if (this.match(')')) { + this.nextToken(); + for (var i = 0; i < expressions.length; i++) { + this.reinterpretExpressionAsPattern(expressions[i]); + } + arrow = true; + expr = { + type: ArrowParameterPlaceHolder, + params: expressions, + async: false + }; + } + else if (this.match('...')) { + if (!this.context.isBindingElement) { + this.throwUnexpectedToken(this.lookahead); + } + expressions.push(this.parseRestElement(params)); + this.expect(')'); + if (!this.match('=>')) { + this.expect('=>'); + } + this.context.isBindingElement = false; + for (var i = 0; i < expressions.length; i++) { + this.reinterpretExpressionAsPattern(expressions[i]); + } + arrow = true; + expr = { + type: ArrowParameterPlaceHolder, + params: expressions, + async: false + }; + } + else { + expressions.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); + } + if (arrow) { + break; + } + } + if (!arrow) { + expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); + } + } + if (!arrow) { + this.expect(')'); + if (this.match('=>')) { + if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') { + arrow = true; + expr = { + type: ArrowParameterPlaceHolder, + params: [expr], + async: false + }; + } + if (!arrow) { + if (!this.context.isBindingElement) { + this.throwUnexpectedToken(this.lookahead); + } + if (expr.type === syntax_1.Syntax.SequenceExpression) { + for (var i = 0; i < expr.expressions.length; i++) { + this.reinterpretExpressionAsPattern(expr.expressions[i]); + } + } + else { + this.reinterpretExpressionAsPattern(expr); + } + var parameters = (expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]); + expr = { + type: ArrowParameterPlaceHolder, + params: parameters, + async: false + }; + } + } + this.context.isBindingElement = false; + } + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-left-hand-side-expressions + Parser.prototype.parseArguments = function () { + this.expect('('); + var args = []; + if (!this.match(')')) { + while (true) { + var expr = this.match('...') ? this.parseSpreadElement() : + this.isolateCoverGrammar(this.parseAssignmentExpression); + args.push(expr); + if (this.match(')')) { + break; + } + this.expectCommaSeparator(); + if (this.match(')')) { + break; + } + } + } + this.expect(')'); + return args; + }; + Parser.prototype.isIdentifierName = function (token) { + return token.type === 3 /* Identifier */ || + token.type === 4 /* Keyword */ || + token.type === 1 /* BooleanLiteral */ || + token.type === 5 /* NullLiteral */; + }; + Parser.prototype.parseIdentifierName = function () { + var node = this.createNode(); + var token = this.nextToken(); + if (!this.isIdentifierName(token)) { + this.throwUnexpectedToken(token); + } + return this.finalize(node, new Node.Identifier(token.value)); + }; + Parser.prototype.parseNewExpression = function () { + var node = this.createNode(); + var id = this.parseIdentifierName(); + assert_1.assert(id.name === 'new', 'New expression must start with `new`'); + var expr; + if (this.match('.')) { + this.nextToken(); + if (this.lookahead.type === 3 /* Identifier */ && this.context.inFunctionBody && this.lookahead.value === 'target') { + var property = this.parseIdentifierName(); + expr = new Node.MetaProperty(id, property); + } + else { + this.throwUnexpectedToken(this.lookahead); + } + } + else { + var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression); + var args = this.match('(') ? this.parseArguments() : []; + expr = new Node.NewExpression(callee, args); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + return this.finalize(node, expr); + }; + Parser.prototype.parseAsyncArgument = function () { + var arg = this.parseAssignmentExpression(); + this.context.firstCoverInitializedNameError = null; + return arg; + }; + Parser.prototype.parseAsyncArguments = function () { + this.expect('('); + var args = []; + if (!this.match(')')) { + while (true) { + var expr = this.match('...') ? this.parseSpreadElement() : + this.isolateCoverGrammar(this.parseAsyncArgument); + args.push(expr); + if (this.match(')')) { + break; + } + this.expectCommaSeparator(); + if (this.match(')')) { + break; + } + } + } + this.expect(')'); + return args; + }; + Parser.prototype.parseLeftHandSideExpressionAllowCall = function () { + var startToken = this.lookahead; + var maybeAsync = this.matchContextualKeyword('async'); + var previousAllowIn = this.context.allowIn; + this.context.allowIn = true; + var expr; + if (this.matchKeyword('super') && this.context.inFunctionBody) { + expr = this.createNode(); + this.nextToken(); + expr = this.finalize(expr, new Node.Super()); + if (!this.match('(') && !this.match('.') && !this.match('[')) { + this.throwUnexpectedToken(this.lookahead); + } + } + else { + expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); + } + while (true) { + if (this.match('.')) { + this.context.isBindingElement = false; + this.context.isAssignmentTarget = true; + this.expect('.'); + var property = this.parseIdentifierName(); + expr = this.finalize(this.startNode(startToken), new Node.StaticMemberExpression(expr, property)); + } + else if (this.match('(')) { + var asyncArrow = maybeAsync && (startToken.lineNumber === this.lookahead.lineNumber); + this.context.isBindingElement = false; + this.context.isAssignmentTarget = false; + var args = asyncArrow ? this.parseAsyncArguments() : this.parseArguments(); + expr = this.finalize(this.startNode(startToken), new Node.CallExpression(expr, args)); + if (asyncArrow && this.match('=>')) { + for (var i = 0; i < args.length; ++i) { + this.reinterpretExpressionAsPattern(args[i]); + } + expr = { + type: ArrowParameterPlaceHolder, + params: args, + async: true + }; + } + } + else if (this.match('[')) { + this.context.isBindingElement = false; + this.context.isAssignmentTarget = true; + this.expect('['); + var property = this.isolateCoverGrammar(this.parseExpression); + this.expect(']'); + expr = this.finalize(this.startNode(startToken), new Node.ComputedMemberExpression(expr, property)); + } + else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) { + var quasi = this.parseTemplateLiteral(); + expr = this.finalize(this.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi)); + } + else { + break; + } + } + this.context.allowIn = previousAllowIn; + return expr; + }; + Parser.prototype.parseSuper = function () { + var node = this.createNode(); + this.expectKeyword('super'); + if (!this.match('[') && !this.match('.')) { + this.throwUnexpectedToken(this.lookahead); + } + return this.finalize(node, new Node.Super()); + }; + Parser.prototype.parseLeftHandSideExpression = function () { + assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.'); + var node = this.startNode(this.lookahead); + var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() : + this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); + while (true) { + if (this.match('[')) { + this.context.isBindingElement = false; + this.context.isAssignmentTarget = true; + this.expect('['); + var property = this.isolateCoverGrammar(this.parseExpression); + this.expect(']'); + expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property)); + } + else if (this.match('.')) { + this.context.isBindingElement = false; + this.context.isAssignmentTarget = true; + this.expect('.'); + var property = this.parseIdentifierName(); + expr = this.finalize(node, new Node.StaticMemberExpression(expr, property)); + } + else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) { + var quasi = this.parseTemplateLiteral(); + expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi)); + } + else { + break; + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-update-expressions + Parser.prototype.parseUpdateExpression = function () { + var expr; + var startToken = this.lookahead; + if (this.match('++') || this.match('--')) { + var node = this.startNode(startToken); + var token = this.nextToken(); + expr = this.inheritCoverGrammar(this.parseUnaryExpression); + if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { + this.tolerateError(messages_1.Messages.StrictLHSPrefix); + } + if (!this.context.isAssignmentTarget) { + this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); + } + var prefix = true; + expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix)); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + else { + expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall); + if (!this.hasLineTerminator && this.lookahead.type === 7 /* Punctuator */) { + if (this.match('++') || this.match('--')) { + if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { + this.tolerateError(messages_1.Messages.StrictLHSPostfix); + } + if (!this.context.isAssignmentTarget) { + this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); + } + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var operator = this.nextToken().value; + var prefix = false; + expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix)); + } + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-unary-operators + Parser.prototype.parseAwaitExpression = function () { + var node = this.createNode(); + this.nextToken(); + var argument = this.parseUnaryExpression(); + return this.finalize(node, new Node.AwaitExpression(argument)); + }; + Parser.prototype.parseUnaryExpression = function () { + var expr; + if (this.match('+') || this.match('-') || this.match('~') || this.match('!') || + this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) { + var node = this.startNode(this.lookahead); + var token = this.nextToken(); + expr = this.inheritCoverGrammar(this.parseUnaryExpression); + expr = this.finalize(node, new Node.UnaryExpression(token.value, expr)); + if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) { + this.tolerateError(messages_1.Messages.StrictDelete); + } + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + else if (this.context.await && this.matchContextualKeyword('await')) { + expr = this.parseAwaitExpression(); + } + else { + expr = this.parseUpdateExpression(); + } + return expr; + }; + Parser.prototype.parseExponentiationExpression = function () { + var startToken = this.lookahead; + var expr = this.inheritCoverGrammar(this.parseUnaryExpression); + if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) { + this.nextToken(); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var left = expr; + var right = this.isolateCoverGrammar(this.parseExponentiationExpression); + expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right)); + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-exp-operator + // https://tc39.github.io/ecma262/#sec-multiplicative-operators + // https://tc39.github.io/ecma262/#sec-additive-operators + // https://tc39.github.io/ecma262/#sec-bitwise-shift-operators + // https://tc39.github.io/ecma262/#sec-relational-operators + // https://tc39.github.io/ecma262/#sec-equality-operators + // https://tc39.github.io/ecma262/#sec-binary-bitwise-operators + // https://tc39.github.io/ecma262/#sec-binary-logical-operators + Parser.prototype.binaryPrecedence = function (token) { + var op = token.value; + var precedence; + if (token.type === 7 /* Punctuator */) { + precedence = this.operatorPrecedence[op] || 0; + } + else if (token.type === 4 /* Keyword */) { + precedence = (op === 'instanceof' || (this.context.allowIn && op === 'in')) ? 7 : 0; + } + else { + precedence = 0; + } + return precedence; + }; + Parser.prototype.parseBinaryExpression = function () { + var startToken = this.lookahead; + var expr = this.inheritCoverGrammar(this.parseExponentiationExpression); + var token = this.lookahead; + var prec = this.binaryPrecedence(token); + if (prec > 0) { + this.nextToken(); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var markers = [startToken, this.lookahead]; + var left = expr; + var right = this.isolateCoverGrammar(this.parseExponentiationExpression); + var stack = [left, token.value, right]; + var precedences = [prec]; + while (true) { + prec = this.binaryPrecedence(this.lookahead); + if (prec <= 0) { + break; + } + // Reduce: make a binary expression from the three topmost entries. + while ((stack.length > 2) && (prec <= precedences[precedences.length - 1])) { + right = stack.pop(); + var operator = stack.pop(); + precedences.pop(); + left = stack.pop(); + markers.pop(); + var node = this.startNode(markers[markers.length - 1]); + stack.push(this.finalize(node, new Node.BinaryExpression(operator, left, right))); + } + // Shift. + stack.push(this.nextToken().value); + precedences.push(prec); + markers.push(this.lookahead); + stack.push(this.isolateCoverGrammar(this.parseExponentiationExpression)); + } + // Final reduce to clean-up the stack. + var i = stack.length - 1; + expr = stack[i]; + var lastMarker = markers.pop(); + while (i > 1) { + var marker = markers.pop(); + var lastLineStart = lastMarker && lastMarker.lineStart; + var node = this.startNode(marker, lastLineStart); + var operator = stack[i - 1]; + expr = this.finalize(node, new Node.BinaryExpression(operator, stack[i - 2], expr)); + i -= 2; + lastMarker = marker; + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-conditional-operator + Parser.prototype.parseConditionalExpression = function () { + var startToken = this.lookahead; + var expr = this.inheritCoverGrammar(this.parseBinaryExpression); + if (this.match('?')) { + this.nextToken(); + var previousAllowIn = this.context.allowIn; + this.context.allowIn = true; + var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression); + this.context.allowIn = previousAllowIn; + this.expect(':'); + var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression); + expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate)); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-assignment-operators + Parser.prototype.checkPatternParam = function (options, param) { + switch (param.type) { + case syntax_1.Syntax.Identifier: + this.validateParam(options, param, param.name); + break; + case syntax_1.Syntax.RestElement: + this.checkPatternParam(options, param.argument); + break; + case syntax_1.Syntax.AssignmentPattern: + this.checkPatternParam(options, param.left); + break; + case syntax_1.Syntax.ArrayPattern: + for (var i = 0; i < param.elements.length; i++) { + if (param.elements[i] !== null) { + this.checkPatternParam(options, param.elements[i]); + } + } + break; + case syntax_1.Syntax.ObjectPattern: + for (var i = 0; i < param.properties.length; i++) { + this.checkPatternParam(options, param.properties[i].value); + } + break; + default: + break; + } + options.simple = options.simple && (param instanceof Node.Identifier); + }; + Parser.prototype.reinterpretAsCoverFormalsList = function (expr) { + var params = [expr]; + var options; + var asyncArrow = false; + switch (expr.type) { + case syntax_1.Syntax.Identifier: + break; + case ArrowParameterPlaceHolder: + params = expr.params; + asyncArrow = expr.async; + break; + default: + return null; + } + options = { + simple: true, + paramSet: {} + }; + for (var i = 0; i < params.length; ++i) { + var param = params[i]; + if (param.type === syntax_1.Syntax.AssignmentPattern) { + if (param.right.type === syntax_1.Syntax.YieldExpression) { + if (param.right.argument) { + this.throwUnexpectedToken(this.lookahead); + } + param.right.type = syntax_1.Syntax.Identifier; + param.right.name = 'yield'; + delete param.right.argument; + delete param.right.delegate; + } + } + else if (asyncArrow && param.type === syntax_1.Syntax.Identifier && param.name === 'await') { + this.throwUnexpectedToken(this.lookahead); + } + this.checkPatternParam(options, param); + params[i] = param; + } + if (this.context.strict || !this.context.allowYield) { + for (var i = 0; i < params.length; ++i) { + var param = params[i]; + if (param.type === syntax_1.Syntax.YieldExpression) { + this.throwUnexpectedToken(this.lookahead); + } + } + } + if (options.message === messages_1.Messages.StrictParamDupe) { + var token = this.context.strict ? options.stricted : options.firstRestricted; + this.throwUnexpectedToken(token, options.message); + } + return { + simple: options.simple, + params: params, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; + }; + Parser.prototype.parseAssignmentExpression = function () { + var expr; + if (!this.context.allowYield && this.matchKeyword('yield')) { + expr = this.parseYieldExpression(); + } + else { + var startToken = this.lookahead; + var token = startToken; + expr = this.parseConditionalExpression(); + if (token.type === 3 /* Identifier */ && (token.lineNumber === this.lookahead.lineNumber) && token.value === 'async') { + if (this.lookahead.type === 3 /* Identifier */ || this.matchKeyword('yield')) { + var arg = this.parsePrimaryExpression(); + this.reinterpretExpressionAsPattern(arg); + expr = { + type: ArrowParameterPlaceHolder, + params: [arg], + async: true + }; + } + } + if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) { + // https://tc39.github.io/ecma262/#sec-arrow-function-definitions + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var isAsync = expr.async; + var list = this.reinterpretAsCoverFormalsList(expr); + if (list) { + if (this.hasLineTerminator) { + this.tolerateUnexpectedToken(this.lookahead); + } + this.context.firstCoverInitializedNameError = null; + var previousStrict = this.context.strict; + var previousAllowStrictDirective = this.context.allowStrictDirective; + this.context.allowStrictDirective = list.simple; + var previousAllowYield = this.context.allowYield; + var previousAwait = this.context.await; + this.context.allowYield = true; + this.context.await = isAsync; + var node = this.startNode(startToken); + this.expect('=>'); + var body = void 0; + if (this.match('{')) { + var previousAllowIn = this.context.allowIn; + this.context.allowIn = true; + body = this.parseFunctionSourceElements(); + this.context.allowIn = previousAllowIn; + } + else { + body = this.isolateCoverGrammar(this.parseAssignmentExpression); + } + var expression = body.type !== syntax_1.Syntax.BlockStatement; + if (this.context.strict && list.firstRestricted) { + this.throwUnexpectedToken(list.firstRestricted, list.message); + } + if (this.context.strict && list.stricted) { + this.tolerateUnexpectedToken(list.stricted, list.message); + } + expr = isAsync ? this.finalize(node, new Node.AsyncArrowFunctionExpression(list.params, body, expression)) : + this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression)); + this.context.strict = previousStrict; + this.context.allowStrictDirective = previousAllowStrictDirective; + this.context.allowYield = previousAllowYield; + this.context.await = previousAwait; + } + } + else { + if (this.matchAssign()) { + if (!this.context.isAssignmentTarget) { + this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); + } + if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) { + var id = expr; + if (this.scanner.isRestrictedWord(id.name)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment); + } + if (this.scanner.isStrictModeReservedWord(id.name)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); + } + } + if (!this.match('=')) { + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + else { + this.reinterpretExpressionAsPattern(expr); + } + token = this.nextToken(); + var operator = token.value; + var right = this.isolateCoverGrammar(this.parseAssignmentExpression); + expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(operator, expr, right)); + this.context.firstCoverInitializedNameError = null; + } + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-comma-operator + Parser.prototype.parseExpression = function () { + var startToken = this.lookahead; + var expr = this.isolateCoverGrammar(this.parseAssignmentExpression); + if (this.match(',')) { + var expressions = []; + expressions.push(expr); + while (this.lookahead.type !== 2 /* EOF */) { + if (!this.match(',')) { + break; + } + this.nextToken(); + expressions.push(this.isolateCoverGrammar(this.parseAssignmentExpression)); + } + expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-block + Parser.prototype.parseStatementListItem = function () { + var statement; + this.context.isAssignmentTarget = true; + this.context.isBindingElement = true; + if (this.lookahead.type === 4 /* Keyword */) { + switch (this.lookahead.value) { + case 'export': + if (!this.context.isModule) { + this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration); + } + statement = this.parseExportDeclaration(); + break; + case 'import': + if (!this.context.isModule) { + this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration); + } + statement = this.parseImportDeclaration(); + break; + case 'const': + statement = this.parseLexicalDeclaration({ inFor: false }); + break; + case 'function': + statement = this.parseFunctionDeclaration(); + break; + case 'class': + statement = this.parseClassDeclaration(); + break; + case 'let': + statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ inFor: false }) : this.parseStatement(); + break; + default: + statement = this.parseStatement(); + break; + } + } + else { + statement = this.parseStatement(); + } + return statement; + }; + Parser.prototype.parseBlock = function () { + var node = this.createNode(); + this.expect('{'); + var block = []; + while (true) { + if (this.match('}')) { + break; + } + block.push(this.parseStatementListItem()); + } + this.expect('}'); + return this.finalize(node, new Node.BlockStatement(block)); + }; + // https://tc39.github.io/ecma262/#sec-let-and-const-declarations + Parser.prototype.parseLexicalBinding = function (kind, options) { + var node = this.createNode(); + var params = []; + var id = this.parsePattern(params, kind); + if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { + if (this.scanner.isRestrictedWord(id.name)) { + this.tolerateError(messages_1.Messages.StrictVarName); + } + } + var init = null; + if (kind === 'const') { + if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) { + if (this.match('=')) { + this.nextToken(); + init = this.isolateCoverGrammar(this.parseAssignmentExpression); + } + else { + this.throwError(messages_1.Messages.DeclarationMissingInitializer, 'const'); + } + } + } + else if ((!options.inFor && id.type !== syntax_1.Syntax.Identifier) || this.match('=')) { + this.expect('='); + init = this.isolateCoverGrammar(this.parseAssignmentExpression); + } + return this.finalize(node, new Node.VariableDeclarator(id, init)); + }; + Parser.prototype.parseBindingList = function (kind, options) { + var list = [this.parseLexicalBinding(kind, options)]; + while (this.match(',')) { + this.nextToken(); + list.push(this.parseLexicalBinding(kind, options)); + } + return list; + }; + Parser.prototype.isLexicalDeclaration = function () { + var state = this.scanner.saveState(); + this.scanner.scanComments(); + var next = this.scanner.lex(); + this.scanner.restoreState(state); + return (next.type === 3 /* Identifier */) || + (next.type === 7 /* Punctuator */ && next.value === '[') || + (next.type === 7 /* Punctuator */ && next.value === '{') || + (next.type === 4 /* Keyword */ && next.value === 'let') || + (next.type === 4 /* Keyword */ && next.value === 'yield'); + }; + Parser.prototype.parseLexicalDeclaration = function (options) { + var node = this.createNode(); + var kind = this.nextToken().value; + assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const'); + var declarations = this.parseBindingList(kind, options); + this.consumeSemicolon(); + return this.finalize(node, new Node.VariableDeclaration(declarations, kind)); + }; + // https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns + Parser.prototype.parseBindingRestElement = function (params, kind) { + var node = this.createNode(); + this.expect('...'); + var arg = this.parsePattern(params, kind); + return this.finalize(node, new Node.RestElement(arg)); + }; + Parser.prototype.parseArrayPattern = function (params, kind) { + var node = this.createNode(); + this.expect('['); + var elements = []; + while (!this.match(']')) { + if (this.match(',')) { + this.nextToken(); + elements.push(null); + } + else { + if (this.match('...')) { + elements.push(this.parseBindingRestElement(params, kind)); + break; + } + else { + elements.push(this.parsePatternWithDefault(params, kind)); + } + if (!this.match(']')) { + this.expect(','); + } + } + } + this.expect(']'); + return this.finalize(node, new Node.ArrayPattern(elements)); + }; + Parser.prototype.parsePropertyPattern = function (params, kind) { + var node = this.createNode(); + var computed = false; + var shorthand = false; + var method = false; + var key; + var value; + if (this.lookahead.type === 3 /* Identifier */) { + var keyToken = this.lookahead; + key = this.parseVariableIdentifier(); + var init = this.finalize(node, new Node.Identifier(keyToken.value)); + if (this.match('=')) { + params.push(keyToken); + shorthand = true; + this.nextToken(); + var expr = this.parseAssignmentExpression(); + value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr)); + } + else if (!this.match(':')) { + params.push(keyToken); + shorthand = true; + value = init; + } + else { + this.expect(':'); + value = this.parsePatternWithDefault(params, kind); + } + } + else { + computed = this.match('['); + key = this.parseObjectPropertyKey(); + this.expect(':'); + value = this.parsePatternWithDefault(params, kind); + } + return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand)); + }; + Parser.prototype.parseObjectPattern = function (params, kind) { + var node = this.createNode(); + var properties = []; + this.expect('{'); + while (!this.match('}')) { + properties.push(this.parsePropertyPattern(params, kind)); + if (!this.match('}')) { + this.expect(','); + } + } + this.expect('}'); + return this.finalize(node, new Node.ObjectPattern(properties)); + }; + Parser.prototype.parsePattern = function (params, kind) { + var pattern; + if (this.match('[')) { + pattern = this.parseArrayPattern(params, kind); + } + else if (this.match('{')) { + pattern = this.parseObjectPattern(params, kind); + } + else { + if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) { + this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.LetInLexicalBinding); + } + params.push(this.lookahead); + pattern = this.parseVariableIdentifier(kind); + } + return pattern; + }; + Parser.prototype.parsePatternWithDefault = function (params, kind) { + var startToken = this.lookahead; + var pattern = this.parsePattern(params, kind); + if (this.match('=')) { + this.nextToken(); + var previousAllowYield = this.context.allowYield; + this.context.allowYield = true; + var right = this.isolateCoverGrammar(this.parseAssignmentExpression); + this.context.allowYield = previousAllowYield; + pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right)); + } + return pattern; + }; + // https://tc39.github.io/ecma262/#sec-variable-statement + Parser.prototype.parseVariableIdentifier = function (kind) { + var node = this.createNode(); + var token = this.nextToken(); + if (token.type === 4 /* Keyword */ && token.value === 'yield') { + if (this.context.strict) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); + } + else if (!this.context.allowYield) { + this.throwUnexpectedToken(token); + } + } + else if (token.type !== 3 /* Identifier */) { + if (this.context.strict && token.type === 4 /* Keyword */ && this.scanner.isStrictModeReservedWord(token.value)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); + } + else { + if (this.context.strict || token.value !== 'let' || kind !== 'var') { + this.throwUnexpectedToken(token); + } + } + } + else if ((this.context.isModule || this.context.await) && token.type === 3 /* Identifier */ && token.value === 'await') { + this.tolerateUnexpectedToken(token); + } + return this.finalize(node, new Node.Identifier(token.value)); + }; + Parser.prototype.parseVariableDeclaration = function (options) { + var node = this.createNode(); + var params = []; + var id = this.parsePattern(params, 'var'); + if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { + if (this.scanner.isRestrictedWord(id.name)) { + this.tolerateError(messages_1.Messages.StrictVarName); + } + } + var init = null; + if (this.match('=')) { + this.nextToken(); + init = this.isolateCoverGrammar(this.parseAssignmentExpression); + } + else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) { + this.expect('='); + } + return this.finalize(node, new Node.VariableDeclarator(id, init)); + }; + Parser.prototype.parseVariableDeclarationList = function (options) { + var opt = { inFor: options.inFor }; + var list = []; + list.push(this.parseVariableDeclaration(opt)); + while (this.match(',')) { + this.nextToken(); + list.push(this.parseVariableDeclaration(opt)); + } + return list; + }; + Parser.prototype.parseVariableStatement = function () { + var node = this.createNode(); + this.expectKeyword('var'); + var declarations = this.parseVariableDeclarationList({ inFor: false }); + this.consumeSemicolon(); + return this.finalize(node, new Node.VariableDeclaration(declarations, 'var')); + }; + // https://tc39.github.io/ecma262/#sec-empty-statement + Parser.prototype.parseEmptyStatement = function () { + var node = this.createNode(); + this.expect(';'); + return this.finalize(node, new Node.EmptyStatement()); + }; + // https://tc39.github.io/ecma262/#sec-expression-statement + Parser.prototype.parseExpressionStatement = function () { + var node = this.createNode(); + var expr = this.parseExpression(); + this.consumeSemicolon(); + return this.finalize(node, new Node.ExpressionStatement(expr)); + }; + // https://tc39.github.io/ecma262/#sec-if-statement + Parser.prototype.parseIfClause = function () { + if (this.context.strict && this.matchKeyword('function')) { + this.tolerateError(messages_1.Messages.StrictFunction); + } + return this.parseStatement(); + }; + Parser.prototype.parseIfStatement = function () { + var node = this.createNode(); + var consequent; + var alternate = null; + this.expectKeyword('if'); + this.expect('('); + var test = this.parseExpression(); + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + consequent = this.finalize(this.createNode(), new Node.EmptyStatement()); + } + else { + this.expect(')'); + consequent = this.parseIfClause(); + if (this.matchKeyword('else')) { + this.nextToken(); + alternate = this.parseIfClause(); + } + } + return this.finalize(node, new Node.IfStatement(test, consequent, alternate)); + }; + // https://tc39.github.io/ecma262/#sec-do-while-statement + Parser.prototype.parseDoWhileStatement = function () { + var node = this.createNode(); + this.expectKeyword('do'); + var previousInIteration = this.context.inIteration; + this.context.inIteration = true; + var body = this.parseStatement(); + this.context.inIteration = previousInIteration; + this.expectKeyword('while'); + this.expect('('); + var test = this.parseExpression(); + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + } + else { + this.expect(')'); + if (this.match(';')) { + this.nextToken(); + } + } + return this.finalize(node, new Node.DoWhileStatement(body, test)); + }; + // https://tc39.github.io/ecma262/#sec-while-statement + Parser.prototype.parseWhileStatement = function () { + var node = this.createNode(); + var body; + this.expectKeyword('while'); + this.expect('('); + var test = this.parseExpression(); + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + body = this.finalize(this.createNode(), new Node.EmptyStatement()); + } + else { + this.expect(')'); + var previousInIteration = this.context.inIteration; + this.context.inIteration = true; + body = this.parseStatement(); + this.context.inIteration = previousInIteration; + } + return this.finalize(node, new Node.WhileStatement(test, body)); + }; + // https://tc39.github.io/ecma262/#sec-for-statement + // https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements + Parser.prototype.parseForStatement = function () { + var init = null; + var test = null; + var update = null; + var forIn = true; + var left, right; + var node = this.createNode(); + this.expectKeyword('for'); + this.expect('('); + if (this.match(';')) { + this.nextToken(); + } + else { + if (this.matchKeyword('var')) { + init = this.createNode(); + this.nextToken(); + var previousAllowIn = this.context.allowIn; + this.context.allowIn = false; + var declarations = this.parseVariableDeclarationList({ inFor: true }); + this.context.allowIn = previousAllowIn; + if (declarations.length === 1 && this.matchKeyword('in')) { + var decl = declarations[0]; + if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) { + this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in'); + } + init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); + this.nextToken(); + left = init; + right = this.parseExpression(); + init = null; + } + else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { + init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); + this.nextToken(); + left = init; + right = this.parseAssignmentExpression(); + init = null; + forIn = false; + } + else { + init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); + this.expect(';'); + } + } + else if (this.matchKeyword('const') || this.matchKeyword('let')) { + init = this.createNode(); + var kind = this.nextToken().value; + if (!this.context.strict && this.lookahead.value === 'in') { + init = this.finalize(init, new Node.Identifier(kind)); + this.nextToken(); + left = init; + right = this.parseExpression(); + init = null; + } + else { + var previousAllowIn = this.context.allowIn; + this.context.allowIn = false; + var declarations = this.parseBindingList(kind, { inFor: true }); + this.context.allowIn = previousAllowIn; + if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) { + init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); + this.nextToken(); + left = init; + right = this.parseExpression(); + init = null; + } + else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { + init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); + this.nextToken(); + left = init; + right = this.parseAssignmentExpression(); + init = null; + forIn = false; + } + else { + this.consumeSemicolon(); + init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); + } + } + } + else { + var initStartToken = this.lookahead; + var previousAllowIn = this.context.allowIn; + this.context.allowIn = false; + init = this.inheritCoverGrammar(this.parseAssignmentExpression); + this.context.allowIn = previousAllowIn; + if (this.matchKeyword('in')) { + if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { + this.tolerateError(messages_1.Messages.InvalidLHSInForIn); + } + this.nextToken(); + this.reinterpretExpressionAsPattern(init); + left = init; + right = this.parseExpression(); + init = null; + } + else if (this.matchContextualKeyword('of')) { + if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { + this.tolerateError(messages_1.Messages.InvalidLHSInForLoop); + } + this.nextToken(); + this.reinterpretExpressionAsPattern(init); + left = init; + right = this.parseAssignmentExpression(); + init = null; + forIn = false; + } + else { + if (this.match(',')) { + var initSeq = [init]; + while (this.match(',')) { + this.nextToken(); + initSeq.push(this.isolateCoverGrammar(this.parseAssignmentExpression)); + } + init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq)); + } + this.expect(';'); + } + } + } + if (typeof left === 'undefined') { + if (!this.match(';')) { + test = this.parseExpression(); + } + this.expect(';'); + if (!this.match(')')) { + update = this.parseExpression(); + } + } + var body; + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + body = this.finalize(this.createNode(), new Node.EmptyStatement()); + } + else { + this.expect(')'); + var previousInIteration = this.context.inIteration; + this.context.inIteration = true; + body = this.isolateCoverGrammar(this.parseStatement); + this.context.inIteration = previousInIteration; + } + return (typeof left === 'undefined') ? + this.finalize(node, new Node.ForStatement(init, test, update, body)) : + forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) : + this.finalize(node, new Node.ForOfStatement(left, right, body)); + }; + // https://tc39.github.io/ecma262/#sec-continue-statement + Parser.prototype.parseContinueStatement = function () { + var node = this.createNode(); + this.expectKeyword('continue'); + var label = null; + if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) { + var id = this.parseVariableIdentifier(); + label = id; + var key = '$' + id.name; + if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { + this.throwError(messages_1.Messages.UnknownLabel, id.name); + } + } + this.consumeSemicolon(); + if (label === null && !this.context.inIteration) { + this.throwError(messages_1.Messages.IllegalContinue); + } + return this.finalize(node, new Node.ContinueStatement(label)); + }; + // https://tc39.github.io/ecma262/#sec-break-statement + Parser.prototype.parseBreakStatement = function () { + var node = this.createNode(); + this.expectKeyword('break'); + var label = null; + if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) { + var id = this.parseVariableIdentifier(); + var key = '$' + id.name; + if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { + this.throwError(messages_1.Messages.UnknownLabel, id.name); + } + label = id; + } + this.consumeSemicolon(); + if (label === null && !this.context.inIteration && !this.context.inSwitch) { + this.throwError(messages_1.Messages.IllegalBreak); + } + return this.finalize(node, new Node.BreakStatement(label)); + }; + // https://tc39.github.io/ecma262/#sec-return-statement + Parser.prototype.parseReturnStatement = function () { + if (!this.context.inFunctionBody) { + this.tolerateError(messages_1.Messages.IllegalReturn); + } + var node = this.createNode(); + this.expectKeyword('return'); + var hasArgument = (!this.match(';') && !this.match('}') && + !this.hasLineTerminator && this.lookahead.type !== 2 /* EOF */) || + this.lookahead.type === 8 /* StringLiteral */ || + this.lookahead.type === 10 /* Template */; + var argument = hasArgument ? this.parseExpression() : null; + this.consumeSemicolon(); + return this.finalize(node, new Node.ReturnStatement(argument)); + }; + // https://tc39.github.io/ecma262/#sec-with-statement + Parser.prototype.parseWithStatement = function () { + if (this.context.strict) { + this.tolerateError(messages_1.Messages.StrictModeWith); + } + var node = this.createNode(); + var body; + this.expectKeyword('with'); + this.expect('('); + var object = this.parseExpression(); + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + body = this.finalize(this.createNode(), new Node.EmptyStatement()); + } + else { + this.expect(')'); + body = this.parseStatement(); + } + return this.finalize(node, new Node.WithStatement(object, body)); + }; + // https://tc39.github.io/ecma262/#sec-switch-statement + Parser.prototype.parseSwitchCase = function () { + var node = this.createNode(); + var test; + if (this.matchKeyword('default')) { + this.nextToken(); + test = null; + } + else { + this.expectKeyword('case'); + test = this.parseExpression(); + } + this.expect(':'); + var consequent = []; + while (true) { + if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) { + break; + } + consequent.push(this.parseStatementListItem()); + } + return this.finalize(node, new Node.SwitchCase(test, consequent)); + }; + Parser.prototype.parseSwitchStatement = function () { + var node = this.createNode(); + this.expectKeyword('switch'); + this.expect('('); + var discriminant = this.parseExpression(); + this.expect(')'); + var previousInSwitch = this.context.inSwitch; + this.context.inSwitch = true; + var cases = []; + var defaultFound = false; + this.expect('{'); + while (true) { + if (this.match('}')) { + break; + } + var clause = this.parseSwitchCase(); + if (clause.test === null) { + if (defaultFound) { + this.throwError(messages_1.Messages.MultipleDefaultsInSwitch); + } + defaultFound = true; + } + cases.push(clause); + } + this.expect('}'); + this.context.inSwitch = previousInSwitch; + return this.finalize(node, new Node.SwitchStatement(discriminant, cases)); + }; + // https://tc39.github.io/ecma262/#sec-labelled-statements + Parser.prototype.parseLabelledStatement = function () { + var node = this.createNode(); + var expr = this.parseExpression(); + var statement; + if ((expr.type === syntax_1.Syntax.Identifier) && this.match(':')) { + this.nextToken(); + var id = expr; + var key = '$' + id.name; + if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { + this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name); + } + this.context.labelSet[key] = true; + var body = void 0; + if (this.matchKeyword('class')) { + this.tolerateUnexpectedToken(this.lookahead); + body = this.parseClassDeclaration(); + } + else if (this.matchKeyword('function')) { + var token = this.lookahead; + var declaration = this.parseFunctionDeclaration(); + if (this.context.strict) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunction); + } + else if (declaration.generator) { + this.tolerateUnexpectedToken(token, messages_1.Messages.GeneratorInLegacyContext); + } + body = declaration; + } + else { + body = this.parseStatement(); + } + delete this.context.labelSet[key]; + statement = new Node.LabeledStatement(id, body); + } + else { + this.consumeSemicolon(); + statement = new Node.ExpressionStatement(expr); + } + return this.finalize(node, statement); + }; + // https://tc39.github.io/ecma262/#sec-throw-statement + Parser.prototype.parseThrowStatement = function () { + var node = this.createNode(); + this.expectKeyword('throw'); + if (this.hasLineTerminator) { + this.throwError(messages_1.Messages.NewlineAfterThrow); + } + var argument = this.parseExpression(); + this.consumeSemicolon(); + return this.finalize(node, new Node.ThrowStatement(argument)); + }; + // https://tc39.github.io/ecma262/#sec-try-statement + Parser.prototype.parseCatchClause = function () { + var node = this.createNode(); + this.expectKeyword('catch'); + this.expect('('); + if (this.match(')')) { + this.throwUnexpectedToken(this.lookahead); + } + var params = []; + var param = this.parsePattern(params); + var paramMap = {}; + for (var i = 0; i < params.length; i++) { + var key = '$' + params[i].value; + if (Object.prototype.hasOwnProperty.call(paramMap, key)) { + this.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value); + } + paramMap[key] = true; + } + if (this.context.strict && param.type === syntax_1.Syntax.Identifier) { + if (this.scanner.isRestrictedWord(param.name)) { + this.tolerateError(messages_1.Messages.StrictCatchVariable); + } + } + this.expect(')'); + var body = this.parseBlock(); + return this.finalize(node, new Node.CatchClause(param, body)); + }; + Parser.prototype.parseFinallyClause = function () { + this.expectKeyword('finally'); + return this.parseBlock(); + }; + Parser.prototype.parseTryStatement = function () { + var node = this.createNode(); + this.expectKeyword('try'); + var block = this.parseBlock(); + var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null; + var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null; + if (!handler && !finalizer) { + this.throwError(messages_1.Messages.NoCatchOrFinally); + } + return this.finalize(node, new Node.TryStatement(block, handler, finalizer)); + }; + // https://tc39.github.io/ecma262/#sec-debugger-statement + Parser.prototype.parseDebuggerStatement = function () { + var node = this.createNode(); + this.expectKeyword('debugger'); + this.consumeSemicolon(); + return this.finalize(node, new Node.DebuggerStatement()); + }; + // https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations + Parser.prototype.parseStatement = function () { + var statement; + switch (this.lookahead.type) { + case 1 /* BooleanLiteral */: + case 5 /* NullLiteral */: + case 6 /* NumericLiteral */: + case 8 /* StringLiteral */: + case 10 /* Template */: + case 9 /* RegularExpression */: + statement = this.parseExpressionStatement(); + break; + case 7 /* Punctuator */: + var value = this.lookahead.value; + if (value === '{') { + statement = this.parseBlock(); + } + else if (value === '(') { + statement = this.parseExpressionStatement(); + } + else if (value === ';') { + statement = this.parseEmptyStatement(); + } + else { + statement = this.parseExpressionStatement(); + } + break; + case 3 /* Identifier */: + statement = this.matchAsyncFunction() ? this.parseFunctionDeclaration() : this.parseLabelledStatement(); + break; + case 4 /* Keyword */: + switch (this.lookahead.value) { + case 'break': + statement = this.parseBreakStatement(); + break; + case 'continue': + statement = this.parseContinueStatement(); + break; + case 'debugger': + statement = this.parseDebuggerStatement(); + break; + case 'do': + statement = this.parseDoWhileStatement(); + break; + case 'for': + statement = this.parseForStatement(); + break; + case 'function': + statement = this.parseFunctionDeclaration(); + break; + case 'if': + statement = this.parseIfStatement(); + break; + case 'return': + statement = this.parseReturnStatement(); + break; + case 'switch': + statement = this.parseSwitchStatement(); + break; + case 'throw': + statement = this.parseThrowStatement(); + break; + case 'try': + statement = this.parseTryStatement(); + break; + case 'var': + statement = this.parseVariableStatement(); + break; + case 'while': + statement = this.parseWhileStatement(); + break; + case 'with': + statement = this.parseWithStatement(); + break; + default: + statement = this.parseExpressionStatement(); + break; + } + break; + default: + statement = this.throwUnexpectedToken(this.lookahead); + } + return statement; + }; + // https://tc39.github.io/ecma262/#sec-function-definitions + Parser.prototype.parseFunctionSourceElements = function () { + var node = this.createNode(); + this.expect('{'); + var body = this.parseDirectivePrologues(); + var previousLabelSet = this.context.labelSet; + var previousInIteration = this.context.inIteration; + var previousInSwitch = this.context.inSwitch; + var previousInFunctionBody = this.context.inFunctionBody; + this.context.labelSet = {}; + this.context.inIteration = false; + this.context.inSwitch = false; + this.context.inFunctionBody = true; + while (this.lookahead.type !== 2 /* EOF */) { + if (this.match('}')) { + break; + } + body.push(this.parseStatementListItem()); + } + this.expect('}'); + this.context.labelSet = previousLabelSet; + this.context.inIteration = previousInIteration; + this.context.inSwitch = previousInSwitch; + this.context.inFunctionBody = previousInFunctionBody; + return this.finalize(node, new Node.BlockStatement(body)); + }; + Parser.prototype.validateParam = function (options, param, name) { + var key = '$' + name; + if (this.context.strict) { + if (this.scanner.isRestrictedWord(name)) { + options.stricted = param; + options.message = messages_1.Messages.StrictParamName; + } + if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { + options.stricted = param; + options.message = messages_1.Messages.StrictParamDupe; + } + } + else if (!options.firstRestricted) { + if (this.scanner.isRestrictedWord(name)) { + options.firstRestricted = param; + options.message = messages_1.Messages.StrictParamName; + } + else if (this.scanner.isStrictModeReservedWord(name)) { + options.firstRestricted = param; + options.message = messages_1.Messages.StrictReservedWord; + } + else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { + options.stricted = param; + options.message = messages_1.Messages.StrictParamDupe; + } + } + /* istanbul ignore next */ + if (typeof Object.defineProperty === 'function') { + Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true }); + } + else { + options.paramSet[key] = true; + } + }; + Parser.prototype.parseRestElement = function (params) { + var node = this.createNode(); + this.expect('...'); + var arg = this.parsePattern(params); + if (this.match('=')) { + this.throwError(messages_1.Messages.DefaultRestParameter); + } + if (!this.match(')')) { + this.throwError(messages_1.Messages.ParameterAfterRestParameter); + } + return this.finalize(node, new Node.RestElement(arg)); + }; + Parser.prototype.parseFormalParameter = function (options) { + var params = []; + var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params); + for (var i = 0; i < params.length; i++) { + this.validateParam(options, params[i], params[i].value); + } + options.simple = options.simple && (param instanceof Node.Identifier); + options.params.push(param); + }; + Parser.prototype.parseFormalParameters = function (firstRestricted) { + var options; + options = { + simple: true, + params: [], + firstRestricted: firstRestricted + }; + this.expect('('); + if (!this.match(')')) { + options.paramSet = {}; + while (this.lookahead.type !== 2 /* EOF */) { + this.parseFormalParameter(options); + if (this.match(')')) { + break; + } + this.expect(','); + if (this.match(')')) { + break; + } + } + } + this.expect(')'); + return { + simple: options.simple, + params: options.params, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; + }; + Parser.prototype.matchAsyncFunction = function () { + var match = this.matchContextualKeyword('async'); + if (match) { + var state = this.scanner.saveState(); + this.scanner.scanComments(); + var next = this.scanner.lex(); + this.scanner.restoreState(state); + match = (state.lineNumber === next.lineNumber) && (next.type === 4 /* Keyword */) && (next.value === 'function'); + } + return match; + }; + Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) { + var node = this.createNode(); + var isAsync = this.matchContextualKeyword('async'); + if (isAsync) { + this.nextToken(); + } + this.expectKeyword('function'); + var isGenerator = isAsync ? false : this.match('*'); + if (isGenerator) { + this.nextToken(); + } + var message; + var id = null; + var firstRestricted = null; + if (!identifierIsOptional || !this.match('(')) { + var token = this.lookahead; + id = this.parseVariableIdentifier(); + if (this.context.strict) { + if (this.scanner.isRestrictedWord(token.value)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); + } + } + else { + if (this.scanner.isRestrictedWord(token.value)) { + firstRestricted = token; + message = messages_1.Messages.StrictFunctionName; + } + else if (this.scanner.isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = messages_1.Messages.StrictReservedWord; + } + } + } + var previousAllowAwait = this.context.await; + var previousAllowYield = this.context.allowYield; + this.context.await = isAsync; + this.context.allowYield = !isGenerator; + var formalParameters = this.parseFormalParameters(firstRestricted); + var params = formalParameters.params; + var stricted = formalParameters.stricted; + firstRestricted = formalParameters.firstRestricted; + if (formalParameters.message) { + message = formalParameters.message; + } + var previousStrict = this.context.strict; + var previousAllowStrictDirective = this.context.allowStrictDirective; + this.context.allowStrictDirective = formalParameters.simple; + var body = this.parseFunctionSourceElements(); + if (this.context.strict && firstRestricted) { + this.throwUnexpectedToken(firstRestricted, message); + } + if (this.context.strict && stricted) { + this.tolerateUnexpectedToken(stricted, message); + } + this.context.strict = previousStrict; + this.context.allowStrictDirective = previousAllowStrictDirective; + this.context.await = previousAllowAwait; + this.context.allowYield = previousAllowYield; + return isAsync ? this.finalize(node, new Node.AsyncFunctionDeclaration(id, params, body)) : + this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator)); + }; + Parser.prototype.parseFunctionExpression = function () { + var node = this.createNode(); + var isAsync = this.matchContextualKeyword('async'); + if (isAsync) { + this.nextToken(); + } + this.expectKeyword('function'); + var isGenerator = isAsync ? false : this.match('*'); + if (isGenerator) { + this.nextToken(); + } + var message; + var id = null; + var firstRestricted; + var previousAllowAwait = this.context.await; + var previousAllowYield = this.context.allowYield; + this.context.await = isAsync; + this.context.allowYield = !isGenerator; + if (!this.match('(')) { + var token = this.lookahead; + id = (!this.context.strict && !isGenerator && this.matchKeyword('yield')) ? this.parseIdentifierName() : this.parseVariableIdentifier(); + if (this.context.strict) { + if (this.scanner.isRestrictedWord(token.value)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); + } + } + else { + if (this.scanner.isRestrictedWord(token.value)) { + firstRestricted = token; + message = messages_1.Messages.StrictFunctionName; + } + else if (this.scanner.isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = messages_1.Messages.StrictReservedWord; + } + } + } + var formalParameters = this.parseFormalParameters(firstRestricted); + var params = formalParameters.params; + var stricted = formalParameters.stricted; + firstRestricted = formalParameters.firstRestricted; + if (formalParameters.message) { + message = formalParameters.message; + } + var previousStrict = this.context.strict; + var previousAllowStrictDirective = this.context.allowStrictDirective; + this.context.allowStrictDirective = formalParameters.simple; + var body = this.parseFunctionSourceElements(); + if (this.context.strict && firstRestricted) { + this.throwUnexpectedToken(firstRestricted, message); + } + if (this.context.strict && stricted) { + this.tolerateUnexpectedToken(stricted, message); + } + this.context.strict = previousStrict; + this.context.allowStrictDirective = previousAllowStrictDirective; + this.context.await = previousAllowAwait; + this.context.allowYield = previousAllowYield; + return isAsync ? this.finalize(node, new Node.AsyncFunctionExpression(id, params, body)) : + this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator)); + }; + // https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive + Parser.prototype.parseDirective = function () { + var token = this.lookahead; + var node = this.createNode(); + var expr = this.parseExpression(); + var directive = (expr.type === syntax_1.Syntax.Literal) ? this.getTokenRaw(token).slice(1, -1) : null; + this.consumeSemicolon(); + return this.finalize(node, directive ? new Node.Directive(expr, directive) : new Node.ExpressionStatement(expr)); + }; + Parser.prototype.parseDirectivePrologues = function () { + var firstRestricted = null; + var body = []; + while (true) { + var token = this.lookahead; + if (token.type !== 8 /* StringLiteral */) { + break; + } + var statement = this.parseDirective(); + body.push(statement); + var directive = statement.directive; + if (typeof directive !== 'string') { + break; + } + if (directive === 'use strict') { + this.context.strict = true; + if (firstRestricted) { + this.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral); + } + if (!this.context.allowStrictDirective) { + this.tolerateUnexpectedToken(token, messages_1.Messages.IllegalLanguageModeDirective); + } + } + else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + return body; + }; + // https://tc39.github.io/ecma262/#sec-method-definitions + Parser.prototype.qualifiedPropertyName = function (token) { + switch (token.type) { + case 3 /* Identifier */: + case 8 /* StringLiteral */: + case 1 /* BooleanLiteral */: + case 5 /* NullLiteral */: + case 6 /* NumericLiteral */: + case 4 /* Keyword */: + return true; + case 7 /* Punctuator */: + return token.value === '['; + default: + break; + } + return false; + }; + Parser.prototype.parseGetterMethod = function () { + var node = this.createNode(); + var isGenerator = false; + var previousAllowYield = this.context.allowYield; + this.context.allowYield = !isGenerator; + var formalParameters = this.parseFormalParameters(); + if (formalParameters.params.length > 0) { + this.tolerateError(messages_1.Messages.BadGetterArity); + } + var method = this.parsePropertyMethod(formalParameters); + this.context.allowYield = previousAllowYield; + return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator)); + }; + Parser.prototype.parseSetterMethod = function () { + var node = this.createNode(); + var isGenerator = false; + var previousAllowYield = this.context.allowYield; + this.context.allowYield = !isGenerator; + var formalParameters = this.parseFormalParameters(); + if (formalParameters.params.length !== 1) { + this.tolerateError(messages_1.Messages.BadSetterArity); + } + else if (formalParameters.params[0] instanceof Node.RestElement) { + this.tolerateError(messages_1.Messages.BadSetterRestParameter); + } + var method = this.parsePropertyMethod(formalParameters); + this.context.allowYield = previousAllowYield; + return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator)); + }; + Parser.prototype.parseGeneratorMethod = function () { + var node = this.createNode(); + var isGenerator = true; + var previousAllowYield = this.context.allowYield; + this.context.allowYield = true; + var params = this.parseFormalParameters(); + this.context.allowYield = false; + var method = this.parsePropertyMethod(params); + this.context.allowYield = previousAllowYield; + return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); + }; + // https://tc39.github.io/ecma262/#sec-generator-function-definitions + Parser.prototype.isStartOfExpression = function () { + var start = true; + var value = this.lookahead.value; + switch (this.lookahead.type) { + case 7 /* Punctuator */: + start = (value === '[') || (value === '(') || (value === '{') || + (value === '+') || (value === '-') || + (value === '!') || (value === '~') || + (value === '++') || (value === '--') || + (value === '/') || (value === '/='); // regular expression literal + break; + case 4 /* Keyword */: + start = (value === 'class') || (value === 'delete') || + (value === 'function') || (value === 'let') || (value === 'new') || + (value === 'super') || (value === 'this') || (value === 'typeof') || + (value === 'void') || (value === 'yield'); + break; + default: + break; + } + return start; + }; + Parser.prototype.parseYieldExpression = function () { + var node = this.createNode(); + this.expectKeyword('yield'); + var argument = null; + var delegate = false; + if (!this.hasLineTerminator) { + var previousAllowYield = this.context.allowYield; + this.context.allowYield = false; + delegate = this.match('*'); + if (delegate) { + this.nextToken(); + argument = this.parseAssignmentExpression(); + } + else if (this.isStartOfExpression()) { + argument = this.parseAssignmentExpression(); + } + this.context.allowYield = previousAllowYield; + } + return this.finalize(node, new Node.YieldExpression(argument, delegate)); + }; + // https://tc39.github.io/ecma262/#sec-class-definitions + Parser.prototype.parseClassElement = function (hasConstructor) { + var token = this.lookahead; + var node = this.createNode(); + var kind = ''; + var key = null; + var value = null; + var computed = false; + var method = false; + var isStatic = false; + var isAsync = false; + if (this.match('*')) { + this.nextToken(); + } + else { + computed = this.match('['); + key = this.parseObjectPropertyKey(); + var id = key; + if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) { + token = this.lookahead; + isStatic = true; + computed = this.match('['); + if (this.match('*')) { + this.nextToken(); + } + else { + key = this.parseObjectPropertyKey(); + } + } + if ((token.type === 3 /* Identifier */) && !this.hasLineTerminator && (token.value === 'async')) { + var punctuator = this.lookahead.value; + if (punctuator !== ':' && punctuator !== '(' && punctuator !== '*') { + isAsync = true; + token = this.lookahead; + key = this.parseObjectPropertyKey(); + if (token.type === 3 /* Identifier */ && token.value === 'constructor') { + this.tolerateUnexpectedToken(token, messages_1.Messages.ConstructorIsAsync); + } + } + } + } + var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); + if (token.type === 3 /* Identifier */) { + if (token.value === 'get' && lookaheadPropertyKey) { + kind = 'get'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + this.context.allowYield = false; + value = this.parseGetterMethod(); + } + else if (token.value === 'set' && lookaheadPropertyKey) { + kind = 'set'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + value = this.parseSetterMethod(); + } + } + else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) { + kind = 'init'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + value = this.parseGeneratorMethod(); + method = true; + } + if (!kind && key && this.match('(')) { + kind = 'init'; + value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction(); + method = true; + } + if (!kind) { + this.throwUnexpectedToken(this.lookahead); + } + if (kind === 'init') { + kind = 'method'; + } + if (!computed) { + if (isStatic && this.isPropertyKey(key, 'prototype')) { + this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype); + } + if (!isStatic && this.isPropertyKey(key, 'constructor')) { + if (kind !== 'method' || !method || (value && value.generator)) { + this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod); + } + if (hasConstructor.value) { + this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor); + } + else { + hasConstructor.value = true; + } + kind = 'constructor'; + } + } + return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic)); + }; + Parser.prototype.parseClassElementList = function () { + var body = []; + var hasConstructor = { value: false }; + this.expect('{'); + while (!this.match('}')) { + if (this.match(';')) { + this.nextToken(); + } + else { + body.push(this.parseClassElement(hasConstructor)); + } + } + this.expect('}'); + return body; + }; + Parser.prototype.parseClassBody = function () { + var node = this.createNode(); + var elementList = this.parseClassElementList(); + return this.finalize(node, new Node.ClassBody(elementList)); + }; + Parser.prototype.parseClassDeclaration = function (identifierIsOptional) { + var node = this.createNode(); + var previousStrict = this.context.strict; + this.context.strict = true; + this.expectKeyword('class'); + var id = (identifierIsOptional && (this.lookahead.type !== 3 /* Identifier */)) ? null : this.parseVariableIdentifier(); + var superClass = null; + if (this.matchKeyword('extends')) { + this.nextToken(); + superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); + } + var classBody = this.parseClassBody(); + this.context.strict = previousStrict; + return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody)); + }; + Parser.prototype.parseClassExpression = function () { + var node = this.createNode(); + var previousStrict = this.context.strict; + this.context.strict = true; + this.expectKeyword('class'); + var id = (this.lookahead.type === 3 /* Identifier */) ? this.parseVariableIdentifier() : null; + var superClass = null; + if (this.matchKeyword('extends')) { + this.nextToken(); + superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); + } + var classBody = this.parseClassBody(); + this.context.strict = previousStrict; + return this.finalize(node, new Node.ClassExpression(id, superClass, classBody)); + }; + // https://tc39.github.io/ecma262/#sec-scripts + // https://tc39.github.io/ecma262/#sec-modules + Parser.prototype.parseModule = function () { + this.context.strict = true; + this.context.isModule = true; + this.scanner.isModule = true; + var node = this.createNode(); + var body = this.parseDirectivePrologues(); + while (this.lookahead.type !== 2 /* EOF */) { + body.push(this.parseStatementListItem()); + } + return this.finalize(node, new Node.Module(body)); + }; + Parser.prototype.parseScript = function () { + var node = this.createNode(); + var body = this.parseDirectivePrologues(); + while (this.lookahead.type !== 2 /* EOF */) { + body.push(this.parseStatementListItem()); + } + return this.finalize(node, new Node.Script(body)); + }; + // https://tc39.github.io/ecma262/#sec-imports + Parser.prototype.parseModuleSpecifier = function () { + var node = this.createNode(); + if (this.lookahead.type !== 8 /* StringLiteral */) { + this.throwError(messages_1.Messages.InvalidModuleSpecifier); + } + var token = this.nextToken(); + var raw = this.getTokenRaw(token); + return this.finalize(node, new Node.Literal(token.value, raw)); + }; + // import {} ...; + Parser.prototype.parseImportSpecifier = function () { + var node = this.createNode(); + var imported; + var local; + if (this.lookahead.type === 3 /* Identifier */) { + imported = this.parseVariableIdentifier(); + local = imported; + if (this.matchContextualKeyword('as')) { + this.nextToken(); + local = this.parseVariableIdentifier(); + } + } + else { + imported = this.parseIdentifierName(); + local = imported; + if (this.matchContextualKeyword('as')) { + this.nextToken(); + local = this.parseVariableIdentifier(); + } + else { + this.throwUnexpectedToken(this.nextToken()); + } + } + return this.finalize(node, new Node.ImportSpecifier(local, imported)); + }; + // {foo, bar as bas} + Parser.prototype.parseNamedImports = function () { + this.expect('{'); + var specifiers = []; + while (!this.match('}')) { + specifiers.push(this.parseImportSpecifier()); + if (!this.match('}')) { + this.expect(','); + } + } + this.expect('}'); + return specifiers; + }; + // import ...; + Parser.prototype.parseImportDefaultSpecifier = function () { + var node = this.createNode(); + var local = this.parseIdentifierName(); + return this.finalize(node, new Node.ImportDefaultSpecifier(local)); + }; + // import <* as foo> ...; + Parser.prototype.parseImportNamespaceSpecifier = function () { + var node = this.createNode(); + this.expect('*'); + if (!this.matchContextualKeyword('as')) { + this.throwError(messages_1.Messages.NoAsAfterImportNamespace); + } + this.nextToken(); + var local = this.parseIdentifierName(); + return this.finalize(node, new Node.ImportNamespaceSpecifier(local)); + }; + Parser.prototype.parseImportDeclaration = function () { + if (this.context.inFunctionBody) { + this.throwError(messages_1.Messages.IllegalImportDeclaration); + } + var node = this.createNode(); + this.expectKeyword('import'); + var src; + var specifiers = []; + if (this.lookahead.type === 8 /* StringLiteral */) { + // import 'foo'; + src = this.parseModuleSpecifier(); + } + else { + if (this.match('{')) { + // import {bar} + specifiers = specifiers.concat(this.parseNamedImports()); + } + else if (this.match('*')) { + // import * as foo + specifiers.push(this.parseImportNamespaceSpecifier()); + } + else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) { + // import foo + specifiers.push(this.parseImportDefaultSpecifier()); + if (this.match(',')) { + this.nextToken(); + if (this.match('*')) { + // import foo, * as foo + specifiers.push(this.parseImportNamespaceSpecifier()); + } + else if (this.match('{')) { + // import foo, {bar} + specifiers = specifiers.concat(this.parseNamedImports()); + } + else { + this.throwUnexpectedToken(this.lookahead); + } + } + } + else { + this.throwUnexpectedToken(this.nextToken()); + } + if (!this.matchContextualKeyword('from')) { + var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; + this.throwError(message, this.lookahead.value); + } + this.nextToken(); + src = this.parseModuleSpecifier(); + } + this.consumeSemicolon(); + return this.finalize(node, new Node.ImportDeclaration(specifiers, src)); + }; + // https://tc39.github.io/ecma262/#sec-exports + Parser.prototype.parseExportSpecifier = function () { + var node = this.createNode(); + var local = this.parseIdentifierName(); + var exported = local; + if (this.matchContextualKeyword('as')) { + this.nextToken(); + exported = this.parseIdentifierName(); + } + return this.finalize(node, new Node.ExportSpecifier(local, exported)); + }; + Parser.prototype.parseExportDeclaration = function () { + if (this.context.inFunctionBody) { + this.throwError(messages_1.Messages.IllegalExportDeclaration); + } + var node = this.createNode(); + this.expectKeyword('export'); + var exportDeclaration; + if (this.matchKeyword('default')) { + // export default ... + this.nextToken(); + if (this.matchKeyword('function')) { + // export default function foo () {} + // export default function () {} + var declaration = this.parseFunctionDeclaration(true); + exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); + } + else if (this.matchKeyword('class')) { + // export default class foo {} + var declaration = this.parseClassDeclaration(true); + exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); + } + else if (this.matchContextualKeyword('async')) { + // export default async function f () {} + // export default async function () {} + // export default async x => x + var declaration = this.matchAsyncFunction() ? this.parseFunctionDeclaration(true) : this.parseAssignmentExpression(); + exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); + } + else { + if (this.matchContextualKeyword('from')) { + this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value); + } + // export default {}; + // export default []; + // export default (1 + 2); + var declaration = this.match('{') ? this.parseObjectInitializer() : + this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression(); + this.consumeSemicolon(); + exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); + } + } + else if (this.match('*')) { + // export * from 'foo'; + this.nextToken(); + if (!this.matchContextualKeyword('from')) { + var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; + this.throwError(message, this.lookahead.value); + } + this.nextToken(); + var src = this.parseModuleSpecifier(); + this.consumeSemicolon(); + exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src)); + } + else if (this.lookahead.type === 4 /* Keyword */) { + // export var f = 1; + var declaration = void 0; + switch (this.lookahead.value) { + case 'let': + case 'const': + declaration = this.parseLexicalDeclaration({ inFor: false }); + break; + case 'var': + case 'class': + case 'function': + declaration = this.parseStatementListItem(); + break; + default: + this.throwUnexpectedToken(this.lookahead); + } + exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); + } + else if (this.matchAsyncFunction()) { + var declaration = this.parseFunctionDeclaration(); + exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); + } + else { + var specifiers = []; + var source = null; + var isExportFromIdentifier = false; + this.expect('{'); + while (!this.match('}')) { + isExportFromIdentifier = isExportFromIdentifier || this.matchKeyword('default'); + specifiers.push(this.parseExportSpecifier()); + if (!this.match('}')) { + this.expect(','); + } + } + this.expect('}'); + if (this.matchContextualKeyword('from')) { + // export {default} from 'foo'; + // export {foo} from 'foo'; + this.nextToken(); + source = this.parseModuleSpecifier(); + this.consumeSemicolon(); + } + else if (isExportFromIdentifier) { + // export {default}; // missing fromClause + var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; + this.throwError(message, this.lookahead.value); + } + else { + // export {foo}; + this.consumeSemicolon(); + } + exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source)); + } + return exportDeclaration; + }; + return Parser; + }()); + exports.Parser = Parser; + + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + "use strict"; + // Ensure the condition is true, otherwise throw an error. + // This is only to have a better contract semantic, i.e. another safety net + // to catch a logic error. The condition shall be fulfilled in normal case. + // Do NOT use this to enforce a certain condition on any user input. + Object.defineProperty(exports, "__esModule", { value: true }); + function assert(condition, message) { + /* istanbul ignore if */ + if (!condition) { + throw new Error('ASSERT: ' + message); + } + } + exports.assert = assert; + + +/***/ }, +/* 10 */ +/***/ function(module, exports) { + + "use strict"; + /* tslint:disable:max-classes-per-file */ + Object.defineProperty(exports, "__esModule", { value: true }); + var ErrorHandler = (function () { + function ErrorHandler() { + this.errors = []; + this.tolerant = false; + } + ErrorHandler.prototype.recordError = function (error) { + this.errors.push(error); + }; + ErrorHandler.prototype.tolerate = function (error) { + if (this.tolerant) { + this.recordError(error); + } + else { + throw error; + } + }; + ErrorHandler.prototype.constructError = function (msg, column) { + var error = new Error(msg); + try { + throw error; + } + catch (base) { + /* istanbul ignore else */ + if (Object.create && Object.defineProperty) { + error = Object.create(base); + Object.defineProperty(error, 'column', { value: column }); + } + } + /* istanbul ignore next */ + return error; + }; + ErrorHandler.prototype.createError = function (index, line, col, description) { + var msg = 'Line ' + line + ': ' + description; + var error = this.constructError(msg, col); + error.index = index; + error.lineNumber = line; + error.description = description; + return error; + }; + ErrorHandler.prototype.throwError = function (index, line, col, description) { + throw this.createError(index, line, col, description); + }; + ErrorHandler.prototype.tolerateError = function (index, line, col, description) { + var error = this.createError(index, line, col, description); + if (this.tolerant) { + this.recordError(error); + } + else { + throw error; + } + }; + return ErrorHandler; + }()); + exports.ErrorHandler = ErrorHandler; + + +/***/ }, +/* 11 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + // Error messages should be identical to V8. + exports.Messages = { + BadGetterArity: 'Getter must not have any formal parameters', + BadSetterArity: 'Setter must have exactly one formal parameter', + BadSetterRestParameter: 'Setter function argument must not be a rest parameter', + ConstructorIsAsync: 'Class constructor may not be an async method', + ConstructorSpecialMethod: 'Class constructor may not be an accessor', + DeclarationMissingInitializer: 'Missing initializer in %0 declaration', + DefaultRestParameter: 'Unexpected token =', + DuplicateBinding: 'Duplicate binding %0', + DuplicateConstructor: 'A class may only have one constructor', + DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals', + ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer', + GeneratorInLegacyContext: 'Generator declarations are not allowed in legacy contexts', + IllegalBreak: 'Illegal break statement', + IllegalContinue: 'Illegal continue statement', + IllegalExportDeclaration: 'Unexpected token', + IllegalImportDeclaration: 'Unexpected token', + IllegalLanguageModeDirective: 'Illegal \'use strict\' directive in function with non-simple parameter list', + IllegalReturn: 'Illegal return statement', + InvalidEscapedReservedWord: 'Keyword must not contain escaped characters', + InvalidHexEscapeSequence: 'Invalid hexadecimal escape sequence', + InvalidLHSInAssignment: 'Invalid left-hand side in assignment', + InvalidLHSInForIn: 'Invalid left-hand side in for-in', + InvalidLHSInForLoop: 'Invalid left-hand side in for-loop', + InvalidModuleSpecifier: 'Unexpected token', + InvalidRegExp: 'Invalid regular expression', + LetInLexicalBinding: 'let is disallowed as a lexically bound name', + MissingFromClause: 'Unexpected token', + MultipleDefaultsInSwitch: 'More than one default clause in switch statement', + NewlineAfterThrow: 'Illegal newline after throw', + NoAsAfterImportNamespace: 'Unexpected token', + NoCatchOrFinally: 'Missing catch or finally after try', + ParameterAfterRestParameter: 'Rest parameter must be last formal parameter', + Redeclaration: '%0 \'%1\' has already been declared', + StaticPrototype: 'Classes may not have static property named prototype', + StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', + StrictDelete: 'Delete of an unqualified identifier in strict mode.', + StrictFunction: 'In strict mode code, functions can only be declared at top level or inside a block', + StrictFunctionName: 'Function name may not be eval or arguments in strict mode', + StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', + StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', + StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', + StrictModeWith: 'Strict mode code may not include a with statement', + StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', + StrictParamDupe: 'Strict mode function may not have duplicate parameter names', + StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', + StrictReservedWord: 'Use of future reserved word in strict mode', + StrictVarName: 'Variable name may not be eval or arguments in strict mode', + TemplateOctalLiteral: 'Octal literals are not allowed in template strings.', + UnexpectedEOS: 'Unexpected end of input', + UnexpectedIdentifier: 'Unexpected identifier', + UnexpectedNumber: 'Unexpected number', + UnexpectedReserved: 'Unexpected reserved word', + UnexpectedString: 'Unexpected string', + UnexpectedTemplate: 'Unexpected quasi %0', + UnexpectedToken: 'Unexpected token %0', + UnexpectedTokenIllegal: 'Unexpected token ILLEGAL', + UnknownLabel: 'Undefined label \'%0\'', + UnterminatedRegExp: 'Invalid regular expression: missing /' + }; + + +/***/ }, +/* 12 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var assert_1 = __webpack_require__(9); + var character_1 = __webpack_require__(4); + var messages_1 = __webpack_require__(11); + function hexValue(ch) { + return '0123456789abcdef'.indexOf(ch.toLowerCase()); + } + function octalValue(ch) { + return '01234567'.indexOf(ch); + } + var Scanner = (function () { + function Scanner(code, handler) { + this.source = code; + this.errorHandler = handler; + this.trackComment = false; + this.isModule = false; + this.length = code.length; + this.index = 0; + this.lineNumber = (code.length > 0) ? 1 : 0; + this.lineStart = 0; + this.curlyStack = []; + } + Scanner.prototype.saveState = function () { + return { + index: this.index, + lineNumber: this.lineNumber, + lineStart: this.lineStart + }; + }; + Scanner.prototype.restoreState = function (state) { + this.index = state.index; + this.lineNumber = state.lineNumber; + this.lineStart = state.lineStart; + }; + Scanner.prototype.eof = function () { + return this.index >= this.length; + }; + Scanner.prototype.throwUnexpectedToken = function (message) { + if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; } + return this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); + }; + Scanner.prototype.tolerateUnexpectedToken = function (message) { + if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; } + this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); + }; + // https://tc39.github.io/ecma262/#sec-comments + Scanner.prototype.skipSingleLineComment = function (offset) { + var comments = []; + var start, loc; + if (this.trackComment) { + comments = []; + start = this.index - offset; + loc = { + start: { + line: this.lineNumber, + column: this.index - this.lineStart - offset + }, + end: {} + }; + } + while (!this.eof()) { + var ch = this.source.charCodeAt(this.index); + ++this.index; + if (character_1.Character.isLineTerminator(ch)) { + if (this.trackComment) { + loc.end = { + line: this.lineNumber, + column: this.index - this.lineStart - 1 + }; + var entry = { + multiLine: false, + slice: [start + offset, this.index - 1], + range: [start, this.index - 1], + loc: loc + }; + comments.push(entry); + } + if (ch === 13 && this.source.charCodeAt(this.index) === 10) { + ++this.index; + } + ++this.lineNumber; + this.lineStart = this.index; + return comments; + } + } + if (this.trackComment) { + loc.end = { + line: this.lineNumber, + column: this.index - this.lineStart + }; + var entry = { + multiLine: false, + slice: [start + offset, this.index], + range: [start, this.index], + loc: loc + }; + comments.push(entry); + } + return comments; + }; + Scanner.prototype.skipMultiLineComment = function () { + var comments = []; + var start, loc; + if (this.trackComment) { + comments = []; + start = this.index - 2; + loc = { + start: { + line: this.lineNumber, + column: this.index - this.lineStart - 2 + }, + end: {} + }; + } + while (!this.eof()) { + var ch = this.source.charCodeAt(this.index); + if (character_1.Character.isLineTerminator(ch)) { + if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) { + ++this.index; + } + ++this.lineNumber; + ++this.index; + this.lineStart = this.index; + } + else if (ch === 0x2A) { + // Block comment ends with '*/'. + if (this.source.charCodeAt(this.index + 1) === 0x2F) { + this.index += 2; + if (this.trackComment) { + loc.end = { + line: this.lineNumber, + column: this.index - this.lineStart + }; + var entry = { + multiLine: true, + slice: [start + 2, this.index - 2], + range: [start, this.index], + loc: loc + }; + comments.push(entry); + } + return comments; + } + ++this.index; + } + else { + ++this.index; + } + } + // Ran off the end of the file - the whole thing is a comment + if (this.trackComment) { + loc.end = { + line: this.lineNumber, + column: this.index - this.lineStart + }; + var entry = { + multiLine: true, + slice: [start + 2, this.index], + range: [start, this.index], + loc: loc + }; + comments.push(entry); + } + this.tolerateUnexpectedToken(); + return comments; + }; + Scanner.prototype.scanComments = function () { + var comments; + if (this.trackComment) { + comments = []; + } + var start = (this.index === 0); + while (!this.eof()) { + var ch = this.source.charCodeAt(this.index); + if (character_1.Character.isWhiteSpace(ch)) { + ++this.index; + } + else if (character_1.Character.isLineTerminator(ch)) { + ++this.index; + if (ch === 0x0D && this.source.charCodeAt(this.index) === 0x0A) { + ++this.index; + } + ++this.lineNumber; + this.lineStart = this.index; + start = true; + } + else if (ch === 0x2F) { + ch = this.source.charCodeAt(this.index + 1); + if (ch === 0x2F) { + this.index += 2; + var comment = this.skipSingleLineComment(2); + if (this.trackComment) { + comments = comments.concat(comment); + } + start = true; + } + else if (ch === 0x2A) { + this.index += 2; + var comment = this.skipMultiLineComment(); + if (this.trackComment) { + comments = comments.concat(comment); + } + } + else { + break; + } + } + else if (start && ch === 0x2D) { + // U+003E is '>' + if ((this.source.charCodeAt(this.index + 1) === 0x2D) && (this.source.charCodeAt(this.index + 2) === 0x3E)) { + // '-->' is a single-line comment + this.index += 3; + var comment = this.skipSingleLineComment(3); + if (this.trackComment) { + comments = comments.concat(comment); + } + } + else { + break; + } + } + else if (ch === 0x3C && !this.isModule) { + if (this.source.slice(this.index + 1, this.index + 4) === '!--') { + this.index += 4; // ` + + + +``` + +Browser support was done mostly for the online demo. If you find any errors - feel +free to send pull requests with fixes. Also note, that IE and other old browsers +needs [es5-shims](https://github.com/kriskowal/es5-shim) to operate. + +Notes: + +1. We have no resources to support browserified version. Don't expect it to be + well tested. Don't expect fast fixes if something goes wrong there. +2. `!!js/function` in browser bundle will not work by default. If you really need + it - load `esprima` parser first (via amd or directly). +3. `!!bin` in browser will return `Array`, because browsers do not support + node.js `Buffer` and adding Buffer shims is completely useless on practice. + + +API +--- + +Here we cover the most 'useful' methods. If you need advanced details (creating +your own tags), see [wiki](https://github.com/nodeca/js-yaml/wiki) and +[examples](https://github.com/nodeca/js-yaml/tree/master/examples) for more +info. + +``` javascript +const yaml = require('js-yaml'); +const fs = require('fs'); + +// Get document, or throw exception on error +try { + const doc = yaml.safeLoad(fs.readFileSync('/home/ixti/example.yml', 'utf8')); + console.log(doc); +} catch (e) { + console.log(e); +} +``` + + +### safeLoad (string [ , options ]) + +**Recommended loading way.** Parses `string` as single YAML document. Returns either a +plain object, a string or `undefined`, or throws `YAMLException` on error. By default, does +not support regexps, functions and undefined. This method is safe for untrusted data. + +options: + +- `filename` _(default: null)_ - string to be used as a file path in + error/warning messages. +- `onWarning` _(default: null)_ - function to call on warning messages. + Loader will call this function with an instance of `YAMLException` for each warning. +- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ - specifies a schema to use. + - `FAILSAFE_SCHEMA` - only strings, arrays and plain objects: + http://www.yaml.org/spec/1.2/spec.html#id2802346 + - `JSON_SCHEMA` - all JSON-supported types: + http://www.yaml.org/spec/1.2/spec.html#id2803231 + - `CORE_SCHEMA` - same as `JSON_SCHEMA`: + http://www.yaml.org/spec/1.2/spec.html#id2804923 + - `DEFAULT_SAFE_SCHEMA` - all supported YAML types, without unsafe ones + (`!!js/undefined`, `!!js/regexp` and `!!js/function`): + http://yaml.org/type/ + - `DEFAULT_FULL_SCHEMA` - all supported YAML types. +- `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error. + +NOTE: This function **does not** understand multi-document sources, it throws +exception on those. + +NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions. +So, the JSON schema is not as strictly defined in the YAML specification. +It allows numbers in any notation, use `Null` and `NULL` as `null`, etc. +The core schema also has no such restrictions. It allows binary notation for integers. + + +### load (string [ , options ]) + +**Use with care with untrusted sources**. The same as `safeLoad()` but uses +`DEFAULT_FULL_SCHEMA` by default - adds some JavaScript-specific types: +`!!js/function`, `!!js/regexp` and `!!js/undefined`. For untrusted sources, you +must additionally validate object structure to avoid injections: + +``` javascript +const untrusted_code = '"toString": ! "function (){very_evil_thing();}"'; + +// I'm just converting that string, what could possibly go wrong? +require('js-yaml').load(untrusted_code) + '' +``` + + +### safeLoadAll (string [, iterator] [, options ]) + +Same as `safeLoad()`, but understands multi-document sources. Applies +`iterator` to each document if specified, or returns array of documents. + +``` javascript +const yaml = require('js-yaml'); + +yaml.safeLoadAll(data, function (doc) { + console.log(doc); +}); +``` + + +### loadAll (string [, iterator] [ , options ]) + +Same as `safeLoadAll()` but uses `DEFAULT_FULL_SCHEMA` by default. + + +### safeDump (object [ , options ]) + +Serializes `object` as a YAML document. Uses `DEFAULT_SAFE_SCHEMA`, so it will +throw an exception if you try to dump regexps or functions. However, you can +disable exceptions by setting the `skipInvalid` option to `true`. + +options: + +- `indent` _(default: 2)_ - indentation width to use (in spaces). +- `noArrayIndent` _(default: false)_ - when true, will not add an indentation level to array elements +- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function + in the safe schema) and skip pairs and single values with such types. +- `flowLevel` (default: -1) - specifies level of nesting, when to switch from + block to flow style for collections. -1 means block style everwhere +- `styles` - "tag" => "style" map. Each tag may have own set of styles. +- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ specifies a schema to use. +- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a + function, use the function to sort the keys. +- `lineWidth` _(default: `80`)_ - set max line width. +- `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references +- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older + yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1 +- `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded. + +The following table show availlable styles (e.g. "canonical", +"binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml +output is shown on the right side after `=>` (default setting) or `->`: + +``` none +!!null + "canonical" -> "~" + "lowercase" => "null" + "uppercase" -> "NULL" + "camelcase" -> "Null" + +!!int + "binary" -> "0b1", "0b101010", "0b1110001111010" + "octal" -> "01", "052", "016172" + "decimal" => "1", "42", "7290" + "hexadecimal" -> "0x1", "0x2A", "0x1C7A" + +!!bool + "lowercase" => "true", "false" + "uppercase" -> "TRUE", "FALSE" + "camelcase" -> "True", "False" + +!!float + "lowercase" => ".nan", '.inf' + "uppercase" -> ".NAN", '.INF' + "camelcase" -> ".NaN", '.Inf' +``` + +Example: + +``` javascript +safeDump (object, { + 'styles': { + '!!null': 'canonical' // dump null as ~ + }, + 'sortKeys': true // sort object keys +}); +``` + +### dump (object [ , options ]) + +Same as `safeDump()` but without limits (uses `DEFAULT_FULL_SCHEMA` by default). + + +Supported YAML types +-------------------- + +The list of standard YAML tags and corresponding JavaScipt types. See also +[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and +[YAML types repository](http://yaml.org/type/). + +``` +!!null '' # null +!!bool 'yes' # bool +!!int '3...' # number +!!float '3.14...' # number +!!binary '...base64...' # buffer +!!timestamp 'YYYY-...' # date +!!omap [ ... ] # array of key-value pairs +!!pairs [ ... ] # array or array pairs +!!set { ... } # array of objects with given keys and null values +!!str '...' # string +!!seq [ ... ] # array +!!map { ... } # object +``` + +**JavaScript-specific tags** + +``` +!!js/regexp /pattern/gim # RegExp +!!js/undefined '' # Undefined +!!js/function 'function () {...}' # Function +``` + +Caveats +------- + +Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects +or arrays as keys, and stringifies (by calling `toString()` method) them at the +moment of adding them. + +``` yaml +--- +? [ foo, bar ] +: - baz +? { foo: bar } +: - baz + - baz +``` + +``` javascript +{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] } +``` + +Also, reading of properties on implicit block mapping keys is not supported yet. +So, the following YAML document cannot be loaded. + +``` yaml +&anchor foo: + foo: bar + *anchor: duplicate key + baz: bat + *anchor: duplicate key +``` + + +js-yaml for enterprise +---------------------- + +Available as part of the Tidelift Subscription + +The maintainers of js-yaml and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-js-yaml?utm_source=npm-js-yaml&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/bin/js-yaml.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/bin/js-yaml.js new file mode 100755 index 0000000..e79186b --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/bin/js-yaml.js @@ -0,0 +1,132 @@ +#!/usr/bin/env node + + +'use strict'; + +/*eslint-disable no-console*/ + + +// stdlib +var fs = require('fs'); + + +// 3rd-party +var argparse = require('argparse'); + + +// internal +var yaml = require('..'); + + +//////////////////////////////////////////////////////////////////////////////// + + +var cli = new argparse.ArgumentParser({ + prog: 'js-yaml', + version: require('../package.json').version, + addHelp: true +}); + + +cli.addArgument([ '-c', '--compact' ], { + help: 'Display errors in compact mode', + action: 'storeTrue' +}); + + +// deprecated (not needed after we removed output colors) +// option suppressed, but not completely removed for compatibility +cli.addArgument([ '-j', '--to-json' ], { + help: argparse.Const.SUPPRESS, + dest: 'json', + action: 'storeTrue' +}); + + +cli.addArgument([ '-t', '--trace' ], { + help: 'Show stack trace on error', + action: 'storeTrue' +}); + +cli.addArgument([ 'file' ], { + help: 'File to read, utf-8 encoded without BOM', + nargs: '?', + defaultValue: '-' +}); + + +//////////////////////////////////////////////////////////////////////////////// + + +var options = cli.parseArgs(); + + +//////////////////////////////////////////////////////////////////////////////// + +function readFile(filename, encoding, callback) { + if (options.file === '-') { + // read from stdin + + var chunks = []; + + process.stdin.on('data', function (chunk) { + chunks.push(chunk); + }); + + process.stdin.on('end', function () { + return callback(null, Buffer.concat(chunks).toString(encoding)); + }); + } else { + fs.readFile(filename, encoding, callback); + } +} + +readFile(options.file, 'utf8', function (error, input) { + var output, isYaml; + + if (error) { + if (error.code === 'ENOENT') { + console.error('File not found: ' + options.file); + process.exit(2); + } + + console.error( + options.trace && error.stack || + error.message || + String(error)); + + process.exit(1); + } + + try { + output = JSON.parse(input); + isYaml = false; + } catch (err) { + if (err instanceof SyntaxError) { + try { + output = []; + yaml.loadAll(input, function (doc) { output.push(doc); }, {}); + isYaml = true; + + if (output.length === 0) output = null; + else if (output.length === 1) output = output[0]; + + } catch (e) { + if (options.trace && err.stack) console.error(e.stack); + else console.error(e.toString(options.compact)); + + process.exit(1); + } + } else { + console.error( + options.trace && err.stack || + err.message || + String(err)); + + process.exit(1); + } + } + + if (isYaml) console.log(JSON.stringify(output, null, ' ')); + else console.log(yaml.dump(output)); +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/dist/js-yaml.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/dist/js-yaml.js new file mode 100644 index 0000000..7878320 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/dist/js-yaml.js @@ -0,0 +1,3989 @@ +/*! js-yaml 3.14.1 https://github.com/nodeca/js-yaml */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsyaml = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; + +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; + +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; + +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (map === null) return {}; + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; +} + +function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; +} + +function State(options) { + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; +} + +// Indents every line in a string. Empty lines (\n only) are not indented. +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + + if (line.length && line !== '\n') result += ind; + + result += line; + } + + return result; +} + +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} + +function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; +} + +// [33] s-white ::= s-space | s-tab +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; +} + +// Returns true if the character can be printed without escaping. +// From YAML 1.2: "any allowed characters known to be non-printable +// should also be escaped. [However,] This isn’t mandatory" +// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. +function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) + || (0x10000 <= c && c <= 0x10FFFF); +} + +// [34] ns-char ::= nb-char - s-white +// [27] nb-char ::= c-printable - b-char - c-byte-order-mark +// [26] b-char ::= b-line-feed | b-carriage-return +// [24] b-line-feed ::= #xA /* LF */ +// [25] b-carriage-return ::= #xD /* CR */ +// [3] c-byte-order-mark ::= #xFEFF +function isNsChar(c) { + return isPrintable(c) && !isWhitespace(c) + // byte-order-mark + && c !== 0xFEFF + // b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} + +// Simplified test for values allowed after the first character in plain style. +function isPlainSafe(c, prev) { + // Uses a subset of nb-char - c-flow-indicator - ":" - "#" + // where nb-char ::= c-printable - b-char - c-byte-order-mark. + return isPrintable(c) && c !== 0xFEFF + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // - ":" - "#" + // /* An ns-char preceding */ "#" + && c !== CHAR_COLON + && ((c !== CHAR_SHARP) || (prev && isNsChar(prev))); +} + +// Simplified test for values allowed as the first character in plain style. +function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + return isPrintable(c) && c !== 0xFEFF + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; +} + +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); +} + +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; + +// Determines which scalar styles are possible and returns the preferred style. +// lineWidth = -1 => no limit. +// Pre-conditions: str.length > 0. +// Post-conditions: +// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. +// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). +// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { + var i; + var char, prev_char; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(string.charCodeAt(0)) + && !isWhitespace(string.charCodeAt(string.length - 1)); + + if (singleLineOnly) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + prev_char = i > 0 ? string.charCodeAt(i - 1) : null; + plain = plain && isPlainSafe(char, prev_char); + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + prev_char = i > 0 ? string.charCodeAt(i - 1) : null; + plain = plain && isPlainSafe(char, prev_char); + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + return plain && !testAmbiguousType(string) + ? STYLE_PLAIN : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; +} + +// Note: line breaking/folding is implemented for only the folded style. +// NB. We drop the last trailing newline (if any) of a returned block scalar +// since the dumper adds its own newline. This always works: +// • No ending newline => unaffected; already using strip "-" chomping. +// • Ending newline => removed then restored. +// Importantly, this keeps the "+" chomp indicator from gaining an extra line. +function writeScalar(state, string, level, iskey) { + state.dump = (function () { + if (string.length === 0) { + return "''"; + } + if (!state.noCompatMode && + DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { + return "'" + string + "'"; + } + + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } + + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string, lineWidth) + '"'; + default: + throw new YAMLException('impossible error: invalid scalar style'); + } + }()); +} + +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); + + return indentIndicator + chomp + '\n'; +} + +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +} + +// Note: a long line without a suitable break point will exceed the width limit. +// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. +function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; + + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; + + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; + } + + return result; +} + +// Greedy line breaking. +// Picks the longest line under the limit each time, +// otherwise settles for the shortest line over the limit. +// NB. More-indented lines *cannot* be folded, as that would add an extra \n. +function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; + + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; + + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } + + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } + + return result.slice(1); // drop extra \n joiner +} + +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char, nextChar; + var escapeSeq; + + for (var i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). + if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { + nextChar = string.charCodeAt(i + 1); + if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { + // Combine the surrogate pair and store it escaped. + result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); + // Advance index one extra since we already used that char here. + i++; continue; + } + } + escapeSeq = ESCAPE_SEQUENCES[char]; + result += !escapeSeq && isPrintable(char) + ? string[i] + : escapeSeq || encodeHex(char); + } + + return result; +} + +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level, object[index], false, false)) { + if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; +} + +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level + 1, object[index], true, true)) { + if (!compact || index !== 0) { + _result += generateNextLine(state, level); + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } + + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. +} + +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + + pairBuffer = ''; + if (index !== 0) pairBuffer += ', '; + + if (state.condenseFlow) pairBuffer += '"'; + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) pairBuffer += '? '; + + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; +} + +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new YAMLException('sortKeys must be a boolean or a function'); + } + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || index !== 0) { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} + +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + state.tag = explicit ? type.tag : '?'; + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; +} + +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } + + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level; + if (block && (state.dump.length !== 0)) { + writeBlockSequence(state, arrayLevel, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, arrayLevel, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey); + } + } else { + if (state.skipInvalid) return false; + throw new YAMLException('unacceptable kind of an object to dump ' + type); + } + + if (state.tag !== null && state.tag !== '?') { + state.dump = '!<' + state.tag + '> ' + state.dump; + } + } + + return true; +} + +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); +} + +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; + + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } +} + +function dump(input, options) { + options = options || {}; + + var state = new State(options); + + if (!state.noRefs) getDuplicateReferences(input, state); + + if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; + + return ''; +} + +function safeDump(input, options) { + return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + +module.exports.dump = dump; +module.exports.safeDump = safeDump; + +},{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(require,module,exports){ +// YAML error class. http://stackoverflow.com/questions/8458984 +// +'use strict'; + +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); + + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); + + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; + } +} + + +// Inherit from Error +YAMLException.prototype = Object.create(Error.prototype); +YAMLException.prototype.constructor = YAMLException; + + +YAMLException.prototype.toString = function toString(compact) { + var result = this.name + ': '; + + result += this.reason || '(unknown reason)'; + + if (!compact && this.mark) { + result += ' ' + this.mark.toString(); + } + + return result; +}; + + +module.exports = YAMLException; + +},{}],5:[function(require,module,exports){ +'use strict'; + +/*eslint-disable max-len,no-use-before-define*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var Mark = require('./mark'); +var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); +var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); + + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + + +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; + + +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; + + +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + +function _class(obj) { return Object.prototype.toString.call(obj); } + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} + +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} + +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} + +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; +} + +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; +} + +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); +} + +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} + + +function State(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.onWarning = options['onWarning'] || null; + this.legacy = options['legacy'] || false; + this.json = options['json'] || false; + this.listener = options['listener'] || null; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +function generateError(state, message) { + return new YAMLException( + message, + new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); +} + +function throwError(state, message) { + throw generateError(state, message); +} + +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } +} + + +var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } + + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + state.tagMap[handle] = prefix; + } +}; + + +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } + + state.result += _result; + } +} + +function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } +} + +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { + var index, quantity; + + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); + } + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; + } + } + } + + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } + + + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty.call(overridableKeys, keyNode) && + _hasOwnProperty.call(_result, keyNode)) { + state.line = startLine || state.line; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } + _result[keyNode] = valueNode; + delete overridableKeys[keyNode]; + } + + return _result; +} + +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; +} + +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; +} + +function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; +} + +function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} + + +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } + + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; +} + +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x27/* ' */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} + +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x22/* " */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} + +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = {}, + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); +} + +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } + + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; +} + +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + + if (ch !== 0x2D/* - */) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} + +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _pos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = {}, + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + _pos = state.position; + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else { + break; // Reading is done. Go to the epilogue. + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if (state.lineIndent > nodeIndent && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; +} + +function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; +} + +function readAlias(state) { + var _position, alias, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x2A/* * */) return false; + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!_hasOwnProperty.call(state.anchorMap, alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} + +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (state.tag === null) { + state.tag = '?'; + } + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (state.tag !== null && state.tag !== '!') { + if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } + + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; +} + +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = {}; + state.anchorMap = {}; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) break; + + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} + + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State(input, options); + + var nullpos = input.indexOf('\0'); + + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; +} + + +function loadAll(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + var documents = loadDocuments(input, options); + + if (typeof iterator !== 'function') { + return documents; + } + + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new YAMLException('expected a single document in the stream, but found more'); +} + + +function safeLoadAll(input, iterator, options) { + if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +function safeLoad(input, options) { + return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +module.exports.loadAll = loadAll; +module.exports.load = load; +module.exports.safeLoadAll = safeLoadAll; +module.exports.safeLoad = safeLoad; + +},{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(require,module,exports){ +'use strict'; + + +var common = require('./common'); + + +function Mark(name, buffer, position, line, column) { + this.name = name; + this.buffer = buffer; + this.position = position; + this.line = line; + this.column = column; +} + + +Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { + var head, start, tail, end, snippet; + + if (!this.buffer) return null; + + indent = indent || 4; + maxLength = maxLength || 75; + + head = ''; + start = this.position; + + while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { + start -= 1; + if (this.position - start > (maxLength / 2 - 1)) { + head = ' ... '; + start += 5; + break; + } + } + + tail = ''; + end = this.position; + + while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { + end += 1; + if (end - this.position > (maxLength / 2 - 1)) { + tail = ' ... '; + end -= 5; + break; + } + } + + snippet = this.buffer.slice(start, end); + + return common.repeat(' ', indent) + head + snippet + tail + '\n' + + common.repeat(' ', indent + this.position - start + head.length) + '^'; +}; + + +Mark.prototype.toString = function toString(compact) { + var snippet, where = ''; + + if (this.name) { + where += 'in "' + this.name + '" '; + } + + where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); + + if (!compact) { + snippet = this.getSnippet(); + + if (snippet) { + where += ':\n' + snippet; + } + } + + return where; +}; + + +module.exports = Mark; + +},{"./common":2}],7:[function(require,module,exports){ +'use strict'; + +/*eslint-disable max-len*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var Type = require('./type'); + + +function compileList(schema, name, result) { + var exclude = []; + + schema.include.forEach(function (includedSchema) { + result = compileList(includedSchema, name, result); + }); + + schema[name].forEach(function (currentType) { + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { + exclude.push(previousIndex); + } + }); + + result.push(currentType); + }); + + return result.filter(function (type, index) { + return exclude.indexOf(index) === -1; + }); +} + + +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {} + }, index, length; + + function collectType(type) { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; +} + + +function Schema(definition) { + this.include = definition.include || []; + this.implicit = definition.implicit || []; + this.explicit = definition.explicit || []; + + this.implicit.forEach(function (type) { + if (type.loadKind && type.loadKind !== 'scalar') { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + }); + + this.compiledImplicit = compileList(this, 'implicit', []); + this.compiledExplicit = compileList(this, 'explicit', []); + this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); +} + + +Schema.DEFAULT = null; + + +Schema.create = function createSchema() { + var schemas, types; + + switch (arguments.length) { + case 1: + schemas = Schema.DEFAULT; + types = arguments[0]; + break; + + case 2: + schemas = arguments[0]; + types = arguments[1]; + break; + + default: + throw new YAMLException('Wrong number of arguments for Schema.create function'); + } + + schemas = common.toArray(schemas); + types = common.toArray(types); + + if (!schemas.every(function (schema) { return schema instanceof Schema; })) { + throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); + } + + if (!types.every(function (type) { return type instanceof Type; })) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + return new Schema({ + include: schemas, + explicit: types + }); +}; + + +module.exports = Schema; + +},{"./common":2,"./exception":4,"./type":13}],8:[function(require,module,exports){ +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./json') + ] +}); + +},{"../schema":7,"./json":12}],9:[function(require,module,exports){ +// JS-YAML's default schema for `load` function. +// It is not described in the YAML specification. +// +// This schema is based on JS-YAML's default safe schema and includes +// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. +// +// Also this schema is used as default base schema at `Schema.create` function. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = Schema.DEFAULT = new Schema({ + include: [ + require('./default_safe') + ], + explicit: [ + require('../type/js/undefined'), + require('../type/js/regexp'), + require('../type/js/function') + ] +}); + +},{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(require,module,exports){ +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./core') + ], + implicit: [ + require('../type/timestamp'), + require('../type/merge') + ], + explicit: [ + require('../type/binary'), + require('../type/omap'), + require('../type/pairs'), + require('../type/set') + ] +}); + +},{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(require,module,exports){ +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + explicit: [ + require('../type/str'), + require('../type/seq'), + require('../type/map') + ] +}); + +},{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(require,module,exports){ +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./failsafe') + ], + implicit: [ + require('../type/null'), + require('../type/bool'), + require('../type/int'), + require('../type/float') + ] +}); + +},{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(require,module,exports){ +'use strict'; + +var YAMLException = require('./exception'); + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +module.exports = Type; + +},{"./exception":4}],14:[function(require,module,exports){ +'use strict'; + +/*eslint-disable no-bitwise*/ + +var NodeBuffer; + +try { + // A trick for browserified version, to not include `Buffer` shim + var _require = require; + NodeBuffer = _require('buffer').Buffer; +} catch (__) {} + +var Type = require('../type'); + + +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + +function resolveYamlBinary(data) { + if (data === null) return false; + + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) continue; + + // Fail on illegal characters + if (code < 0) return false; + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} + +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + // Wrap into Buffer for NodeJS and leave Array for browser + if (NodeBuffer) { + // Support node 6.+ Buffer API when available + return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); + } + + return result; +} + +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; +} + +function isBinary(object) { + return NodeBuffer && NodeBuffer.isBuffer(object); +} + +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); + +},{"../type":13}],15:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +function resolveYamlBoolean(data) { + if (data === null) return false; + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} + +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); + +},{"../type":13}],16:[function(require,module,exports){ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // 20:59 + '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; +} + +function constructYamlFloat(data) { + var value, sign, base, digits; + + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + digits = []; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); + } + + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; + + } else if (value.indexOf(':') >= 0) { + value.split(':').forEach(function (v) { + digits.unshift(parseFloat(v, 10)); + }); + + value = 0.0; + base = 1; + + digits.forEach(function (d) { + value += d * base; + base *= 60; + }); + + return sign * value; + + } + return sign * parseFloat(value, 10); +} + + +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + +function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} + +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); + +},{"../common":2,"../type":13}],17:[function(require,module,exports){ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} + +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (data === null) return false; + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + // base 8 + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + // base 10 (except 0) or base 60 + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch === ':') break; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + // if !base60 - done; + if (ch !== ':') return true; + + // base60 almost not used, no needs to optimize + return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); +} + +function constructYamlInteger(data) { + var value = data, sign = 1, ch, base, digits = []; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } + + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value, 16); + return sign * parseInt(value, 8); + } + + if (value.indexOf(':') !== -1) { + value.split(':').forEach(function (v) { + digits.unshift(parseInt(v, 10)); + }); + + value = 0; + base = 1; + + digits.forEach(function (d) { + value += (d * base); + base *= 60; + }); + + return sign * value; + + } + + return sign * parseInt(value, 10); +} + +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); + +},{"../common":2,"../type":13}],18:[function(require,module,exports){ +'use strict'; + +var esprima; + +// Browserified version does not have esprima +// +// 1. For node.js just require module as deps +// 2. For browser try to require mudule via external AMD system. +// If not found - try to fallback to window.esprima. If not +// found too - then fail to parse. +// +try { + // workaround to exclude package from browserify list. + var _require = require; + esprima = _require('esprima'); +} catch (_) { + /* eslint-disable no-redeclare */ + /* global window */ + if (typeof window !== 'undefined') esprima = window.esprima; +} + +var Type = require('../../type'); + +function resolveJavascriptFunction(data) { + if (data === null) return false; + + try { + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }); + + if (ast.type !== 'Program' || + ast.body.length !== 1 || + ast.body[0].type !== 'ExpressionStatement' || + (ast.body[0].expression.type !== 'ArrowFunctionExpression' && + ast.body[0].expression.type !== 'FunctionExpression')) { + return false; + } + + return true; + } catch (err) { + return false; + } +} + +function constructJavascriptFunction(data) { + /*jslint evil:true*/ + + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }), + params = [], + body; + + if (ast.type !== 'Program' || + ast.body.length !== 1 || + ast.body[0].type !== 'ExpressionStatement' || + (ast.body[0].expression.type !== 'ArrowFunctionExpression' && + ast.body[0].expression.type !== 'FunctionExpression')) { + throw new Error('Failed to resolve function'); + } + + ast.body[0].expression.params.forEach(function (param) { + params.push(param.name); + }); + + body = ast.body[0].expression.body.range; + + // Esprima's ranges include the first '{' and the last '}' characters on + // function expressions. So cut them out. + if (ast.body[0].expression.body.type === 'BlockStatement') { + /*eslint-disable no-new-func*/ + return new Function(params, source.slice(body[0] + 1, body[1] - 1)); + } + // ES6 arrow functions can omit the BlockStatement. In that case, just return + // the body. + /*eslint-disable no-new-func*/ + return new Function(params, 'return ' + source.slice(body[0], body[1])); +} + +function representJavascriptFunction(object /*, style*/) { + return object.toString(); +} + +function isFunction(object) { + return Object.prototype.toString.call(object) === '[object Function]'; +} + +module.exports = new Type('tag:yaml.org,2002:js/function', { + kind: 'scalar', + resolve: resolveJavascriptFunction, + construct: constructJavascriptFunction, + predicate: isFunction, + represent: representJavascriptFunction +}); + +},{"../../type":13}],19:[function(require,module,exports){ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptRegExp(data) { + if (data === null) return false; + if (data.length === 0) return false; + + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // if regexp starts with '/' it can have modifiers and must be properly closed + // `/foo/gim` - modifiers tail can be maximum 3 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + + if (modifiers.length > 3) return false; + // if expression starts with /, is should be properly terminated + if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; + } + + return true; +} + +function constructJavascriptRegExp(data) { + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // `/foo/gim` - tail can be maximum 4 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } + + return new RegExp(regexp, modifiers); +} + +function representJavascriptRegExp(object /*, style*/) { + var result = '/' + object.source + '/'; + + if (object.global) result += 'g'; + if (object.multiline) result += 'm'; + if (object.ignoreCase) result += 'i'; + + return result; +} + +function isRegExp(object) { + return Object.prototype.toString.call(object) === '[object RegExp]'; +} + +module.exports = new Type('tag:yaml.org,2002:js/regexp', { + kind: 'scalar', + resolve: resolveJavascriptRegExp, + construct: constructJavascriptRegExp, + predicate: isRegExp, + represent: representJavascriptRegExp +}); + +},{"../../type":13}],20:[function(require,module,exports){ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptUndefined() { + return true; +} + +function constructJavascriptUndefined() { + /*eslint-disable no-undefined*/ + return undefined; +} + +function representJavascriptUndefined() { + return ''; +} + +function isUndefined(object) { + return typeof object === 'undefined'; +} + +module.exports = new Type('tag:yaml.org,2002:js/undefined', { + kind: 'scalar', + resolve: resolveJavascriptUndefined, + construct: constructJavascriptUndefined, + predicate: isUndefined, + represent: representJavascriptUndefined +}); + +},{"../../type":13}],21:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); + +},{"../type":13}],22:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} + +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); + +},{"../type":13}],23:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return object === null; +} + +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; } + }, + defaultStyle: 'lowercase' +}); + +},{"../type":13}],24:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; +} + +function constructYamlOmap(data) { + return data !== null ? data : []; +} + +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); + +},{"../type":13}],25:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +var _toString = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; +} + +function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; +} + +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); + +},{"../type":13}],26:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } +}); + +},{"../type":13}],27:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; +} + +function constructYamlSet(data) { + return data !== null ? data : {}; +} + +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); + +},{"../type":13}],28:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); + +},{"../type":13}],29:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + +function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; +} + +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (match === null) throw new Error('Date resolve error'); + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; +} + +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} + +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); + +},{"../type":13}],"/":[function(require,module,exports){ +'use strict'; + + +var yaml = require('./lib/js-yaml.js'); + + +module.exports = yaml; + +},{"./lib/js-yaml.js":1}]},{},[])("/") +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/dist/js-yaml.min.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/dist/js-yaml.min.js new file mode 100644 index 0000000..1b6ecc1 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/dist/js-yaml.min.js @@ -0,0 +1 @@ +/*! js-yaml 3.14.1 https://github.com/nodeca/js-yaml */!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jsyaml=e()}(function(){return function i(r,o,a){function s(t,e){if(!o[t]){if(!r[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(c)return c(t,!0);throw(n=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",n}n=o[t]={exports:{}},r[t][0].call(n.exports,function(e){return s(r[t][1][e]||e)},n,n.exports,i,r,o,a)}return o[t].exports}for(var c="function"==typeof require&&require,e=0;e=i.flowLevel;switch(V(r,n,i.indent,t,function(e){return function(e,t){for(var n=0,i=e.implicitTypes.length;n"+z(r,i.indent)+J(U(function(t,n){var e,i=/(\n+)([^\n]*)/g,r=function(){var e=-1!==(e=t.indexOf("\n"))?e:t.length;return i.lastIndex=e,Q(t.slice(0,e),n)}(),o="\n"===t[0]||" "===t[0];for(;e=i.exec(t);){var a=e[1],s=e[2];e=" "===s[0],r+=a+(o||e||""===s?"":"\n")+Q(s,n),o=e}return r}(r,t),e));case G:return'"'+function(e){for(var t,n,i,r="",o=0;ot&&o tag resolver accepts not "'+o+'" style');i=r.represent[o](t,o)}e.dump=i}return 1}}function ee(e,t,n,i,r,o){e.tag=null,e.dump=n,X(e,n,!1)||X(e,n,!0);var a=l.call(e.dump);i=i&&(e.flowLevel<0||e.flowLevel>t);var s,c,u="[object Object]"===a||"[object Array]"===a;if(u&&(c=-1!==(s=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&0 "+e.dump)}return 1}function te(e,t){var n,i,r=[],o=[];for(!function e(t,n,i){var r,o,a;if(null!==t&&"object"==typeof t)if(-1!==(o=n.indexOf(t)))-1===i.indexOf(o)&&i.push(o);else if(n.push(t),Array.isArray(t))for(o=0,a=t.length;o>10),56320+(c-65536&1023)),e.position++}else N(e,"unknown escape sequence");n=i=e.position}else S(u)?(L(e,n,i,!0),B(e,Y(e,!1,t)),n=i=e.position):e.position===e.lineStart&&R(e)?N(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}N(e,"unexpected end of the stream within a double quoted scalar")}}function K(e,t){var n,i,r=e.tag,o=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&45===i&&O(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,Y(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,P(e,t,x,!1,!0),a.push(e.result),Y(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)N(e,"bad indentation of a sequence entry");else if(e.lineIndentt?p=1:e.lineIndent===t?p=0:e.lineIndentt?p=1:e.lineIndent===t?p=0:e.lineIndentt)&&(P(e,t,A,!0,r)&&(m?d=e.result:h=e.result),m||(U(e,l,p,f,d,h,o,a),f=d=h=null),Y(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)N(e,"bad indentation of a mapping entry");else if(e.lineIndentc&&(c=e.lineIndent),S(p))u++;else{if(e.lineIndent=t){a=!0,f=e.input.charCodeAt(e.position);continue}e.position=o,e.line=s,e.lineStart=c,e.lineIndent=u;break}}a&&(L(e,r,o,!1),B(e,e.line-s),r=o=e.position,a=!1),I(f)||(o=e.position+1),f=e.input.charCodeAt(++e.position)}if(L(e,r,o,!1),e.result)return 1;e.kind=l,e.result=p}}(e,i,g===n)&&(d=!0,null===e.tag&&(e.tag="?")):(d=!0,null===e.tag&&null===e.anchor||N(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===p&&(d=s&&K(e,r))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&N(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,u=e.implicitTypes.length;c tag; it should be "'+l.kind+'", not "'+e.kind+'"'),l.resolve(e.result)?(e.result=l.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):N(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):N(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||d}function $(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new F(e,t),e=e.indexOf("\0");for(-1!==e&&(n.position=e,N(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.positiont/2-1){n=" ... ",i+=5;break}for(r="",o=this.position;ot/2-1){r=" ... ",o-=5;break}return a=this.buffer.slice(i,o),s.repeat(" ",e)+n+a+r+"\n"+s.repeat(" ",e+this.position-i+n.length)+"^"},i.prototype.toString=function(e){var t="";return this.name&&(t+='in "'+this.name+'" '),t+="at line "+(this.line+1)+", column "+(this.column+1),e||(e=this.getSnippet())&&(t+=":\n"+e),t},t.exports=i},{"./common":2}],7:[function(e,t,n){"use strict";var r=e("./common"),o=e("./exception"),a=e("./type");function s(e,t,i){var r=[];return e.include.forEach(function(e){i=s(e,t,i)}),e[t].forEach(function(n){i.forEach(function(e,t){e.tag===n.tag&&e.kind===n.kind&&r.push(t)}),i.push(n)}),i.filter(function(e,t){return-1===r.indexOf(t)})}function c(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new o("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=s(this,"implicit",[]),this.compiledExplicit=s(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{}};function i(e){n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e>16&255),o.push(r>>8&255),o.push(255&r)),r=r<<6|i.indexOf(t.charAt(a));return 0==(e=n%4*6)?(o.push(r>>16&255),o.push(r>>8&255),o.push(255&r)):18==e?(o.push(r>>10&255),o.push(r>>2&255)):12==e&&o.push(r>>4&255),s?s.from?s.from(o):new s(o):o},predicate:function(e){return s&&s.isBuffer(e)},represent:function(e){for(var t,n="",i=0,r=e.length,o=c,a=0;a>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[63&i]),i=(i<<8)+e[a];return 0==(t=r%3)?(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[63&i]):2==t?(n+=o[i>>10&63],n+=o[i>>4&63],n+=o[i<<2&63],n+=o[64]):1==t&&(n+=o[i>>2&63],n+=o[i<<4&63],n+=o[64],n+=o[64]),n}})},{"../type":13}],15:[function(e,t,n){"use strict";e=e("../type");t.exports=new e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},{"../type":13}],16:[function(e,t,n){"use strict";var i=e("../common"),e=e("../type"),r=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var o=/^[-+]?[0-9]+e/;t.exports=new e("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!r.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n=e.replace(/_/g,"").toLowerCase(),e="-"===n[0]?-1:1,i=[];return 0<="+-".indexOf(n[0])&&(n=n.slice(1)),".inf"===n?1==e?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===n?NaN:0<=n.indexOf(":")?(n.split(":").forEach(function(e){i.unshift(parseFloat(e,10))}),n=0,t=1,i.forEach(function(e){n+=e*t,t*=60}),e*n):e*parseFloat(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||i.isNegativeZero(e))},represent:function(e,t){if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(e))return"-0.0";return e=e.toString(10),o.test(e)?e.replace("e",".e"):e},defaultStyle:"lowercase"})},{"../common":2,"../type":13}],17:[function(e,t,n){"use strict";var i=e("../common"),e=e("../type");t.exports=new e("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i,r,o=e.length,a=0,s=!1;if(!o)return!1;if("-"!==(t=e[a])&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===o)return!0;if("b"===(t=e[++a])){for(a++;a */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; + +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; + +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; + +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (map === null) return {}; + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; +} + +function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; +} + +function State(options) { + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; +} + +// Indents every line in a string. Empty lines (\n only) are not indented. +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + + if (line.length && line !== '\n') result += ind; + + result += line; + } + + return result; +} + +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} + +function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; +} + +// [33] s-white ::= s-space | s-tab +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; +} + +// Returns true if the character can be printed without escaping. +// From YAML 1.2: "any allowed characters known to be non-printable +// should also be escaped. [However,] This isn’t mandatory" +// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. +function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) + || (0x10000 <= c && c <= 0x10FFFF); +} + +// [34] ns-char ::= nb-char - s-white +// [27] nb-char ::= c-printable - b-char - c-byte-order-mark +// [26] b-char ::= b-line-feed | b-carriage-return +// [24] b-line-feed ::= #xA /* LF */ +// [25] b-carriage-return ::= #xD /* CR */ +// [3] c-byte-order-mark ::= #xFEFF +function isNsChar(c) { + return isPrintable(c) && !isWhitespace(c) + // byte-order-mark + && c !== 0xFEFF + // b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} + +// Simplified test for values allowed after the first character in plain style. +function isPlainSafe(c, prev) { + // Uses a subset of nb-char - c-flow-indicator - ":" - "#" + // where nb-char ::= c-printable - b-char - c-byte-order-mark. + return isPrintable(c) && c !== 0xFEFF + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // - ":" - "#" + // /* An ns-char preceding */ "#" + && c !== CHAR_COLON + && ((c !== CHAR_SHARP) || (prev && isNsChar(prev))); +} + +// Simplified test for values allowed as the first character in plain style. +function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + return isPrintable(c) && c !== 0xFEFF + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; +} + +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); +} + +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; + +// Determines which scalar styles are possible and returns the preferred style. +// lineWidth = -1 => no limit. +// Pre-conditions: str.length > 0. +// Post-conditions: +// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. +// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). +// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { + var i; + var char, prev_char; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(string.charCodeAt(0)) + && !isWhitespace(string.charCodeAt(string.length - 1)); + + if (singleLineOnly) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + prev_char = i > 0 ? string.charCodeAt(i - 1) : null; + plain = plain && isPlainSafe(char, prev_char); + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + prev_char = i > 0 ? string.charCodeAt(i - 1) : null; + plain = plain && isPlainSafe(char, prev_char); + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + return plain && !testAmbiguousType(string) + ? STYLE_PLAIN : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; +} + +// Note: line breaking/folding is implemented for only the folded style. +// NB. We drop the last trailing newline (if any) of a returned block scalar +// since the dumper adds its own newline. This always works: +// • No ending newline => unaffected; already using strip "-" chomping. +// • Ending newline => removed then restored. +// Importantly, this keeps the "+" chomp indicator from gaining an extra line. +function writeScalar(state, string, level, iskey) { + state.dump = (function () { + if (string.length === 0) { + return "''"; + } + if (!state.noCompatMode && + DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { + return "'" + string + "'"; + } + + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } + + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string, lineWidth) + '"'; + default: + throw new YAMLException('impossible error: invalid scalar style'); + } + }()); +} + +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); + + return indentIndicator + chomp + '\n'; +} + +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +} + +// Note: a long line without a suitable break point will exceed the width limit. +// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. +function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; + + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; + + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; + } + + return result; +} + +// Greedy line breaking. +// Picks the longest line under the limit each time, +// otherwise settles for the shortest line over the limit. +// NB. More-indented lines *cannot* be folded, as that would add an extra \n. +function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; + + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; + + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } + + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } + + return result.slice(1); // drop extra \n joiner +} + +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char, nextChar; + var escapeSeq; + + for (var i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). + if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { + nextChar = string.charCodeAt(i + 1); + if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { + // Combine the surrogate pair and store it escaped. + result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); + // Advance index one extra since we already used that char here. + i++; continue; + } + } + escapeSeq = ESCAPE_SEQUENCES[char]; + result += !escapeSeq && isPrintable(char) + ? string[i] + : escapeSeq || encodeHex(char); + } + + return result; +} + +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level, object[index], false, false)) { + if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; +} + +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level + 1, object[index], true, true)) { + if (!compact || index !== 0) { + _result += generateNextLine(state, level); + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } + + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. +} + +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + + pairBuffer = ''; + if (index !== 0) pairBuffer += ', '; + + if (state.condenseFlow) pairBuffer += '"'; + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) pairBuffer += '? '; + + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; +} + +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new YAMLException('sortKeys must be a boolean or a function'); + } + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || index !== 0) { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} + +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + state.tag = explicit ? type.tag : '?'; + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; +} + +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } + + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level; + if (block && (state.dump.length !== 0)) { + writeBlockSequence(state, arrayLevel, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, arrayLevel, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey); + } + } else { + if (state.skipInvalid) return false; + throw new YAMLException('unacceptable kind of an object to dump ' + type); + } + + if (state.tag !== null && state.tag !== '?') { + state.dump = '!<' + state.tag + '> ' + state.dump; + } + } + + return true; +} + +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); +} + +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; + + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } +} + +function dump(input, options) { + options = options || {}; + + var state = new State(options); + + if (!state.noRefs) getDuplicateReferences(input, state); + + if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; + + return ''; +} + +function safeDump(input, options) { + return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + +module.exports.dump = dump; +module.exports.safeDump = safeDump; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/exception.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/exception.js new file mode 100644 index 0000000..b744a1e --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/exception.js @@ -0,0 +1,43 @@ +// YAML error class. http://stackoverflow.com/questions/8458984 +// +'use strict'; + +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); + + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); + + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; + } +} + + +// Inherit from Error +YAMLException.prototype = Object.create(Error.prototype); +YAMLException.prototype.constructor = YAMLException; + + +YAMLException.prototype.toString = function toString(compact) { + var result = this.name + ': '; + + result += this.reason || '(unknown reason)'; + + if (!compact && this.mark) { + result += ' ' + this.mark.toString(); + } + + return result; +}; + + +module.exports = YAMLException; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/loader.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/loader.js new file mode 100644 index 0000000..d7484a5 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/loader.js @@ -0,0 +1,1644 @@ +'use strict'; + +/*eslint-disable max-len,no-use-before-define*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var Mark = require('./mark'); +var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); +var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); + + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + + +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; + + +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; + + +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + +function _class(obj) { return Object.prototype.toString.call(obj); } + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} + +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} + +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} + +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; +} + +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; +} + +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); +} + +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} + + +function State(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.onWarning = options['onWarning'] || null; + this.legacy = options['legacy'] || false; + this.json = options['json'] || false; + this.listener = options['listener'] || null; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +function generateError(state, message) { + return new YAMLException( + message, + new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); +} + +function throwError(state, message) { + throw generateError(state, message); +} + +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } +} + + +var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } + + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + state.tagMap[handle] = prefix; + } +}; + + +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } + + state.result += _result; + } +} + +function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } +} + +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { + var index, quantity; + + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); + } + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; + } + } + } + + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } + + + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty.call(overridableKeys, keyNode) && + _hasOwnProperty.call(_result, keyNode)) { + state.line = startLine || state.line; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } + _result[keyNode] = valueNode; + delete overridableKeys[keyNode]; + } + + return _result; +} + +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; +} + +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; +} + +function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; +} + +function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} + + +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } + + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; +} + +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x27/* ' */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} + +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x22/* " */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} + +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = {}, + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); +} + +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } + + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; +} + +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + + if (ch !== 0x2D/* - */) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} + +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _pos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = {}, + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + _pos = state.position; + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else { + break; // Reading is done. Go to the epilogue. + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if (state.lineIndent > nodeIndent && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; +} + +function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; +} + +function readAlias(state) { + var _position, alias, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x2A/* * */) return false; + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!_hasOwnProperty.call(state.anchorMap, alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} + +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (state.tag === null) { + state.tag = '?'; + } + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (state.tag !== null && state.tag !== '!') { + if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } + + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; +} + +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = {}; + state.anchorMap = {}; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) break; + + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} + + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State(input, options); + + var nullpos = input.indexOf('\0'); + + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; +} + + +function loadAll(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + var documents = loadDocuments(input, options); + + if (typeof iterator !== 'function') { + return documents; + } + + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new YAMLException('expected a single document in the stream, but found more'); +} + + +function safeLoadAll(input, iterator, options) { + if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +function safeLoad(input, options) { + return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +module.exports.loadAll = loadAll; +module.exports.load = load; +module.exports.safeLoadAll = safeLoadAll; +module.exports.safeLoad = safeLoad; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/mark.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/mark.js new file mode 100644 index 0000000..47b265c --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/mark.js @@ -0,0 +1,76 @@ +'use strict'; + + +var common = require('./common'); + + +function Mark(name, buffer, position, line, column) { + this.name = name; + this.buffer = buffer; + this.position = position; + this.line = line; + this.column = column; +} + + +Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { + var head, start, tail, end, snippet; + + if (!this.buffer) return null; + + indent = indent || 4; + maxLength = maxLength || 75; + + head = ''; + start = this.position; + + while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { + start -= 1; + if (this.position - start > (maxLength / 2 - 1)) { + head = ' ... '; + start += 5; + break; + } + } + + tail = ''; + end = this.position; + + while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { + end += 1; + if (end - this.position > (maxLength / 2 - 1)) { + tail = ' ... '; + end -= 5; + break; + } + } + + snippet = this.buffer.slice(start, end); + + return common.repeat(' ', indent) + head + snippet + tail + '\n' + + common.repeat(' ', indent + this.position - start + head.length) + '^'; +}; + + +Mark.prototype.toString = function toString(compact) { + var snippet, where = ''; + + if (this.name) { + where += 'in "' + this.name + '" '; + } + + where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); + + if (!compact) { + snippet = this.getSnippet(); + + if (snippet) { + where += ':\n' + snippet; + } + } + + return where; +}; + + +module.exports = Mark; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema.js new file mode 100644 index 0000000..ca7cf47 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema.js @@ -0,0 +1,108 @@ +'use strict'; + +/*eslint-disable max-len*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var Type = require('./type'); + + +function compileList(schema, name, result) { + var exclude = []; + + schema.include.forEach(function (includedSchema) { + result = compileList(includedSchema, name, result); + }); + + schema[name].forEach(function (currentType) { + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { + exclude.push(previousIndex); + } + }); + + result.push(currentType); + }); + + return result.filter(function (type, index) { + return exclude.indexOf(index) === -1; + }); +} + + +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {} + }, index, length; + + function collectType(type) { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; +} + + +function Schema(definition) { + this.include = definition.include || []; + this.implicit = definition.implicit || []; + this.explicit = definition.explicit || []; + + this.implicit.forEach(function (type) { + if (type.loadKind && type.loadKind !== 'scalar') { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + }); + + this.compiledImplicit = compileList(this, 'implicit', []); + this.compiledExplicit = compileList(this, 'explicit', []); + this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); +} + + +Schema.DEFAULT = null; + + +Schema.create = function createSchema() { + var schemas, types; + + switch (arguments.length) { + case 1: + schemas = Schema.DEFAULT; + types = arguments[0]; + break; + + case 2: + schemas = arguments[0]; + types = arguments[1]; + break; + + default: + throw new YAMLException('Wrong number of arguments for Schema.create function'); + } + + schemas = common.toArray(schemas); + types = common.toArray(types); + + if (!schemas.every(function (schema) { return schema instanceof Schema; })) { + throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); + } + + if (!types.every(function (type) { return type instanceof Type; })) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + return new Schema({ + include: schemas, + explicit: types + }); +}; + + +module.exports = Schema; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/core.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/core.js new file mode 100644 index 0000000..206daab --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/core.js @@ -0,0 +1,18 @@ +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./json') + ] +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/default_full.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/default_full.js new file mode 100644 index 0000000..a55ef42 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/default_full.js @@ -0,0 +1,25 @@ +// JS-YAML's default schema for `load` function. +// It is not described in the YAML specification. +// +// This schema is based on JS-YAML's default safe schema and includes +// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. +// +// Also this schema is used as default base schema at `Schema.create` function. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = Schema.DEFAULT = new Schema({ + include: [ + require('./default_safe') + ], + explicit: [ + require('../type/js/undefined'), + require('../type/js/regexp'), + require('../type/js/function') + ] +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js new file mode 100644 index 0000000..11d89bb --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js @@ -0,0 +1,28 @@ +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./core') + ], + implicit: [ + require('../type/timestamp'), + require('../type/merge') + ], + explicit: [ + require('../type/binary'), + require('../type/omap'), + require('../type/pairs'), + require('../type/set') + ] +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js new file mode 100644 index 0000000..b7a33eb --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js @@ -0,0 +1,17 @@ +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + explicit: [ + require('../type/str'), + require('../type/seq'), + require('../type/map') + ] +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/json.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/json.js new file mode 100644 index 0000000..5be3dbf --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/schema/json.js @@ -0,0 +1,25 @@ +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./failsafe') + ], + implicit: [ + require('../type/null'), + require('../type/bool'), + require('../type/int'), + require('../type/float') + ] +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type.js new file mode 100644 index 0000000..90b702a --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type.js @@ -0,0 +1,61 @@ +'use strict'; + +var YAMLException = require('./exception'); + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +module.exports = Type; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/binary.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/binary.js new file mode 100644 index 0000000..10b1875 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/binary.js @@ -0,0 +1,138 @@ +'use strict'; + +/*eslint-disable no-bitwise*/ + +var NodeBuffer; + +try { + // A trick for browserified version, to not include `Buffer` shim + var _require = require; + NodeBuffer = _require('buffer').Buffer; +} catch (__) {} + +var Type = require('../type'); + + +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + +function resolveYamlBinary(data) { + if (data === null) return false; + + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) continue; + + // Fail on illegal characters + if (code < 0) return false; + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} + +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + // Wrap into Buffer for NodeJS and leave Array for browser + if (NodeBuffer) { + // Support node 6.+ Buffer API when available + return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); + } + + return result; +} + +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; +} + +function isBinary(object) { + return NodeBuffer && NodeBuffer.isBuffer(object); +} + +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/bool.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/bool.js new file mode 100644 index 0000000..cb77459 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/bool.js @@ -0,0 +1,35 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlBoolean(data) { + if (data === null) return false; + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} + +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/float.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/float.js new file mode 100644 index 0000000..127671b --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/float.js @@ -0,0 +1,116 @@ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // 20:59 + '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; +} + +function constructYamlFloat(data) { + var value, sign, base, digits; + + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + digits = []; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); + } + + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; + + } else if (value.indexOf(':') >= 0) { + value.split(':').forEach(function (v) { + digits.unshift(parseFloat(v, 10)); + }); + + value = 0.0; + base = 1; + + digits.forEach(function (d) { + value += d * base; + base *= 60; + }); + + return sign * value; + + } + return sign * parseFloat(value, 10); +} + + +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + +function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} + +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/int.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/int.js new file mode 100644 index 0000000..ba61c5f --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/int.js @@ -0,0 +1,173 @@ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} + +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (data === null) return false; + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + // base 8 + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + // base 10 (except 0) or base 60 + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch === ':') break; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + // if !base60 - done; + if (ch !== ':') return true; + + // base60 almost not used, no needs to optimize + return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); +} + +function constructYamlInteger(data) { + var value = data, sign = 1, ch, base, digits = []; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } + + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value, 16); + return sign * parseInt(value, 8); + } + + if (value.indexOf(':') !== -1) { + value.split(':').forEach(function (v) { + digits.unshift(parseInt(v, 10)); + }); + + value = 0; + base = 1; + + digits.forEach(function (d) { + value += (d * base); + base *= 60; + }); + + return sign * value; + + } + + return sign * parseInt(value, 10); +} + +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/js/function.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/js/function.js new file mode 100644 index 0000000..8fab8c4 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/js/function.js @@ -0,0 +1,93 @@ +'use strict'; + +var esprima; + +// Browserified version does not have esprima +// +// 1. For node.js just require module as deps +// 2. For browser try to require mudule via external AMD system. +// If not found - try to fallback to window.esprima. If not +// found too - then fail to parse. +// +try { + // workaround to exclude package from browserify list. + var _require = require; + esprima = _require('esprima'); +} catch (_) { + /* eslint-disable no-redeclare */ + /* global window */ + if (typeof window !== 'undefined') esprima = window.esprima; +} + +var Type = require('../../type'); + +function resolveJavascriptFunction(data) { + if (data === null) return false; + + try { + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }); + + if (ast.type !== 'Program' || + ast.body.length !== 1 || + ast.body[0].type !== 'ExpressionStatement' || + (ast.body[0].expression.type !== 'ArrowFunctionExpression' && + ast.body[0].expression.type !== 'FunctionExpression')) { + return false; + } + + return true; + } catch (err) { + return false; + } +} + +function constructJavascriptFunction(data) { + /*jslint evil:true*/ + + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }), + params = [], + body; + + if (ast.type !== 'Program' || + ast.body.length !== 1 || + ast.body[0].type !== 'ExpressionStatement' || + (ast.body[0].expression.type !== 'ArrowFunctionExpression' && + ast.body[0].expression.type !== 'FunctionExpression')) { + throw new Error('Failed to resolve function'); + } + + ast.body[0].expression.params.forEach(function (param) { + params.push(param.name); + }); + + body = ast.body[0].expression.body.range; + + // Esprima's ranges include the first '{' and the last '}' characters on + // function expressions. So cut them out. + if (ast.body[0].expression.body.type === 'BlockStatement') { + /*eslint-disable no-new-func*/ + return new Function(params, source.slice(body[0] + 1, body[1] - 1)); + } + // ES6 arrow functions can omit the BlockStatement. In that case, just return + // the body. + /*eslint-disable no-new-func*/ + return new Function(params, 'return ' + source.slice(body[0], body[1])); +} + +function representJavascriptFunction(object /*, style*/) { + return object.toString(); +} + +function isFunction(object) { + return Object.prototype.toString.call(object) === '[object Function]'; +} + +module.exports = new Type('tag:yaml.org,2002:js/function', { + kind: 'scalar', + resolve: resolveJavascriptFunction, + construct: constructJavascriptFunction, + predicate: isFunction, + represent: representJavascriptFunction +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js new file mode 100644 index 0000000..43fa470 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js @@ -0,0 +1,60 @@ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptRegExp(data) { + if (data === null) return false; + if (data.length === 0) return false; + + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // if regexp starts with '/' it can have modifiers and must be properly closed + // `/foo/gim` - modifiers tail can be maximum 3 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + + if (modifiers.length > 3) return false; + // if expression starts with /, is should be properly terminated + if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; + } + + return true; +} + +function constructJavascriptRegExp(data) { + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // `/foo/gim` - tail can be maximum 4 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } + + return new RegExp(regexp, modifiers); +} + +function representJavascriptRegExp(object /*, style*/) { + var result = '/' + object.source + '/'; + + if (object.global) result += 'g'; + if (object.multiline) result += 'm'; + if (object.ignoreCase) result += 'i'; + + return result; +} + +function isRegExp(object) { + return Object.prototype.toString.call(object) === '[object RegExp]'; +} + +module.exports = new Type('tag:yaml.org,2002:js/regexp', { + kind: 'scalar', + resolve: resolveJavascriptRegExp, + construct: constructJavascriptRegExp, + predicate: isRegExp, + represent: representJavascriptRegExp +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js new file mode 100644 index 0000000..95b5569 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js @@ -0,0 +1,28 @@ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptUndefined() { + return true; +} + +function constructJavascriptUndefined() { + /*eslint-disable no-undefined*/ + return undefined; +} + +function representJavascriptUndefined() { + return ''; +} + +function isUndefined(object) { + return typeof object === 'undefined'; +} + +module.exports = new Type('tag:yaml.org,2002:js/undefined', { + kind: 'scalar', + resolve: resolveJavascriptUndefined, + construct: constructJavascriptUndefined, + predicate: isUndefined, + represent: representJavascriptUndefined +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/map.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/map.js new file mode 100644 index 0000000..f327bee --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/map.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/merge.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/merge.js new file mode 100644 index 0000000..ae08a86 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/merge.js @@ -0,0 +1,12 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} + +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/null.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/null.js new file mode 100644 index 0000000..6874daa --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/null.js @@ -0,0 +1,34 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return object === null; +} + +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; } + }, + defaultStyle: 'lowercase' +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/omap.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/omap.js new file mode 100644 index 0000000..b2b5323 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/omap.js @@ -0,0 +1,44 @@ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; +} + +function constructYamlOmap(data) { + return data !== null ? data : []; +} + +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/pairs.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/pairs.js new file mode 100644 index 0000000..74b5240 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/pairs.js @@ -0,0 +1,53 @@ +'use strict'; + +var Type = require('../type'); + +var _toString = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; +} + +function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; +} + +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/seq.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/seq.js new file mode 100644 index 0000000..be8f77f --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/seq.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/set.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/set.js new file mode 100644 index 0000000..f885a32 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/set.js @@ -0,0 +1,29 @@ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; +} + +function constructYamlSet(data) { + return data !== null ? data : {}; +} + +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/str.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/str.js new file mode 100644 index 0000000..27acc10 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/str.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/timestamp.js b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/timestamp.js new file mode 100644 index 0000000..8fa9c58 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/lib/js-yaml/type/timestamp.js @@ -0,0 +1,88 @@ +'use strict'; + +var Type = require('../type'); + +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + +function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; +} + +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (match === null) throw new Error('Date resolve error'); + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; +} + +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} + +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/package.json b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/package.json new file mode 100644 index 0000000..0d23667 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/js-yaml/package.json @@ -0,0 +1,49 @@ +{ + "name": "js-yaml", + "version": "3.14.1", + "description": "YAML 1.2 parser and serializer", + "keywords": [ + "yaml", + "parser", + "serializer", + "pyyaml" + ], + "homepage": "https://github.com/nodeca/js-yaml", + "author": "Vladimir Zapparov ", + "contributors": [ + "Aleksey V Zapparov (http://www.ixti.net/)", + "Vitaly Puzrin (https://github.com/puzrin)", + "Martin Grenfell (http://got-ravings.blogspot.com)" + ], + "license": "MIT", + "repository": "nodeca/js-yaml", + "files": [ + "index.js", + "lib/", + "bin/", + "dist/" + ], + "bin": { + "js-yaml": "bin/js-yaml.js" + }, + "unpkg": "dist/js-yaml.min.js", + "jsdelivr": "dist/js-yaml.min.js", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "devDependencies": { + "ansi": "^0.3.1", + "benchmark": "^2.1.4", + "browserify": "^16.2.2", + "codemirror": "^5.13.4", + "eslint": "^7.0.0", + "fast-check": "^1.24.2", + "istanbul": "^0.4.5", + "mocha": "^7.1.2", + "uglify-js": "^3.0.1" + }, + "scripts": { + "test": "make test" + } +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/.eslintrc.json b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/.eslintrc.json new file mode 100644 index 0000000..41f516b --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/.eslintrc.json @@ -0,0 +1,31 @@ + +{ + "root": true, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "rules": { + "@typescript-eslint/naming-convention": [ + "warn", + { + "selector": "typeLike", + "format": [ + "PascalCase" + ] + } + ], + "@typescript-eslint/semi": "warn", + "curly": "warn", + "eqeqeq": "warn", + "no-throw-literal": "warn", + "semi": "off", + "no-unused-expressions": "warn", + "no-duplicate-imports": "warn", + "new-parens": "warn" + } +} \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/.mocharc.json b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/.mocharc.json new file mode 100644 index 0000000..0411c77 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/.mocharc.json @@ -0,0 +1,4 @@ +{ + "ui": "tdd", + "color": true +} \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/CHANGELOG.md b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/CHANGELOG.md new file mode 100644 index 0000000..f02198e --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/CHANGELOG.md @@ -0,0 +1,56 @@ +2.3.0 2020-07-03 +================== + * new API `ModificationOptions.isArrayInsertion`: If `JSONPath` refers to an index of an array and `isArrayInsertion` is `true`, then `modify` will insert a new item at that location instead of overwriting its contents. + * `ModificationOptions.formattingOptions` is now optional. If not set, newly inserted content will not be formatted. + + +2.2.0 2019-10-25 +================== + * added `ParseOptions.allowEmptyContent`. Default is `false`. + * new API `getNodeType`: Returns the type of a value returned by parse. + * `parse`: Fix issue with empty property name + +2.1.0 2019-03-29 +================== + * `JSONScanner` and `JSONVisitor` return lineNumber / character. + +2.0.0 2018-04-12 +================== + * renamed `Node.columnOffset` to `Node.colonOffset` + * new API `getNodePath`: Gets the JSON path of the given JSON DOM node + * new API `findNodeAtOffset`: Finds the most inner node at the given offset. If `includeRightBound` is set, also finds nodes that end at the given offset. + +1.0.3 2018-03-07 +================== + * provide ems modules + +1.0.2 2018-03-05 +================== + * added the `visit.onComment` API, reported when comments are allowed. + * added the `ParseErrorCode.InvalidCommentToken` enum value, reported when comments are disallowed. + +1.0.1 +================== + * added the `format` API: computes edits to format a JSON document. + * added the `modify` API: computes edits to insert, remove or replace a property or value in a JSON document. + * added the `allyEdits` API: applies edits to a document + +1.0.0 +================== + * remove nls dependency (remove `getParseErrorMessage`) + +0.4.2 / 2017-05-05 +================== + * added `ParseError.offset` & `ParseError.length` + +0.4.1 / 2017-04-02 +================== + * added `ParseOptions.allowTrailingComma` + +0.4.0 / 2017-02-23 +================== + * fix for `getLocation`. Now `getLocation` inside an object will always return a property from inside that property. Can be empty string if the object has no properties or if the offset is before a actual property `{ "a": { | }} will return location ['a', ' ']` + +0.3.0 / 2017-01-17 +================== + * Updating to typescript 2.0 \ No newline at end of file diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/LICENSE.md b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/LICENSE.md new file mode 100644 index 0000000..1c65de1 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Microsoft + +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/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/README.md b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/README.md new file mode 100644 index 0000000..33d6c12 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/README.md @@ -0,0 +1,309 @@ +# jsonc-parser +Scanner and parser for JSON with comments. + +[![npm Package](https://img.shields.io/npm/v/jsonc-parser.svg?style=flat-square)](https://www.npmjs.org/package/jsonc-parser) +[![NPM Downloads](https://img.shields.io/npm/dm/jsonc-parser.svg)](https://npmjs.org/package/jsonc-parser) +[![Build Status](https://travis-ci.org/Microsoft/node-jsonc-parser.svg?branch=master)](https://travis-ci.org/Microsoft/node-jsonc-parser) + +Why? +---- +JSONC is JSON with JavaScript style comments. This node module provides a scanner and fault tolerant parser that can process JSONC but is also useful for standard JSON. + - the *scanner* tokenizes the input string into tokens and token offsets + - the *visit* function implements a 'SAX' style parser with callbacks for the encountered properties and values. + - the *parseTree* function computes a hierarchical DOM with offsets representing the encountered properties and values. + - the *parse* function evaluates the JavaScript object represented by JSON string in a fault tolerant fashion. + - the *getLocation* API returns a location object that describes the property or value located at a given offset in a JSON document. + - the *findNodeAtLocation* API finds the node at a given location path in a JSON DOM. + - the *format* API computes edits to format a JSON document. + - the *modify* API computes edits to insert, remove or replace a property or value in a JSON document. + - the *applyEdits* API applies edits to a document. + +Installation +------------ + + npm install --save jsonc-parser + + +API +--- + +### Scanner: +```typescript + +/** + * Creates a JSON scanner on the given text. + * If ignoreTrivia is set, whitespaces or comments are ignored. + */ +export function createScanner(text:string, ignoreTrivia:boolean = false):JSONScanner; + +/** + * The scanner object, representing a JSON scanner at a position in the input string. + */ +export interface JSONScanner { + /** + * Sets the scan position to a new offset. A call to 'scan' is needed to get the first token. + */ + setPosition(pos: number): any; + /** + * Read the next token. Returns the token code. + */ + scan(): SyntaxKind; + /** + * Returns the current scan position, which is after the last read token. + */ + getPosition(): number; + /** + * Returns the last read token. + */ + getToken(): SyntaxKind; + /** + * Returns the last read token value. The value for strings is the decoded string content. For numbers its of type number, for boolean it's true or false. + */ + getTokenValue(): string; + /** + * The start offset of the last read token. + */ + getTokenOffset(): number; + /** + * The length of the last read token. + */ + getTokenLength(): number; + /** + * The zero-based start line number of the last read token. + */ + getTokenStartLine(): number; + /** + * The zero-based start character (column) of the last read token. + */ + getTokenStartCharacter(): number; + /** + * An error code of the last scan. + */ + getTokenError(): ScanError; +} +``` + +### Parser: +```typescript + +export interface ParseOptions { + disallowComments?: boolean; +} +/** + * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + * Therefore always check the errors list to find out if the input was valid. + */ +export declare function parse(text: string, errors?: {error: ParseErrorCode;}[], options?: ParseOptions): any; + +/** + * Parses the given text and invokes the visitor functions for each object, array and literal reached. + */ +export declare function visit(text: string, visitor: JSONVisitor, options?: ParseOptions): any; + +export interface JSONVisitor { + /** + * Invoked when an open brace is encountered and an object is started. The offset and length represent the location of the open brace. + */ + onObjectBegin?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a property is encountered. The offset and length represent the location of the property name. + */ + onObjectProperty?: (property: string, offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a closing brace is encountered and an object is completed. The offset and length represent the location of the closing brace. + */ + onObjectEnd?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when an open bracket is encountered. The offset and length represent the location of the open bracket. + */ + onArrayBegin?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a closing bracket is encountered. The offset and length represent the location of the closing bracket. + */ + onArrayEnd?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a literal value is encountered. The offset and length represent the location of the literal value. + */ + onLiteralValue?: (value: any, offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a comma or colon separator is encountered. The offset and length represent the location of the separator. + */ + onSeparator?: (character: string, offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * When comments are allowed, invoked when a line or block comment is encountered. The offset and length represent the location of the comment. + */ + onComment?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked on an error. + */ + onError?: (error: ParseErrorCode, offset: number, length: number, startLine: number, startCharacter: number) => void; +} + +/** + * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + */ +export declare function parseTree(text: string, errors?: ParseError[], options?: ParseOptions): Node; + +export declare type NodeType = "object" | "array" | "property" | "string" | "number" | "boolean" | "null"; +export interface Node { + type: NodeType; + value?: any; + offset: number; + length: number; + colonOffset?: number; + parent?: Node; + children?: Node[]; +} + +``` + +### Utilities: +```typescript +/** + * Takes JSON with JavaScript-style comments and remove + * them. Optionally replaces every none-newline character + * of comments with a replaceCharacter + */ +export declare function stripComments(text: string, replaceCh?: string): string; + +/** + * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index. + */ +export declare function getLocation(text: string, position: number): Location; + +export declare type Segment = string | number; +export interface Location { + /** + * The previous property key or literal value (string, number, boolean or null) or undefined. + */ + previousNode?: Node; + /** + * The path describing the location in the JSON document. The path consists of a sequence strings + * representing an object property or numbers for array indices. + */ + path: Segment[]; + /** + * Matches the locations path against a pattern consisting of strings (for properties) and numbers (for array indices). + * '*' will match a single segment, of any property name or index. + * '**' will match a sequece of segments or no segment, of any property name or index. + */ + matches: (patterns: Segment[]) => boolean; + /** + * If set, the location's offset is at a property key. + */ + isAtPropertyKey: boolean; +} + +/** + * Finds the node at the given path in a JSON DOM. + */ +export function findNodeAtLocation(root: Node, path: JSONPath): Node | undefined; + +/** + * Finds the most inner node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset. + */ +export function findNodeAtOffset(root: Node, offset: number, includeRightBound?: boolean) : Node | undefined; + +/** + * Gets the JSON path of the given JSON DOM node + */ +export function getNodePath(node: Node) : JSONPath; + +/** + * Evaluates the JavaScript object of the given JSON DOM node + */ +export function getNodeValue(node: Node): any; + +/** + * Computes the edits needed to format a JSON document. + * + * @param documentText The input text + * @param range The range to format or `undefined` to format the full content + * @param options The formatting options + * @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or + * removals of text segments. All offsets refer to the original state of the document. No two edits must change or remove the same range of + * text in the original document. However, multiple edits can have + * the same offset, for example multiple inserts, or an insert followed by a remove or replace. The order in the array defines which edit is applied first. + * To apply edits to an input, you can use `applyEdits` + */ +export function format(documentText: string, range: Range, options: FormattingOptions): Edit[]; + + +/** + * Computes the edits needed to modify a value in the JSON document. + * + * @param documentText The input text + * @param path The path of the value to change. The path represents either to the document root, a property or an array item. + * If the path points to an non-existing property or item, it will be created. + * @param value The new value for the specified property or item. If the value is undefined, + * the property or item will be removed. + * @param options Options + * @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or + * removals of text segments. All offsets refer to the original state of the document. No two edits must change or remove the same range of + * text in the original document. However, multiple edits can have + * the same offset, for example multiple inserts, or an insert followed by a remove or replace. The order in the array defines which edit is applied first. + * To apply edits to an input, you can use `applyEdits` + */ +export function modify(text: string, path: JSONPath, value: any, options: ModificationOptions): Edit[]; + +/** + * Applies edits to a input string. + */ +export function applyEdits(text: string, edits: Edit[]): string; + +/** + * Represents a text modification + */ +export interface Edit { + /** + * The start offset of the modification. + */ + offset: number; + /** + * The length of the modification. Must not be negative. Empty length represents an *insert*. + */ + length: number; + /** + * The new content. Empty content represents a *remove*. + */ + content: string; +} + +/** + * A text range in the document +*/ +export interface Range { + /** + * The start offset of the range. + */ + offset: number; + /** + * The length of the range. Must not be negative. + */ + length: number; +} + +export interface FormattingOptions { + /** + * If indentation is based on spaces (`insertSpaces` = true), then what is the number of spaces that make an indent? + */ + tabSize: number; + /** + * Is indentation based on spaces? + */ + insertSpaces: boolean; + /** + * The default 'end of line' character + */ + eol: string; +} + +``` + + +License +------- + +(MIT License) + +Copyright 2018, Microsoft diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/edit.js b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/edit.js new file mode 100644 index 0000000..cb302bc --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/edit.js @@ -0,0 +1,186 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; +import { format, isEOL } from './format'; +import { parseTree, findNodeAtLocation } from './parser'; +export function removeProperty(text, path, options) { + return setProperty(text, path, void 0, options); +} +export function setProperty(text, originalPath, value, options) { + var _a; + var path = originalPath.slice(); + var errors = []; + var root = parseTree(text, errors); + var parent = void 0; + var lastSegment = void 0; + while (path.length > 0) { + lastSegment = path.pop(); + parent = findNodeAtLocation(root, path); + if (parent === void 0 && value !== void 0) { + if (typeof lastSegment === 'string') { + value = (_a = {}, _a[lastSegment] = value, _a); + } + else { + value = [value]; + } + } + else { + break; + } + } + if (!parent) { + // empty document + if (value === void 0) { // delete + throw new Error('Can not delete in empty document'); + } + return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, options); + } + else if (parent.type === 'object' && typeof lastSegment === 'string' && Array.isArray(parent.children)) { + var existing = findNodeAtLocation(parent, [lastSegment]); + if (existing !== void 0) { + if (value === void 0) { // delete + if (!existing.parent) { + throw new Error('Malformed AST'); + } + var propertyIndex = parent.children.indexOf(existing.parent); + var removeBegin = void 0; + var removeEnd = existing.parent.offset + existing.parent.length; + if (propertyIndex > 0) { + // remove the comma of the previous node + var previous = parent.children[propertyIndex - 1]; + removeBegin = previous.offset + previous.length; + } + else { + removeBegin = parent.offset + 1; + if (parent.children.length > 1) { + // remove the comma of the next node + var next = parent.children[1]; + removeEnd = next.offset; + } + } + return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: '' }, options); + } + else { + // set value of existing property + return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, options); + } + } + else { + if (value === void 0) { // delete + return []; // property does not exist, nothing to do + } + var newProperty = JSON.stringify(lastSegment) + ": " + JSON.stringify(value); + var index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map(function (p) { return p.children[0].value; })) : parent.children.length; + var edit = void 0; + if (index > 0) { + var previous = parent.children[index - 1]; + edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty }; + } + else if (parent.children.length === 0) { + edit = { offset: parent.offset + 1, length: 0, content: newProperty }; + } + else { + edit = { offset: parent.offset + 1, length: 0, content: newProperty + ',' }; + } + return withFormatting(text, edit, options); + } + } + else if (parent.type === 'array' && typeof lastSegment === 'number' && Array.isArray(parent.children)) { + var insertIndex = lastSegment; + if (insertIndex === -1) { + // Insert + var newProperty = "" + JSON.stringify(value); + var edit = void 0; + if (parent.children.length === 0) { + edit = { offset: parent.offset + 1, length: 0, content: newProperty }; + } + else { + var previous = parent.children[parent.children.length - 1]; + edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty }; + } + return withFormatting(text, edit, options); + } + else if (value === void 0 && parent.children.length >= 0) { + // Removal + var removalIndex = lastSegment; + var toRemove = parent.children[removalIndex]; + var edit = void 0; + if (parent.children.length === 1) { + // only item + edit = { offset: parent.offset + 1, length: parent.length - 2, content: '' }; + } + else if (parent.children.length - 1 === removalIndex) { + // last item + var previous = parent.children[removalIndex - 1]; + var offset = previous.offset + previous.length; + var parentEndOffset = parent.offset + parent.length; + edit = { offset: offset, length: parentEndOffset - 2 - offset, content: '' }; + } + else { + edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: '' }; + } + return withFormatting(text, edit, options); + } + else if (value !== void 0) { + var edit = void 0; + var newProperty = "" + JSON.stringify(value); + if (!options.isArrayInsertion && parent.children.length > lastSegment) { + var toModify = parent.children[lastSegment]; + edit = { offset: toModify.offset, length: toModify.length, content: newProperty }; + } + else if (parent.children.length === 0 || lastSegment === 0) { + edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + ',' }; + } + else { + var index = lastSegment > parent.children.length ? parent.children.length : lastSegment; + var previous = parent.children[index - 1]; + edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty }; + } + return withFormatting(text, edit, options); + } + else { + throw new Error("Can not " + (value === void 0 ? 'remove' : (options.isArrayInsertion ? 'insert' : 'modify')) + " Array index " + insertIndex + " as length is not sufficient"); + } + } + else { + throw new Error("Can not add " + (typeof lastSegment !== 'number' ? 'index' : 'property') + " to parent of type " + parent.type); + } +} +function withFormatting(text, edit, options) { + if (!options.formattingOptions) { + return [edit]; + } + // apply the edit + var newText = applyEdit(text, edit); + // format the new text + var begin = edit.offset; + var end = edit.offset + edit.content.length; + if (edit.length === 0 || edit.content.length === 0) { // insert or remove + while (begin > 0 && !isEOL(newText, begin - 1)) { + begin--; + } + while (end < newText.length && !isEOL(newText, end)) { + end++; + } + } + var edits = format(newText, { offset: begin, length: end - begin }, options.formattingOptions); + // apply the formatting edits and track the begin and end offsets of the changes + for (var i = edits.length - 1; i >= 0; i--) { + var edit_1 = edits[i]; + newText = applyEdit(newText, edit_1); + begin = Math.min(begin, edit_1.offset); + end = Math.max(end, edit_1.offset + edit_1.length); + end += edit_1.content.length - edit_1.length; + } + // create a single edit with all changes + var editLength = text.length - (newText.length - end) - begin; + return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }]; +} +export function applyEdit(text, edit) { + return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length); +} +export function isWS(text, offset) { + return '\r\n \t'.indexOf(text.charAt(offset)) !== -1; +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/format.js b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/format.js new file mode 100644 index 0000000..2a5a456 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/format.js @@ -0,0 +1,194 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; +import { createScanner } from './scanner'; +export function format(documentText, range, options) { + var initialIndentLevel; + var formatText; + var formatTextStart; + var rangeStart; + var rangeEnd; + if (range) { + rangeStart = range.offset; + rangeEnd = rangeStart + range.length; + formatTextStart = rangeStart; + while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) { + formatTextStart--; + } + var endOffset = rangeEnd; + while (endOffset < documentText.length && !isEOL(documentText, endOffset)) { + endOffset++; + } + formatText = documentText.substring(formatTextStart, endOffset); + initialIndentLevel = computeIndentLevel(formatText, options); + } + else { + formatText = documentText; + initialIndentLevel = 0; + formatTextStart = 0; + rangeStart = 0; + rangeEnd = documentText.length; + } + var eol = getEOL(options, documentText); + var lineBreak = false; + var indentLevel = 0; + var indentValue; + if (options.insertSpaces) { + indentValue = repeat(' ', options.tabSize || 4); + } + else { + indentValue = '\t'; + } + var scanner = createScanner(formatText, false); + var hasError = false; + function newLineAndIndent() { + return eol + repeat(indentValue, initialIndentLevel + indentLevel); + } + function scanNext() { + var token = scanner.scan(); + lineBreak = false; + while (token === 15 /* Trivia */ || token === 14 /* LineBreakTrivia */) { + lineBreak = lineBreak || (token === 14 /* LineBreakTrivia */); + token = scanner.scan(); + } + hasError = token === 16 /* Unknown */ || scanner.getTokenError() !== 0 /* None */; + return token; + } + var editOperations = []; + function addEdit(text, startOffset, endOffset) { + if (!hasError && startOffset < rangeEnd && endOffset > rangeStart && documentText.substring(startOffset, endOffset) !== text) { + editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text }); + } + } + var firstToken = scanNext(); + if (firstToken !== 17 /* EOF */) { + var firstTokenStart = scanner.getTokenOffset() + formatTextStart; + var initialIndent = repeat(indentValue, initialIndentLevel); + addEdit(initialIndent, formatTextStart, firstTokenStart); + } + while (firstToken !== 17 /* EOF */) { + var firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart; + var secondToken = scanNext(); + var replaceContent = ''; + while (!lineBreak && (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */)) { + // comments on the same line: keep them on the same line, but ignore them otherwise + var commentTokenStart = scanner.getTokenOffset() + formatTextStart; + addEdit(' ', firstTokenEnd, commentTokenStart); + firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart; + replaceContent = secondToken === 12 /* LineCommentTrivia */ ? newLineAndIndent() : ''; + secondToken = scanNext(); + } + if (secondToken === 2 /* CloseBraceToken */) { + if (firstToken !== 1 /* OpenBraceToken */) { + indentLevel--; + replaceContent = newLineAndIndent(); + } + } + else if (secondToken === 4 /* CloseBracketToken */) { + if (firstToken !== 3 /* OpenBracketToken */) { + indentLevel--; + replaceContent = newLineAndIndent(); + } + } + else { + switch (firstToken) { + case 3 /* OpenBracketToken */: + case 1 /* OpenBraceToken */: + indentLevel++; + replaceContent = newLineAndIndent(); + break; + case 5 /* CommaToken */: + case 12 /* LineCommentTrivia */: + replaceContent = newLineAndIndent(); + break; + case 13 /* BlockCommentTrivia */: + if (lineBreak) { + replaceContent = newLineAndIndent(); + } + else { + // symbol following comment on the same line: keep on same line, separate with ' ' + replaceContent = ' '; + } + break; + case 6 /* ColonToken */: + replaceContent = ' '; + break; + case 10 /* StringLiteral */: + if (secondToken === 6 /* ColonToken */) { + replaceContent = ''; + break; + } + // fall through + case 7 /* NullKeyword */: + case 8 /* TrueKeyword */: + case 9 /* FalseKeyword */: + case 11 /* NumericLiteral */: + case 2 /* CloseBraceToken */: + case 4 /* CloseBracketToken */: + if (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */) { + replaceContent = ' '; + } + else if (secondToken !== 5 /* CommaToken */ && secondToken !== 17 /* EOF */) { + hasError = true; + } + break; + case 16 /* Unknown */: + hasError = true; + break; + } + if (lineBreak && (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */)) { + replaceContent = newLineAndIndent(); + } + } + var secondTokenStart = scanner.getTokenOffset() + formatTextStart; + addEdit(replaceContent, firstTokenEnd, secondTokenStart); + firstToken = secondToken; + } + return editOperations; +} +function repeat(s, count) { + var result = ''; + for (var i = 0; i < count; i++) { + result += s; + } + return result; +} +function computeIndentLevel(content, options) { + var i = 0; + var nChars = 0; + var tabSize = options.tabSize || 4; + while (i < content.length) { + var ch = content.charAt(i); + if (ch === ' ') { + nChars++; + } + else if (ch === '\t') { + nChars += tabSize; + } + else { + break; + } + i++; + } + return Math.floor(nChars / tabSize); +} +function getEOL(options, text) { + for (var i = 0; i < text.length; i++) { + var ch = text.charAt(i); + if (ch === '\r') { + if (i + 1 < text.length && text.charAt(i + 1) === '\n') { + return '\r\n'; + } + return '\r'; + } + else if (ch === '\n') { + return '\n'; + } + } + return (options && options.eol) || '\n'; +} +export function isEOL(text, offset) { + return '\r\n'.indexOf(text.charAt(offset)) !== -1; +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/parser.js b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/parser.js new file mode 100644 index 0000000..ff8aa5a --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/parser.js @@ -0,0 +1,621 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; +import { createScanner } from './scanner'; +var ParseOptions; +(function (ParseOptions) { + ParseOptions.DEFAULT = { + allowTrailingComma: false + }; +})(ParseOptions || (ParseOptions = {})); +/** + * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index. + */ +export function getLocation(text, position) { + var segments = []; // strings or numbers + var earlyReturnException = new Object(); + var previousNode = undefined; + var previousNodeInst = { + value: {}, + offset: 0, + length: 0, + type: 'object', + parent: undefined + }; + var isAtPropertyKey = false; + function setPreviousNode(value, offset, length, type) { + previousNodeInst.value = value; + previousNodeInst.offset = offset; + previousNodeInst.length = length; + previousNodeInst.type = type; + previousNodeInst.colonOffset = undefined; + previousNode = previousNodeInst; + } + try { + visit(text, { + onObjectBegin: function (offset, length) { + if (position <= offset) { + throw earlyReturnException; + } + previousNode = undefined; + isAtPropertyKey = position > offset; + segments.push(''); // push a placeholder (will be replaced) + }, + onObjectProperty: function (name, offset, length) { + if (position < offset) { + throw earlyReturnException; + } + setPreviousNode(name, offset, length, 'property'); + segments[segments.length - 1] = name; + if (position <= offset + length) { + throw earlyReturnException; + } + }, + onObjectEnd: function (offset, length) { + if (position <= offset) { + throw earlyReturnException; + } + previousNode = undefined; + segments.pop(); + }, + onArrayBegin: function (offset, length) { + if (position <= offset) { + throw earlyReturnException; + } + previousNode = undefined; + segments.push(0); + }, + onArrayEnd: function (offset, length) { + if (position <= offset) { + throw earlyReturnException; + } + previousNode = undefined; + segments.pop(); + }, + onLiteralValue: function (value, offset, length) { + if (position < offset) { + throw earlyReturnException; + } + setPreviousNode(value, offset, length, getNodeType(value)); + if (position <= offset + length) { + throw earlyReturnException; + } + }, + onSeparator: function (sep, offset, length) { + if (position <= offset) { + throw earlyReturnException; + } + if (sep === ':' && previousNode && previousNode.type === 'property') { + previousNode.colonOffset = offset; + isAtPropertyKey = false; + previousNode = undefined; + } + else if (sep === ',') { + var last = segments[segments.length - 1]; + if (typeof last === 'number') { + segments[segments.length - 1] = last + 1; + } + else { + isAtPropertyKey = true; + segments[segments.length - 1] = ''; + } + previousNode = undefined; + } + } + }); + } + catch (e) { + if (e !== earlyReturnException) { + throw e; + } + } + return { + path: segments, + previousNode: previousNode, + isAtPropertyKey: isAtPropertyKey, + matches: function (pattern) { + var k = 0; + for (var i = 0; k < pattern.length && i < segments.length; i++) { + if (pattern[k] === segments[i] || pattern[k] === '*') { + k++; + } + else if (pattern[k] !== '**') { + return false; + } + } + return k === pattern.length; + } + }; +} +/** + * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + * Therefore always check the errors list to find out if the input was valid. + */ +export function parse(text, errors, options) { + if (errors === void 0) { errors = []; } + if (options === void 0) { options = ParseOptions.DEFAULT; } + var currentProperty = null; + var currentParent = []; + var previousParents = []; + function onValue(value) { + if (Array.isArray(currentParent)) { + currentParent.push(value); + } + else if (currentProperty !== null) { + currentParent[currentProperty] = value; + } + } + var visitor = { + onObjectBegin: function () { + var object = {}; + onValue(object); + previousParents.push(currentParent); + currentParent = object; + currentProperty = null; + }, + onObjectProperty: function (name) { + currentProperty = name; + }, + onObjectEnd: function () { + currentParent = previousParents.pop(); + }, + onArrayBegin: function () { + var array = []; + onValue(array); + previousParents.push(currentParent); + currentParent = array; + currentProperty = null; + }, + onArrayEnd: function () { + currentParent = previousParents.pop(); + }, + onLiteralValue: onValue, + onError: function (error, offset, length) { + errors.push({ error: error, offset: offset, length: length }); + } + }; + visit(text, visitor, options); + return currentParent[0]; +} +/** + * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + */ +export function parseTree(text, errors, options) { + if (errors === void 0) { errors = []; } + if (options === void 0) { options = ParseOptions.DEFAULT; } + var currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: undefined }; // artificial root + function ensurePropertyComplete(endOffset) { + if (currentParent.type === 'property') { + currentParent.length = endOffset - currentParent.offset; + currentParent = currentParent.parent; + } + } + function onValue(valueNode) { + currentParent.children.push(valueNode); + return valueNode; + } + var visitor = { + onObjectBegin: function (offset) { + currentParent = onValue({ type: 'object', offset: offset, length: -1, parent: currentParent, children: [] }); + }, + onObjectProperty: function (name, offset, length) { + currentParent = onValue({ type: 'property', offset: offset, length: -1, parent: currentParent, children: [] }); + currentParent.children.push({ type: 'string', value: name, offset: offset, length: length, parent: currentParent }); + }, + onObjectEnd: function (offset, length) { + ensurePropertyComplete(offset + length); // in case of a missing value for a property: make sure property is complete + currentParent.length = offset + length - currentParent.offset; + currentParent = currentParent.parent; + ensurePropertyComplete(offset + length); + }, + onArrayBegin: function (offset, length) { + currentParent = onValue({ type: 'array', offset: offset, length: -1, parent: currentParent, children: [] }); + }, + onArrayEnd: function (offset, length) { + currentParent.length = offset + length - currentParent.offset; + currentParent = currentParent.parent; + ensurePropertyComplete(offset + length); + }, + onLiteralValue: function (value, offset, length) { + onValue({ type: getNodeType(value), offset: offset, length: length, parent: currentParent, value: value }); + ensurePropertyComplete(offset + length); + }, + onSeparator: function (sep, offset, length) { + if (currentParent.type === 'property') { + if (sep === ':') { + currentParent.colonOffset = offset; + } + else if (sep === ',') { + ensurePropertyComplete(offset); + } + } + }, + onError: function (error, offset, length) { + errors.push({ error: error, offset: offset, length: length }); + } + }; + visit(text, visitor, options); + var result = currentParent.children[0]; + if (result) { + delete result.parent; + } + return result; +} +/** + * Finds the node at the given path in a JSON DOM. + */ +export function findNodeAtLocation(root, path) { + if (!root) { + return undefined; + } + var node = root; + for (var _i = 0, path_1 = path; _i < path_1.length; _i++) { + var segment = path_1[_i]; + if (typeof segment === 'string') { + if (node.type !== 'object' || !Array.isArray(node.children)) { + return undefined; + } + var found = false; + for (var _a = 0, _b = node.children; _a < _b.length; _a++) { + var propertyNode = _b[_a]; + if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment) { + node = propertyNode.children[1]; + found = true; + break; + } + } + if (!found) { + return undefined; + } + } + else { + var index = segment; + if (node.type !== 'array' || index < 0 || !Array.isArray(node.children) || index >= node.children.length) { + return undefined; + } + node = node.children[index]; + } + } + return node; +} +/** + * Gets the JSON path of the given JSON DOM node + */ +export function getNodePath(node) { + if (!node.parent || !node.parent.children) { + return []; + } + var path = getNodePath(node.parent); + if (node.parent.type === 'property') { + var key = node.parent.children[0].value; + path.push(key); + } + else if (node.parent.type === 'array') { + var index = node.parent.children.indexOf(node); + if (index !== -1) { + path.push(index); + } + } + return path; +} +/** + * Evaluates the JavaScript object of the given JSON DOM node + */ +export function getNodeValue(node) { + switch (node.type) { + case 'array': + return node.children.map(getNodeValue); + case 'object': + var obj = Object.create(null); + for (var _i = 0, _a = node.children; _i < _a.length; _i++) { + var prop = _a[_i]; + var valueNode = prop.children[1]; + if (valueNode) { + obj[prop.children[0].value] = getNodeValue(valueNode); + } + } + return obj; + case 'null': + case 'string': + case 'number': + case 'boolean': + return node.value; + default: + return undefined; + } +} +export function contains(node, offset, includeRightBound) { + if (includeRightBound === void 0) { includeRightBound = false; } + return (offset >= node.offset && offset < (node.offset + node.length)) || includeRightBound && (offset === (node.offset + node.length)); +} +/** + * Finds the most inner node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset. + */ +export function findNodeAtOffset(node, offset, includeRightBound) { + if (includeRightBound === void 0) { includeRightBound = false; } + if (contains(node, offset, includeRightBound)) { + var children = node.children; + if (Array.isArray(children)) { + for (var i = 0; i < children.length && children[i].offset <= offset; i++) { + var item = findNodeAtOffset(children[i], offset, includeRightBound); + if (item) { + return item; + } + } + } + return node; + } + return undefined; +} +/** + * Parses the given text and invokes the visitor functions for each object, array and literal reached. + */ +export function visit(text, visitor, options) { + if (options === void 0) { options = ParseOptions.DEFAULT; } + var _scanner = createScanner(text, false); + function toNoArgVisit(visitFunction) { + return visitFunction ? function () { return visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()); } : function () { return true; }; + } + function toOneArgVisit(visitFunction) { + return visitFunction ? function (arg) { return visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()); } : function () { return true; }; + } + var onObjectBegin = toNoArgVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisit(visitor.onObjectProperty), onObjectEnd = toNoArgVisit(visitor.onObjectEnd), onArrayBegin = toNoArgVisit(visitor.onArrayBegin), onArrayEnd = toNoArgVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisit(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError); + var disallowComments = options && options.disallowComments; + var allowTrailingComma = options && options.allowTrailingComma; + function scanNext() { + while (true) { + var token = _scanner.scan(); + switch (_scanner.getTokenError()) { + case 4 /* InvalidUnicode */: + handleError(14 /* InvalidUnicode */); + break; + case 5 /* InvalidEscapeCharacter */: + handleError(15 /* InvalidEscapeCharacter */); + break; + case 3 /* UnexpectedEndOfNumber */: + handleError(13 /* UnexpectedEndOfNumber */); + break; + case 1 /* UnexpectedEndOfComment */: + if (!disallowComments) { + handleError(11 /* UnexpectedEndOfComment */); + } + break; + case 2 /* UnexpectedEndOfString */: + handleError(12 /* UnexpectedEndOfString */); + break; + case 6 /* InvalidCharacter */: + handleError(16 /* InvalidCharacter */); + break; + } + switch (token) { + case 12 /* LineCommentTrivia */: + case 13 /* BlockCommentTrivia */: + if (disallowComments) { + handleError(10 /* InvalidCommentToken */); + } + else { + onComment(); + } + break; + case 16 /* Unknown */: + handleError(1 /* InvalidSymbol */); + break; + case 15 /* Trivia */: + case 14 /* LineBreakTrivia */: + break; + default: + return token; + } + } + } + function handleError(error, skipUntilAfter, skipUntil) { + if (skipUntilAfter === void 0) { skipUntilAfter = []; } + if (skipUntil === void 0) { skipUntil = []; } + onError(error); + if (skipUntilAfter.length + skipUntil.length > 0) { + var token = _scanner.getToken(); + while (token !== 17 /* EOF */) { + if (skipUntilAfter.indexOf(token) !== -1) { + scanNext(); + break; + } + else if (skipUntil.indexOf(token) !== -1) { + break; + } + token = scanNext(); + } + } + } + function parseString(isValue) { + var value = _scanner.getTokenValue(); + if (isValue) { + onLiteralValue(value); + } + else { + onObjectProperty(value); + } + scanNext(); + return true; + } + function parseLiteral() { + switch (_scanner.getToken()) { + case 11 /* NumericLiteral */: + var tokenValue = _scanner.getTokenValue(); + var value = Number(tokenValue); + if (isNaN(value)) { + handleError(2 /* InvalidNumberFormat */); + value = 0; + } + onLiteralValue(value); + break; + case 7 /* NullKeyword */: + onLiteralValue(null); + break; + case 8 /* TrueKeyword */: + onLiteralValue(true); + break; + case 9 /* FalseKeyword */: + onLiteralValue(false); + break; + default: + return false; + } + scanNext(); + return true; + } + function parseProperty() { + if (_scanner.getToken() !== 10 /* StringLiteral */) { + handleError(3 /* PropertyNameExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]); + return false; + } + parseString(false); + if (_scanner.getToken() === 6 /* ColonToken */) { + onSeparator(':'); + scanNext(); // consume colon + if (!parseValue()) { + handleError(4 /* ValueExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]); + } + } + else { + handleError(5 /* ColonExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]); + } + return true; + } + function parseObject() { + onObjectBegin(); + scanNext(); // consume open brace + var needsComma = false; + while (_scanner.getToken() !== 2 /* CloseBraceToken */ && _scanner.getToken() !== 17 /* EOF */) { + if (_scanner.getToken() === 5 /* CommaToken */) { + if (!needsComma) { + handleError(4 /* ValueExpected */, [], []); + } + onSeparator(','); + scanNext(); // consume comma + if (_scanner.getToken() === 2 /* CloseBraceToken */ && allowTrailingComma) { + break; + } + } + else if (needsComma) { + handleError(6 /* CommaExpected */, [], []); + } + if (!parseProperty()) { + handleError(4 /* ValueExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]); + } + needsComma = true; + } + onObjectEnd(); + if (_scanner.getToken() !== 2 /* CloseBraceToken */) { + handleError(7 /* CloseBraceExpected */, [2 /* CloseBraceToken */], []); + } + else { + scanNext(); // consume close brace + } + return true; + } + function parseArray() { + onArrayBegin(); + scanNext(); // consume open bracket + var needsComma = false; + while (_scanner.getToken() !== 4 /* CloseBracketToken */ && _scanner.getToken() !== 17 /* EOF */) { + if (_scanner.getToken() === 5 /* CommaToken */) { + if (!needsComma) { + handleError(4 /* ValueExpected */, [], []); + } + onSeparator(','); + scanNext(); // consume comma + if (_scanner.getToken() === 4 /* CloseBracketToken */ && allowTrailingComma) { + break; + } + } + else if (needsComma) { + handleError(6 /* CommaExpected */, [], []); + } + if (!parseValue()) { + handleError(4 /* ValueExpected */, [], [4 /* CloseBracketToken */, 5 /* CommaToken */]); + } + needsComma = true; + } + onArrayEnd(); + if (_scanner.getToken() !== 4 /* CloseBracketToken */) { + handleError(8 /* CloseBracketExpected */, [4 /* CloseBracketToken */], []); + } + else { + scanNext(); // consume close bracket + } + return true; + } + function parseValue() { + switch (_scanner.getToken()) { + case 3 /* OpenBracketToken */: + return parseArray(); + case 1 /* OpenBraceToken */: + return parseObject(); + case 10 /* StringLiteral */: + return parseString(true); + default: + return parseLiteral(); + } + } + scanNext(); + if (_scanner.getToken() === 17 /* EOF */) { + if (options.allowEmptyContent) { + return true; + } + handleError(4 /* ValueExpected */, [], []); + return false; + } + if (!parseValue()) { + handleError(4 /* ValueExpected */, [], []); + return false; + } + if (_scanner.getToken() !== 17 /* EOF */) { + handleError(9 /* EndOfFileExpected */, [], []); + } + return true; +} +/** + * Takes JSON with JavaScript-style comments and remove + * them. Optionally replaces every none-newline character + * of comments with a replaceCharacter + */ +export function stripComments(text, replaceCh) { + var _scanner = createScanner(text), parts = [], kind, offset = 0, pos; + do { + pos = _scanner.getPosition(); + kind = _scanner.scan(); + switch (kind) { + case 12 /* LineCommentTrivia */: + case 13 /* BlockCommentTrivia */: + case 17 /* EOF */: + if (offset !== pos) { + parts.push(text.substring(offset, pos)); + } + if (replaceCh !== undefined) { + parts.push(_scanner.getTokenValue().replace(/[^\r\n]/g, replaceCh)); + } + offset = _scanner.getPosition(); + break; + } + } while (kind !== 17 /* EOF */); + return parts.join(''); +} +export function getNodeType(value) { + switch (typeof value) { + case 'boolean': return 'boolean'; + case 'number': return 'number'; + case 'string': return 'string'; + case 'object': { + if (!value) { + return 'null'; + } + else if (Array.isArray(value)) { + return 'array'; + } + return 'object'; + } + default: return 'null'; + } +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/scanner.js b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/scanner.js new file mode 100644 index 0000000..83a3673 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/impl/scanner.js @@ -0,0 +1,363 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; +/** + * Creates a JSON scanner on the given text. + * If ignoreTrivia is set, whitespaces or comments are ignored. + */ +export function createScanner(text, ignoreTrivia) { + if (ignoreTrivia === void 0) { ignoreTrivia = false; } + var len = text.length; + var pos = 0, value = '', tokenOffset = 0, token = 16 /* Unknown */, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0 /* None */; + function scanHexDigits(count, exact) { + var digits = 0; + var value = 0; + while (digits < count || !exact) { + var ch = text.charCodeAt(pos); + if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) { + value = value * 16 + ch - 48 /* _0 */; + } + else if (ch >= 65 /* A */ && ch <= 70 /* F */) { + value = value * 16 + ch - 65 /* A */ + 10; + } + else if (ch >= 97 /* a */ && ch <= 102 /* f */) { + value = value * 16 + ch - 97 /* a */ + 10; + } + else { + break; + } + pos++; + digits++; + } + if (digits < count) { + value = -1; + } + return value; + } + function setPosition(newPosition) { + pos = newPosition; + value = ''; + tokenOffset = 0; + token = 16 /* Unknown */; + scanError = 0 /* None */; + } + function scanNumber() { + var start = pos; + if (text.charCodeAt(pos) === 48 /* _0 */) { + pos++; + } + else { + pos++; + while (pos < text.length && isDigit(text.charCodeAt(pos))) { + pos++; + } + } + if (pos < text.length && text.charCodeAt(pos) === 46 /* dot */) { + pos++; + if (pos < text.length && isDigit(text.charCodeAt(pos))) { + pos++; + while (pos < text.length && isDigit(text.charCodeAt(pos))) { + pos++; + } + } + else { + scanError = 3 /* UnexpectedEndOfNumber */; + return text.substring(start, pos); + } + } + var end = pos; + if (pos < text.length && (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */)) { + pos++; + if (pos < text.length && text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) { + pos++; + } + if (pos < text.length && isDigit(text.charCodeAt(pos))) { + pos++; + while (pos < text.length && isDigit(text.charCodeAt(pos))) { + pos++; + } + end = pos; + } + else { + scanError = 3 /* UnexpectedEndOfNumber */; + } + } + return text.substring(start, end); + } + function scanString() { + var result = '', start = pos; + while (true) { + if (pos >= len) { + result += text.substring(start, pos); + scanError = 2 /* UnexpectedEndOfString */; + break; + } + var ch = text.charCodeAt(pos); + if (ch === 34 /* doubleQuote */) { + result += text.substring(start, pos); + pos++; + break; + } + if (ch === 92 /* backslash */) { + result += text.substring(start, pos); + pos++; + if (pos >= len) { + scanError = 2 /* UnexpectedEndOfString */; + break; + } + var ch2 = text.charCodeAt(pos++); + switch (ch2) { + case 34 /* doubleQuote */: + result += '\"'; + break; + case 92 /* backslash */: + result += '\\'; + break; + case 47 /* slash */: + result += '/'; + break; + case 98 /* b */: + result += '\b'; + break; + case 102 /* f */: + result += '\f'; + break; + case 110 /* n */: + result += '\n'; + break; + case 114 /* r */: + result += '\r'; + break; + case 116 /* t */: + result += '\t'; + break; + case 117 /* u */: + var ch3 = scanHexDigits(4, true); + if (ch3 >= 0) { + result += String.fromCharCode(ch3); + } + else { + scanError = 4 /* InvalidUnicode */; + } + break; + default: + scanError = 5 /* InvalidEscapeCharacter */; + } + start = pos; + continue; + } + if (ch >= 0 && ch <= 0x1f) { + if (isLineBreak(ch)) { + result += text.substring(start, pos); + scanError = 2 /* UnexpectedEndOfString */; + break; + } + else { + scanError = 6 /* InvalidCharacter */; + // mark as error but continue with string + } + } + pos++; + } + return result; + } + function scanNext() { + value = ''; + scanError = 0 /* None */; + tokenOffset = pos; + lineStartOffset = lineNumber; + prevTokenLineStartOffset = tokenLineStartOffset; + if (pos >= len) { + // at the end + tokenOffset = len; + return token = 17 /* EOF */; + } + var code = text.charCodeAt(pos); + // trivia: whitespace + if (isWhiteSpace(code)) { + do { + pos++; + value += String.fromCharCode(code); + code = text.charCodeAt(pos); + } while (isWhiteSpace(code)); + return token = 15 /* Trivia */; + } + // trivia: newlines + if (isLineBreak(code)) { + pos++; + value += String.fromCharCode(code); + if (code === 13 /* carriageReturn */ && text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + value += '\n'; + } + lineNumber++; + tokenLineStartOffset = pos; + return token = 14 /* LineBreakTrivia */; + } + switch (code) { + // tokens: []{}:, + case 123 /* openBrace */: + pos++; + return token = 1 /* OpenBraceToken */; + case 125 /* closeBrace */: + pos++; + return token = 2 /* CloseBraceToken */; + case 91 /* openBracket */: + pos++; + return token = 3 /* OpenBracketToken */; + case 93 /* closeBracket */: + pos++; + return token = 4 /* CloseBracketToken */; + case 58 /* colon */: + pos++; + return token = 6 /* ColonToken */; + case 44 /* comma */: + pos++; + return token = 5 /* CommaToken */; + // strings + case 34 /* doubleQuote */: + pos++; + value = scanString(); + return token = 10 /* StringLiteral */; + // comments + case 47 /* slash */: + var start = pos - 1; + // Single-line comment + if (text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + while (pos < len) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + value = text.substring(start, pos); + return token = 12 /* LineCommentTrivia */; + } + // Multi-line comment + if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + pos += 2; + var safeLength = len - 1; // For lookahead. + var commentClosed = false; + while (pos < safeLength) { + var ch = text.charCodeAt(pos); + if (ch === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + commentClosed = true; + break; + } + pos++; + if (isLineBreak(ch)) { + if (ch === 13 /* carriageReturn */ && text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + } + lineNumber++; + tokenLineStartOffset = pos; + } + } + if (!commentClosed) { + pos++; + scanError = 1 /* UnexpectedEndOfComment */; + } + value = text.substring(start, pos); + return token = 13 /* BlockCommentTrivia */; + } + // just a single slash + value += String.fromCharCode(code); + pos++; + return token = 16 /* Unknown */; + // numbers + case 45 /* minus */: + value += String.fromCharCode(code); + pos++; + if (pos === len || !isDigit(text.charCodeAt(pos))) { + return token = 16 /* Unknown */; + } + // found a minus, followed by a number so + // we fall through to proceed with scanning + // numbers + case 48 /* _0 */: + case 49 /* _1 */: + case 50 /* _2 */: + case 51 /* _3 */: + case 52 /* _4 */: + case 53 /* _5 */: + case 54 /* _6 */: + case 55 /* _7 */: + case 56 /* _8 */: + case 57 /* _9 */: + value += scanNumber(); + return token = 11 /* NumericLiteral */; + // literals and unknown symbols + default: + // is a literal? Read the full word. + while (pos < len && isUnknownContentCharacter(code)) { + pos++; + code = text.charCodeAt(pos); + } + if (tokenOffset !== pos) { + value = text.substring(tokenOffset, pos); + // keywords: true, false, null + switch (value) { + case 'true': return token = 8 /* TrueKeyword */; + case 'false': return token = 9 /* FalseKeyword */; + case 'null': return token = 7 /* NullKeyword */; + } + return token = 16 /* Unknown */; + } + // some + value += String.fromCharCode(code); + pos++; + return token = 16 /* Unknown */; + } + } + function isUnknownContentCharacter(code) { + if (isWhiteSpace(code) || isLineBreak(code)) { + return false; + } + switch (code) { + case 125 /* closeBrace */: + case 93 /* closeBracket */: + case 123 /* openBrace */: + case 91 /* openBracket */: + case 34 /* doubleQuote */: + case 58 /* colon */: + case 44 /* comma */: + case 47 /* slash */: + return false; + } + return true; + } + function scanNextNonTrivia() { + var result; + do { + result = scanNext(); + } while (result >= 12 /* LineCommentTrivia */ && result <= 15 /* Trivia */); + return result; + } + return { + setPosition: setPosition, + getPosition: function () { return pos; }, + scan: ignoreTrivia ? scanNextNonTrivia : scanNext, + getToken: function () { return token; }, + getTokenValue: function () { return value; }, + getTokenOffset: function () { return tokenOffset; }, + getTokenLength: function () { return pos - tokenOffset; }, + getTokenStartLine: function () { return lineStartOffset; }, + getTokenStartCharacter: function () { return tokenOffset - prevTokenLineStartOffset; }, + getTokenError: function () { return scanError; }, + }; +} +function isWhiteSpace(ch) { + return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ || + ch === 160 /* nonBreakingSpace */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ || + ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */; +} +function isLineBreak(ch) { + return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */; +} +function isDigit(ch) { + return ch >= 48 /* _0 */ && ch <= 57 /* _9 */; +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/main.d.ts b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/main.d.ts new file mode 100644 index 0000000..cce5f84 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/main.d.ts @@ -0,0 +1,312 @@ +/** + * Creates a JSON scanner on the given text. + * If ignoreTrivia is set, whitespaces or comments are ignored. + */ +export declare const createScanner: (text: string, ignoreTrivia?: boolean) => JSONScanner; +export declare const enum ScanError { + None = 0, + UnexpectedEndOfComment = 1, + UnexpectedEndOfString = 2, + UnexpectedEndOfNumber = 3, + InvalidUnicode = 4, + InvalidEscapeCharacter = 5, + InvalidCharacter = 6 +} +export declare const enum SyntaxKind { + OpenBraceToken = 1, + CloseBraceToken = 2, + OpenBracketToken = 3, + CloseBracketToken = 4, + CommaToken = 5, + ColonToken = 6, + NullKeyword = 7, + TrueKeyword = 8, + FalseKeyword = 9, + StringLiteral = 10, + NumericLiteral = 11, + LineCommentTrivia = 12, + BlockCommentTrivia = 13, + LineBreakTrivia = 14, + Trivia = 15, + Unknown = 16, + EOF = 17 +} +/** + * The scanner object, representing a JSON scanner at a position in the input string. + */ +export interface JSONScanner { + /** + * Sets the scan position to a new offset. A call to 'scan' is needed to get the first token. + */ + setPosition(pos: number): void; + /** + * Read the next token. Returns the token code. + */ + scan(): SyntaxKind; + /** + * Returns the current scan position, which is after the last read token. + */ + getPosition(): number; + /** + * Returns the last read token. + */ + getToken(): SyntaxKind; + /** + * Returns the last read token value. The value for strings is the decoded string content. For numbers it's of type number, for boolean it's true or false. + */ + getTokenValue(): string; + /** + * The start offset of the last read token. + */ + getTokenOffset(): number; + /** + * The length of the last read token. + */ + getTokenLength(): number; + /** + * The zero-based start line number of the last read token. + */ + getTokenStartLine(): number; + /** + * The zero-based start character (column) of the last read token. + */ + getTokenStartCharacter(): number; + /** + * An error code of the last scan. + */ + getTokenError(): ScanError; +} +/** + * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index. + */ +export declare const getLocation: (text: string, position: number) => Location; +/** + * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + * Therefore, always check the errors list to find out if the input was valid. + */ +export declare const parse: (text: string, errors?: ParseError[], options?: ParseOptions) => any; +/** + * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + */ +export declare const parseTree: (text: string, errors?: ParseError[], options?: ParseOptions) => Node; +/** + * Finds the node at the given path in a JSON DOM. + */ +export declare const findNodeAtLocation: (root: Node, path: JSONPath) => Node | undefined; +/** + * Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset. + */ +export declare const findNodeAtOffset: (root: Node, offset: number, includeRightBound?: boolean) => Node | undefined; +/** + * Gets the JSON path of the given JSON DOM node + */ +export declare const getNodePath: (node: Node) => JSONPath; +/** + * Evaluates the JavaScript object of the given JSON DOM node + */ +export declare const getNodeValue: (node: Node) => any; +/** + * Parses the given text and invokes the visitor functions for each object, array and literal reached. + */ +export declare const visit: (text: string, visitor: JSONVisitor, options?: ParseOptions) => any; +/** + * Takes JSON with JavaScript-style comments and remove + * them. Optionally replaces every none-newline character + * of comments with a replaceCharacter + */ +export declare const stripComments: (text: string, replaceCh?: string) => string; +export interface ParseError { + error: ParseErrorCode; + offset: number; + length: number; +} +export declare const enum ParseErrorCode { + InvalidSymbol = 1, + InvalidNumberFormat = 2, + PropertyNameExpected = 3, + ValueExpected = 4, + ColonExpected = 5, + CommaExpected = 6, + CloseBraceExpected = 7, + CloseBracketExpected = 8, + EndOfFileExpected = 9, + InvalidCommentToken = 10, + UnexpectedEndOfComment = 11, + UnexpectedEndOfString = 12, + UnexpectedEndOfNumber = 13, + InvalidUnicode = 14, + InvalidEscapeCharacter = 15, + InvalidCharacter = 16 +} +export declare function printParseErrorCode(code: ParseErrorCode): "InvalidSymbol" | "InvalidNumberFormat" | "PropertyNameExpected" | "ValueExpected" | "ColonExpected" | "CommaExpected" | "CloseBraceExpected" | "CloseBracketExpected" | "EndOfFileExpected" | "InvalidCommentToken" | "UnexpectedEndOfComment" | "UnexpectedEndOfString" | "UnexpectedEndOfNumber" | "InvalidUnicode" | "InvalidEscapeCharacter" | "InvalidCharacter" | ""; +export declare type NodeType = 'object' | 'array' | 'property' | 'string' | 'number' | 'boolean' | 'null'; +export interface Node { + readonly type: NodeType; + readonly value?: any; + readonly offset: number; + readonly length: number; + readonly colonOffset?: number; + readonly parent?: Node; + readonly children?: Node[]; +} +export declare type Segment = string | number; +export declare type JSONPath = Segment[]; +export interface Location { + /** + * The previous property key or literal value (string, number, boolean or null) or undefined. + */ + previousNode?: Node; + /** + * The path describing the location in the JSON document. The path consists of a sequence of strings + * representing an object property or numbers for array indices. + */ + path: JSONPath; + /** + * Matches the locations path against a pattern consisting of strings (for properties) and numbers (for array indices). + * '*' will match a single segment of any property name or index. + * '**' will match a sequence of segments of any property name or index, or no segment. + */ + matches: (patterns: JSONPath) => boolean; + /** + * If set, the location's offset is at a property key. + */ + isAtPropertyKey: boolean; +} +export interface ParseOptions { + disallowComments?: boolean; + allowTrailingComma?: boolean; + allowEmptyContent?: boolean; +} +export interface JSONVisitor { + /** + * Invoked when an open brace is encountered and an object is started. The offset and length represent the location of the open brace. + */ + onObjectBegin?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a property is encountered. The offset and length represent the location of the property name. + */ + onObjectProperty?: (property: string, offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a closing brace is encountered and an object is completed. The offset and length represent the location of the closing brace. + */ + onObjectEnd?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when an open bracket is encountered. The offset and length represent the location of the open bracket. + */ + onArrayBegin?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a closing bracket is encountered. The offset and length represent the location of the closing bracket. + */ + onArrayEnd?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a literal value is encountered. The offset and length represent the location of the literal value. + */ + onLiteralValue?: (value: any, offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a comma or colon separator is encountered. The offset and length represent the location of the separator. + */ + onSeparator?: (character: string, offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * When comments are allowed, invoked when a line or block comment is encountered. The offset and length represent the location of the comment. + */ + onComment?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked on an error. + */ + onError?: (error: ParseErrorCode, offset: number, length: number, startLine: number, startCharacter: number) => void; +} +/** + * Represents a text modification + */ +export interface Edit { + /** + * The start offset of the modification. + */ + offset: number; + /** + * The length of the modification. Must not be negative. Empty length represents an *insert*. + */ + length: number; + /** + * The new content. Empty content represents a *remove*. + */ + content: string; +} +/** + * A text range in the document +*/ +export interface Range { + /** + * The start offset of the range. + */ + offset: number; + /** + * The length of the range. Must not be negative. + */ + length: number; +} +export interface FormattingOptions { + /** + * If indentation is based on spaces (`insertSpaces` = true), the number of spaces that make an indent. + */ + tabSize?: number; + /** + * Is indentation based on spaces? + */ + insertSpaces?: boolean; + /** + * The default 'end of line' character. If not set, '\n' is used as default. + */ + eol?: string; +} +/** + * Computes the edits needed to format a JSON document. + * + * @param documentText The input text + * @param range The range to format or `undefined` to format the full content + * @param options The formatting options + * @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or + * removals of text segments. All offsets refer to the original state of the document. No two edits must change or remove the same range of + * text in the original document. However, multiple edits can have + * the same offset, for example multiple inserts, or an insert followed by a remove or replace. The order in the array defines which edit is applied first. + * To apply edits to an input, you can use `applyEdits`. + */ +export declare function format(documentText: string, range: Range | undefined, options: FormattingOptions): Edit[]; +/** + * Options used when computing the modification edits + */ +export interface ModificationOptions { + /** + * Formatting options. If undefined, the newly inserted code will be inserted unformatted. + */ + formattingOptions?: FormattingOptions; + /** + * Default false. If `JSONPath` refers to an index of an array and {@property isArrayInsertion} is `true`, then + * {@function modify} will insert a new item at that location instead of overwriting its contents. + */ + isArrayInsertion?: boolean; + /** + * Optional function to define the insertion index given an existing list of properties. + */ + getInsertionIndex?: (properties: string[]) => number; +} +/** + * Computes the edits needed to modify a value in the JSON document. + * + * @param documentText The input text + * @param path The path of the value to change. The path represents either to the document root, a property or an array item. + * If the path points to an non-existing property or item, it will be created. + * @param value The new value for the specified property or item. If the value is undefined, + * the property or item will be removed. + * @param options Options + * @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or + * removals of text segments. All offsets refer to the original state of the document. No two edits must change or remove the same range of + * text in the original document. However, multiple edits can have + * the same offset, for example multiple inserts, or an insert followed by a remove or replace. The order in the array defines which edit is applied first. + * To apply edits to an input, you can use `applyEdits`. + */ +export declare function modify(text: string, path: JSONPath, value: any, options: ModificationOptions): Edit[]; +/** + * Applies edits to a input string. + */ +export declare function applyEdits(text: string, edits: Edit[]): string; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/main.js b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/main.js new file mode 100644 index 0000000..f56a078 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/esm/main.js @@ -0,0 +1,116 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; +import * as formatter from './impl/format'; +import * as edit from './impl/edit'; +import * as scanner from './impl/scanner'; +import * as parser from './impl/parser'; +/** + * Creates a JSON scanner on the given text. + * If ignoreTrivia is set, whitespaces or comments are ignored. + */ +export var createScanner = scanner.createScanner; +/** + * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index. + */ +export var getLocation = parser.getLocation; +/** + * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + * Therefore, always check the errors list to find out if the input was valid. + */ +export var parse = parser.parse; +/** + * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + */ +export var parseTree = parser.parseTree; +/** + * Finds the node at the given path in a JSON DOM. + */ +export var findNodeAtLocation = parser.findNodeAtLocation; +/** + * Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset. + */ +export var findNodeAtOffset = parser.findNodeAtOffset; +/** + * Gets the JSON path of the given JSON DOM node + */ +export var getNodePath = parser.getNodePath; +/** + * Evaluates the JavaScript object of the given JSON DOM node + */ +export var getNodeValue = parser.getNodeValue; +/** + * Parses the given text and invokes the visitor functions for each object, array and literal reached. + */ +export var visit = parser.visit; +/** + * Takes JSON with JavaScript-style comments and remove + * them. Optionally replaces every none-newline character + * of comments with a replaceCharacter + */ +export var stripComments = parser.stripComments; +export function printParseErrorCode(code) { + switch (code) { + case 1 /* InvalidSymbol */: return 'InvalidSymbol'; + case 2 /* InvalidNumberFormat */: return 'InvalidNumberFormat'; + case 3 /* PropertyNameExpected */: return 'PropertyNameExpected'; + case 4 /* ValueExpected */: return 'ValueExpected'; + case 5 /* ColonExpected */: return 'ColonExpected'; + case 6 /* CommaExpected */: return 'CommaExpected'; + case 7 /* CloseBraceExpected */: return 'CloseBraceExpected'; + case 8 /* CloseBracketExpected */: return 'CloseBracketExpected'; + case 9 /* EndOfFileExpected */: return 'EndOfFileExpected'; + case 10 /* InvalidCommentToken */: return 'InvalidCommentToken'; + case 11 /* UnexpectedEndOfComment */: return 'UnexpectedEndOfComment'; + case 12 /* UnexpectedEndOfString */: return 'UnexpectedEndOfString'; + case 13 /* UnexpectedEndOfNumber */: return 'UnexpectedEndOfNumber'; + case 14 /* InvalidUnicode */: return 'InvalidUnicode'; + case 15 /* InvalidEscapeCharacter */: return 'InvalidEscapeCharacter'; + case 16 /* InvalidCharacter */: return 'InvalidCharacter'; + } + return ''; +} +/** + * Computes the edits needed to format a JSON document. + * + * @param documentText The input text + * @param range The range to format or `undefined` to format the full content + * @param options The formatting options + * @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or + * removals of text segments. All offsets refer to the original state of the document. No two edits must change or remove the same range of + * text in the original document. However, multiple edits can have + * the same offset, for example multiple inserts, or an insert followed by a remove or replace. The order in the array defines which edit is applied first. + * To apply edits to an input, you can use `applyEdits`. + */ +export function format(documentText, range, options) { + return formatter.format(documentText, range, options); +} +/** + * Computes the edits needed to modify a value in the JSON document. + * + * @param documentText The input text + * @param path The path of the value to change. The path represents either to the document root, a property or an array item. + * If the path points to an non-existing property or item, it will be created. + * @param value The new value for the specified property or item. If the value is undefined, + * the property or item will be removed. + * @param options Options + * @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or + * removals of text segments. All offsets refer to the original state of the document. No two edits must change or remove the same range of + * text in the original document. However, multiple edits can have + * the same offset, for example multiple inserts, or an insert followed by a remove or replace. The order in the array defines which edit is applied first. + * To apply edits to an input, you can use `applyEdits`. + */ +export function modify(text, path, value, options) { + return edit.setProperty(text, path, value, options); +} +/** + * Applies edits to a input string. + */ +export function applyEdits(text, edits) { + for (var i = edits.length - 1; i >= 0; i--) { + text = edit.applyEdit(text, edits[i]); + } + return text; +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/edit.js b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/edit.js new file mode 100644 index 0000000..71e0b4f --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/edit.js @@ -0,0 +1,202 @@ +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; + } + else if (typeof define === "function" && define.amd) { + define(["require", "exports", "./format", "./parser"], factory); + } +})(function (require, exports) { + /*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + 'use strict'; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.isWS = exports.applyEdit = exports.setProperty = exports.removeProperty = void 0; + var format_1 = require("./format"); + var parser_1 = require("./parser"); + function removeProperty(text, path, options) { + return setProperty(text, path, void 0, options); + } + exports.removeProperty = removeProperty; + function setProperty(text, originalPath, value, options) { + var _a; + var path = originalPath.slice(); + var errors = []; + var root = parser_1.parseTree(text, errors); + var parent = void 0; + var lastSegment = void 0; + while (path.length > 0) { + lastSegment = path.pop(); + parent = parser_1.findNodeAtLocation(root, path); + if (parent === void 0 && value !== void 0) { + if (typeof lastSegment === 'string') { + value = (_a = {}, _a[lastSegment] = value, _a); + } + else { + value = [value]; + } + } + else { + break; + } + } + if (!parent) { + // empty document + if (value === void 0) { // delete + throw new Error('Can not delete in empty document'); + } + return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, options); + } + else if (parent.type === 'object' && typeof lastSegment === 'string' && Array.isArray(parent.children)) { + var existing = parser_1.findNodeAtLocation(parent, [lastSegment]); + if (existing !== void 0) { + if (value === void 0) { // delete + if (!existing.parent) { + throw new Error('Malformed AST'); + } + var propertyIndex = parent.children.indexOf(existing.parent); + var removeBegin = void 0; + var removeEnd = existing.parent.offset + existing.parent.length; + if (propertyIndex > 0) { + // remove the comma of the previous node + var previous = parent.children[propertyIndex - 1]; + removeBegin = previous.offset + previous.length; + } + else { + removeBegin = parent.offset + 1; + if (parent.children.length > 1) { + // remove the comma of the next node + var next = parent.children[1]; + removeEnd = next.offset; + } + } + return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: '' }, options); + } + else { + // set value of existing property + return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, options); + } + } + else { + if (value === void 0) { // delete + return []; // property does not exist, nothing to do + } + var newProperty = JSON.stringify(lastSegment) + ": " + JSON.stringify(value); + var index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map(function (p) { return p.children[0].value; })) : parent.children.length; + var edit = void 0; + if (index > 0) { + var previous = parent.children[index - 1]; + edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty }; + } + else if (parent.children.length === 0) { + edit = { offset: parent.offset + 1, length: 0, content: newProperty }; + } + else { + edit = { offset: parent.offset + 1, length: 0, content: newProperty + ',' }; + } + return withFormatting(text, edit, options); + } + } + else if (parent.type === 'array' && typeof lastSegment === 'number' && Array.isArray(parent.children)) { + var insertIndex = lastSegment; + if (insertIndex === -1) { + // Insert + var newProperty = "" + JSON.stringify(value); + var edit = void 0; + if (parent.children.length === 0) { + edit = { offset: parent.offset + 1, length: 0, content: newProperty }; + } + else { + var previous = parent.children[parent.children.length - 1]; + edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty }; + } + return withFormatting(text, edit, options); + } + else if (value === void 0 && parent.children.length >= 0) { + // Removal + var removalIndex = lastSegment; + var toRemove = parent.children[removalIndex]; + var edit = void 0; + if (parent.children.length === 1) { + // only item + edit = { offset: parent.offset + 1, length: parent.length - 2, content: '' }; + } + else if (parent.children.length - 1 === removalIndex) { + // last item + var previous = parent.children[removalIndex - 1]; + var offset = previous.offset + previous.length; + var parentEndOffset = parent.offset + parent.length; + edit = { offset: offset, length: parentEndOffset - 2 - offset, content: '' }; + } + else { + edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: '' }; + } + return withFormatting(text, edit, options); + } + else if (value !== void 0) { + var edit = void 0; + var newProperty = "" + JSON.stringify(value); + if (!options.isArrayInsertion && parent.children.length > lastSegment) { + var toModify = parent.children[lastSegment]; + edit = { offset: toModify.offset, length: toModify.length, content: newProperty }; + } + else if (parent.children.length === 0 || lastSegment === 0) { + edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + ',' }; + } + else { + var index = lastSegment > parent.children.length ? parent.children.length : lastSegment; + var previous = parent.children[index - 1]; + edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty }; + } + return withFormatting(text, edit, options); + } + else { + throw new Error("Can not " + (value === void 0 ? 'remove' : (options.isArrayInsertion ? 'insert' : 'modify')) + " Array index " + insertIndex + " as length is not sufficient"); + } + } + else { + throw new Error("Can not add " + (typeof lastSegment !== 'number' ? 'index' : 'property') + " to parent of type " + parent.type); + } + } + exports.setProperty = setProperty; + function withFormatting(text, edit, options) { + if (!options.formattingOptions) { + return [edit]; + } + // apply the edit + var newText = applyEdit(text, edit); + // format the new text + var begin = edit.offset; + var end = edit.offset + edit.content.length; + if (edit.length === 0 || edit.content.length === 0) { // insert or remove + while (begin > 0 && !format_1.isEOL(newText, begin - 1)) { + begin--; + } + while (end < newText.length && !format_1.isEOL(newText, end)) { + end++; + } + } + var edits = format_1.format(newText, { offset: begin, length: end - begin }, options.formattingOptions); + // apply the formatting edits and track the begin and end offsets of the changes + for (var i = edits.length - 1; i >= 0; i--) { + var edit_1 = edits[i]; + newText = applyEdit(newText, edit_1); + begin = Math.min(begin, edit_1.offset); + end = Math.max(end, edit_1.offset + edit_1.length); + end += edit_1.content.length - edit_1.length; + } + // create a single edit with all changes + var editLength = text.length - (newText.length - end) - begin; + return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }]; + } + function applyEdit(text, edit) { + return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length); + } + exports.applyEdit = applyEdit; + function isWS(text, offset) { + return '\r\n \t'.indexOf(text.charAt(offset)) !== -1; + } + exports.isWS = isWS; +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/format.js b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/format.js new file mode 100644 index 0000000..1d94d80 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/format.js @@ -0,0 +1,208 @@ +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; + } + else if (typeof define === "function" && define.amd) { + define(["require", "exports", "./scanner"], factory); + } +})(function (require, exports) { + /*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + 'use strict'; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.isEOL = exports.format = void 0; + var scanner_1 = require("./scanner"); + function format(documentText, range, options) { + var initialIndentLevel; + var formatText; + var formatTextStart; + var rangeStart; + var rangeEnd; + if (range) { + rangeStart = range.offset; + rangeEnd = rangeStart + range.length; + formatTextStart = rangeStart; + while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) { + formatTextStart--; + } + var endOffset = rangeEnd; + while (endOffset < documentText.length && !isEOL(documentText, endOffset)) { + endOffset++; + } + formatText = documentText.substring(formatTextStart, endOffset); + initialIndentLevel = computeIndentLevel(formatText, options); + } + else { + formatText = documentText; + initialIndentLevel = 0; + formatTextStart = 0; + rangeStart = 0; + rangeEnd = documentText.length; + } + var eol = getEOL(options, documentText); + var lineBreak = false; + var indentLevel = 0; + var indentValue; + if (options.insertSpaces) { + indentValue = repeat(' ', options.tabSize || 4); + } + else { + indentValue = '\t'; + } + var scanner = scanner_1.createScanner(formatText, false); + var hasError = false; + function newLineAndIndent() { + return eol + repeat(indentValue, initialIndentLevel + indentLevel); + } + function scanNext() { + var token = scanner.scan(); + lineBreak = false; + while (token === 15 /* Trivia */ || token === 14 /* LineBreakTrivia */) { + lineBreak = lineBreak || (token === 14 /* LineBreakTrivia */); + token = scanner.scan(); + } + hasError = token === 16 /* Unknown */ || scanner.getTokenError() !== 0 /* None */; + return token; + } + var editOperations = []; + function addEdit(text, startOffset, endOffset) { + if (!hasError && startOffset < rangeEnd && endOffset > rangeStart && documentText.substring(startOffset, endOffset) !== text) { + editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text }); + } + } + var firstToken = scanNext(); + if (firstToken !== 17 /* EOF */) { + var firstTokenStart = scanner.getTokenOffset() + formatTextStart; + var initialIndent = repeat(indentValue, initialIndentLevel); + addEdit(initialIndent, formatTextStart, firstTokenStart); + } + while (firstToken !== 17 /* EOF */) { + var firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart; + var secondToken = scanNext(); + var replaceContent = ''; + while (!lineBreak && (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */)) { + // comments on the same line: keep them on the same line, but ignore them otherwise + var commentTokenStart = scanner.getTokenOffset() + formatTextStart; + addEdit(' ', firstTokenEnd, commentTokenStart); + firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart; + replaceContent = secondToken === 12 /* LineCommentTrivia */ ? newLineAndIndent() : ''; + secondToken = scanNext(); + } + if (secondToken === 2 /* CloseBraceToken */) { + if (firstToken !== 1 /* OpenBraceToken */) { + indentLevel--; + replaceContent = newLineAndIndent(); + } + } + else if (secondToken === 4 /* CloseBracketToken */) { + if (firstToken !== 3 /* OpenBracketToken */) { + indentLevel--; + replaceContent = newLineAndIndent(); + } + } + else { + switch (firstToken) { + case 3 /* OpenBracketToken */: + case 1 /* OpenBraceToken */: + indentLevel++; + replaceContent = newLineAndIndent(); + break; + case 5 /* CommaToken */: + case 12 /* LineCommentTrivia */: + replaceContent = newLineAndIndent(); + break; + case 13 /* BlockCommentTrivia */: + if (lineBreak) { + replaceContent = newLineAndIndent(); + } + else { + // symbol following comment on the same line: keep on same line, separate with ' ' + replaceContent = ' '; + } + break; + case 6 /* ColonToken */: + replaceContent = ' '; + break; + case 10 /* StringLiteral */: + if (secondToken === 6 /* ColonToken */) { + replaceContent = ''; + break; + } + // fall through + case 7 /* NullKeyword */: + case 8 /* TrueKeyword */: + case 9 /* FalseKeyword */: + case 11 /* NumericLiteral */: + case 2 /* CloseBraceToken */: + case 4 /* CloseBracketToken */: + if (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */) { + replaceContent = ' '; + } + else if (secondToken !== 5 /* CommaToken */ && secondToken !== 17 /* EOF */) { + hasError = true; + } + break; + case 16 /* Unknown */: + hasError = true; + break; + } + if (lineBreak && (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */)) { + replaceContent = newLineAndIndent(); + } + } + var secondTokenStart = scanner.getTokenOffset() + formatTextStart; + addEdit(replaceContent, firstTokenEnd, secondTokenStart); + firstToken = secondToken; + } + return editOperations; + } + exports.format = format; + function repeat(s, count) { + var result = ''; + for (var i = 0; i < count; i++) { + result += s; + } + return result; + } + function computeIndentLevel(content, options) { + var i = 0; + var nChars = 0; + var tabSize = options.tabSize || 4; + while (i < content.length) { + var ch = content.charAt(i); + if (ch === ' ') { + nChars++; + } + else if (ch === '\t') { + nChars += tabSize; + } + else { + break; + } + i++; + } + return Math.floor(nChars / tabSize); + } + function getEOL(options, text) { + for (var i = 0; i < text.length; i++) { + var ch = text.charAt(i); + if (ch === '\r') { + if (i + 1 < text.length && text.charAt(i + 1) === '\n') { + return '\r\n'; + } + return '\r'; + } + else if (ch === '\n') { + return '\n'; + } + } + return (options && options.eol) || '\n'; + } + function isEOL(text, offset) { + return '\r\n'.indexOf(text.charAt(offset)) !== -1; + } + exports.isEOL = isEOL; +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/parser.js b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/parser.js new file mode 100644 index 0000000..01cecd1 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/parser.js @@ -0,0 +1,644 @@ +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; + } + else if (typeof define === "function" && define.amd) { + define(["require", "exports", "./scanner"], factory); + } +})(function (require, exports) { + /*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + 'use strict'; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.getNodeType = exports.stripComments = exports.visit = exports.findNodeAtOffset = exports.contains = exports.getNodeValue = exports.getNodePath = exports.findNodeAtLocation = exports.parseTree = exports.parse = exports.getLocation = void 0; + var scanner_1 = require("./scanner"); + var ParseOptions; + (function (ParseOptions) { + ParseOptions.DEFAULT = { + allowTrailingComma: false + }; + })(ParseOptions || (ParseOptions = {})); + /** + * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index. + */ + function getLocation(text, position) { + var segments = []; // strings or numbers + var earlyReturnException = new Object(); + var previousNode = undefined; + var previousNodeInst = { + value: {}, + offset: 0, + length: 0, + type: 'object', + parent: undefined + }; + var isAtPropertyKey = false; + function setPreviousNode(value, offset, length, type) { + previousNodeInst.value = value; + previousNodeInst.offset = offset; + previousNodeInst.length = length; + previousNodeInst.type = type; + previousNodeInst.colonOffset = undefined; + previousNode = previousNodeInst; + } + try { + visit(text, { + onObjectBegin: function (offset, length) { + if (position <= offset) { + throw earlyReturnException; + } + previousNode = undefined; + isAtPropertyKey = position > offset; + segments.push(''); // push a placeholder (will be replaced) + }, + onObjectProperty: function (name, offset, length) { + if (position < offset) { + throw earlyReturnException; + } + setPreviousNode(name, offset, length, 'property'); + segments[segments.length - 1] = name; + if (position <= offset + length) { + throw earlyReturnException; + } + }, + onObjectEnd: function (offset, length) { + if (position <= offset) { + throw earlyReturnException; + } + previousNode = undefined; + segments.pop(); + }, + onArrayBegin: function (offset, length) { + if (position <= offset) { + throw earlyReturnException; + } + previousNode = undefined; + segments.push(0); + }, + onArrayEnd: function (offset, length) { + if (position <= offset) { + throw earlyReturnException; + } + previousNode = undefined; + segments.pop(); + }, + onLiteralValue: function (value, offset, length) { + if (position < offset) { + throw earlyReturnException; + } + setPreviousNode(value, offset, length, getNodeType(value)); + if (position <= offset + length) { + throw earlyReturnException; + } + }, + onSeparator: function (sep, offset, length) { + if (position <= offset) { + throw earlyReturnException; + } + if (sep === ':' && previousNode && previousNode.type === 'property') { + previousNode.colonOffset = offset; + isAtPropertyKey = false; + previousNode = undefined; + } + else if (sep === ',') { + var last = segments[segments.length - 1]; + if (typeof last === 'number') { + segments[segments.length - 1] = last + 1; + } + else { + isAtPropertyKey = true; + segments[segments.length - 1] = ''; + } + previousNode = undefined; + } + } + }); + } + catch (e) { + if (e !== earlyReturnException) { + throw e; + } + } + return { + path: segments, + previousNode: previousNode, + isAtPropertyKey: isAtPropertyKey, + matches: function (pattern) { + var k = 0; + for (var i = 0; k < pattern.length && i < segments.length; i++) { + if (pattern[k] === segments[i] || pattern[k] === '*') { + k++; + } + else if (pattern[k] !== '**') { + return false; + } + } + return k === pattern.length; + } + }; + } + exports.getLocation = getLocation; + /** + * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + * Therefore always check the errors list to find out if the input was valid. + */ + function parse(text, errors, options) { + if (errors === void 0) { errors = []; } + if (options === void 0) { options = ParseOptions.DEFAULT; } + var currentProperty = null; + var currentParent = []; + var previousParents = []; + function onValue(value) { + if (Array.isArray(currentParent)) { + currentParent.push(value); + } + else if (currentProperty !== null) { + currentParent[currentProperty] = value; + } + } + var visitor = { + onObjectBegin: function () { + var object = {}; + onValue(object); + previousParents.push(currentParent); + currentParent = object; + currentProperty = null; + }, + onObjectProperty: function (name) { + currentProperty = name; + }, + onObjectEnd: function () { + currentParent = previousParents.pop(); + }, + onArrayBegin: function () { + var array = []; + onValue(array); + previousParents.push(currentParent); + currentParent = array; + currentProperty = null; + }, + onArrayEnd: function () { + currentParent = previousParents.pop(); + }, + onLiteralValue: onValue, + onError: function (error, offset, length) { + errors.push({ error: error, offset: offset, length: length }); + } + }; + visit(text, visitor, options); + return currentParent[0]; + } + exports.parse = parse; + /** + * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + */ + function parseTree(text, errors, options) { + if (errors === void 0) { errors = []; } + if (options === void 0) { options = ParseOptions.DEFAULT; } + var currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: undefined }; // artificial root + function ensurePropertyComplete(endOffset) { + if (currentParent.type === 'property') { + currentParent.length = endOffset - currentParent.offset; + currentParent = currentParent.parent; + } + } + function onValue(valueNode) { + currentParent.children.push(valueNode); + return valueNode; + } + var visitor = { + onObjectBegin: function (offset) { + currentParent = onValue({ type: 'object', offset: offset, length: -1, parent: currentParent, children: [] }); + }, + onObjectProperty: function (name, offset, length) { + currentParent = onValue({ type: 'property', offset: offset, length: -1, parent: currentParent, children: [] }); + currentParent.children.push({ type: 'string', value: name, offset: offset, length: length, parent: currentParent }); + }, + onObjectEnd: function (offset, length) { + ensurePropertyComplete(offset + length); // in case of a missing value for a property: make sure property is complete + currentParent.length = offset + length - currentParent.offset; + currentParent = currentParent.parent; + ensurePropertyComplete(offset + length); + }, + onArrayBegin: function (offset, length) { + currentParent = onValue({ type: 'array', offset: offset, length: -1, parent: currentParent, children: [] }); + }, + onArrayEnd: function (offset, length) { + currentParent.length = offset + length - currentParent.offset; + currentParent = currentParent.parent; + ensurePropertyComplete(offset + length); + }, + onLiteralValue: function (value, offset, length) { + onValue({ type: getNodeType(value), offset: offset, length: length, parent: currentParent, value: value }); + ensurePropertyComplete(offset + length); + }, + onSeparator: function (sep, offset, length) { + if (currentParent.type === 'property') { + if (sep === ':') { + currentParent.colonOffset = offset; + } + else if (sep === ',') { + ensurePropertyComplete(offset); + } + } + }, + onError: function (error, offset, length) { + errors.push({ error: error, offset: offset, length: length }); + } + }; + visit(text, visitor, options); + var result = currentParent.children[0]; + if (result) { + delete result.parent; + } + return result; + } + exports.parseTree = parseTree; + /** + * Finds the node at the given path in a JSON DOM. + */ + function findNodeAtLocation(root, path) { + if (!root) { + return undefined; + } + var node = root; + for (var _i = 0, path_1 = path; _i < path_1.length; _i++) { + var segment = path_1[_i]; + if (typeof segment === 'string') { + if (node.type !== 'object' || !Array.isArray(node.children)) { + return undefined; + } + var found = false; + for (var _a = 0, _b = node.children; _a < _b.length; _a++) { + var propertyNode = _b[_a]; + if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment) { + node = propertyNode.children[1]; + found = true; + break; + } + } + if (!found) { + return undefined; + } + } + else { + var index = segment; + if (node.type !== 'array' || index < 0 || !Array.isArray(node.children) || index >= node.children.length) { + return undefined; + } + node = node.children[index]; + } + } + return node; + } + exports.findNodeAtLocation = findNodeAtLocation; + /** + * Gets the JSON path of the given JSON DOM node + */ + function getNodePath(node) { + if (!node.parent || !node.parent.children) { + return []; + } + var path = getNodePath(node.parent); + if (node.parent.type === 'property') { + var key = node.parent.children[0].value; + path.push(key); + } + else if (node.parent.type === 'array') { + var index = node.parent.children.indexOf(node); + if (index !== -1) { + path.push(index); + } + } + return path; + } + exports.getNodePath = getNodePath; + /** + * Evaluates the JavaScript object of the given JSON DOM node + */ + function getNodeValue(node) { + switch (node.type) { + case 'array': + return node.children.map(getNodeValue); + case 'object': + var obj = Object.create(null); + for (var _i = 0, _a = node.children; _i < _a.length; _i++) { + var prop = _a[_i]; + var valueNode = prop.children[1]; + if (valueNode) { + obj[prop.children[0].value] = getNodeValue(valueNode); + } + } + return obj; + case 'null': + case 'string': + case 'number': + case 'boolean': + return node.value; + default: + return undefined; + } + } + exports.getNodeValue = getNodeValue; + function contains(node, offset, includeRightBound) { + if (includeRightBound === void 0) { includeRightBound = false; } + return (offset >= node.offset && offset < (node.offset + node.length)) || includeRightBound && (offset === (node.offset + node.length)); + } + exports.contains = contains; + /** + * Finds the most inner node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset. + */ + function findNodeAtOffset(node, offset, includeRightBound) { + if (includeRightBound === void 0) { includeRightBound = false; } + if (contains(node, offset, includeRightBound)) { + var children = node.children; + if (Array.isArray(children)) { + for (var i = 0; i < children.length && children[i].offset <= offset; i++) { + var item = findNodeAtOffset(children[i], offset, includeRightBound); + if (item) { + return item; + } + } + } + return node; + } + return undefined; + } + exports.findNodeAtOffset = findNodeAtOffset; + /** + * Parses the given text and invokes the visitor functions for each object, array and literal reached. + */ + function visit(text, visitor, options) { + if (options === void 0) { options = ParseOptions.DEFAULT; } + var _scanner = scanner_1.createScanner(text, false); + function toNoArgVisit(visitFunction) { + return visitFunction ? function () { return visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()); } : function () { return true; }; + } + function toOneArgVisit(visitFunction) { + return visitFunction ? function (arg) { return visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()); } : function () { return true; }; + } + var onObjectBegin = toNoArgVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisit(visitor.onObjectProperty), onObjectEnd = toNoArgVisit(visitor.onObjectEnd), onArrayBegin = toNoArgVisit(visitor.onArrayBegin), onArrayEnd = toNoArgVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisit(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError); + var disallowComments = options && options.disallowComments; + var allowTrailingComma = options && options.allowTrailingComma; + function scanNext() { + while (true) { + var token = _scanner.scan(); + switch (_scanner.getTokenError()) { + case 4 /* InvalidUnicode */: + handleError(14 /* InvalidUnicode */); + break; + case 5 /* InvalidEscapeCharacter */: + handleError(15 /* InvalidEscapeCharacter */); + break; + case 3 /* UnexpectedEndOfNumber */: + handleError(13 /* UnexpectedEndOfNumber */); + break; + case 1 /* UnexpectedEndOfComment */: + if (!disallowComments) { + handleError(11 /* UnexpectedEndOfComment */); + } + break; + case 2 /* UnexpectedEndOfString */: + handleError(12 /* UnexpectedEndOfString */); + break; + case 6 /* InvalidCharacter */: + handleError(16 /* InvalidCharacter */); + break; + } + switch (token) { + case 12 /* LineCommentTrivia */: + case 13 /* BlockCommentTrivia */: + if (disallowComments) { + handleError(10 /* InvalidCommentToken */); + } + else { + onComment(); + } + break; + case 16 /* Unknown */: + handleError(1 /* InvalidSymbol */); + break; + case 15 /* Trivia */: + case 14 /* LineBreakTrivia */: + break; + default: + return token; + } + } + } + function handleError(error, skipUntilAfter, skipUntil) { + if (skipUntilAfter === void 0) { skipUntilAfter = []; } + if (skipUntil === void 0) { skipUntil = []; } + onError(error); + if (skipUntilAfter.length + skipUntil.length > 0) { + var token = _scanner.getToken(); + while (token !== 17 /* EOF */) { + if (skipUntilAfter.indexOf(token) !== -1) { + scanNext(); + break; + } + else if (skipUntil.indexOf(token) !== -1) { + break; + } + token = scanNext(); + } + } + } + function parseString(isValue) { + var value = _scanner.getTokenValue(); + if (isValue) { + onLiteralValue(value); + } + else { + onObjectProperty(value); + } + scanNext(); + return true; + } + function parseLiteral() { + switch (_scanner.getToken()) { + case 11 /* NumericLiteral */: + var tokenValue = _scanner.getTokenValue(); + var value = Number(tokenValue); + if (isNaN(value)) { + handleError(2 /* InvalidNumberFormat */); + value = 0; + } + onLiteralValue(value); + break; + case 7 /* NullKeyword */: + onLiteralValue(null); + break; + case 8 /* TrueKeyword */: + onLiteralValue(true); + break; + case 9 /* FalseKeyword */: + onLiteralValue(false); + break; + default: + return false; + } + scanNext(); + return true; + } + function parseProperty() { + if (_scanner.getToken() !== 10 /* StringLiteral */) { + handleError(3 /* PropertyNameExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]); + return false; + } + parseString(false); + if (_scanner.getToken() === 6 /* ColonToken */) { + onSeparator(':'); + scanNext(); // consume colon + if (!parseValue()) { + handleError(4 /* ValueExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]); + } + } + else { + handleError(5 /* ColonExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]); + } + return true; + } + function parseObject() { + onObjectBegin(); + scanNext(); // consume open brace + var needsComma = false; + while (_scanner.getToken() !== 2 /* CloseBraceToken */ && _scanner.getToken() !== 17 /* EOF */) { + if (_scanner.getToken() === 5 /* CommaToken */) { + if (!needsComma) { + handleError(4 /* ValueExpected */, [], []); + } + onSeparator(','); + scanNext(); // consume comma + if (_scanner.getToken() === 2 /* CloseBraceToken */ && allowTrailingComma) { + break; + } + } + else if (needsComma) { + handleError(6 /* CommaExpected */, [], []); + } + if (!parseProperty()) { + handleError(4 /* ValueExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]); + } + needsComma = true; + } + onObjectEnd(); + if (_scanner.getToken() !== 2 /* CloseBraceToken */) { + handleError(7 /* CloseBraceExpected */, [2 /* CloseBraceToken */], []); + } + else { + scanNext(); // consume close brace + } + return true; + } + function parseArray() { + onArrayBegin(); + scanNext(); // consume open bracket + var needsComma = false; + while (_scanner.getToken() !== 4 /* CloseBracketToken */ && _scanner.getToken() !== 17 /* EOF */) { + if (_scanner.getToken() === 5 /* CommaToken */) { + if (!needsComma) { + handleError(4 /* ValueExpected */, [], []); + } + onSeparator(','); + scanNext(); // consume comma + if (_scanner.getToken() === 4 /* CloseBracketToken */ && allowTrailingComma) { + break; + } + } + else if (needsComma) { + handleError(6 /* CommaExpected */, [], []); + } + if (!parseValue()) { + handleError(4 /* ValueExpected */, [], [4 /* CloseBracketToken */, 5 /* CommaToken */]); + } + needsComma = true; + } + onArrayEnd(); + if (_scanner.getToken() !== 4 /* CloseBracketToken */) { + handleError(8 /* CloseBracketExpected */, [4 /* CloseBracketToken */], []); + } + else { + scanNext(); // consume close bracket + } + return true; + } + function parseValue() { + switch (_scanner.getToken()) { + case 3 /* OpenBracketToken */: + return parseArray(); + case 1 /* OpenBraceToken */: + return parseObject(); + case 10 /* StringLiteral */: + return parseString(true); + default: + return parseLiteral(); + } + } + scanNext(); + if (_scanner.getToken() === 17 /* EOF */) { + if (options.allowEmptyContent) { + return true; + } + handleError(4 /* ValueExpected */, [], []); + return false; + } + if (!parseValue()) { + handleError(4 /* ValueExpected */, [], []); + return false; + } + if (_scanner.getToken() !== 17 /* EOF */) { + handleError(9 /* EndOfFileExpected */, [], []); + } + return true; + } + exports.visit = visit; + /** + * Takes JSON with JavaScript-style comments and remove + * them. Optionally replaces every none-newline character + * of comments with a replaceCharacter + */ + function stripComments(text, replaceCh) { + var _scanner = scanner_1.createScanner(text), parts = [], kind, offset = 0, pos; + do { + pos = _scanner.getPosition(); + kind = _scanner.scan(); + switch (kind) { + case 12 /* LineCommentTrivia */: + case 13 /* BlockCommentTrivia */: + case 17 /* EOF */: + if (offset !== pos) { + parts.push(text.substring(offset, pos)); + } + if (replaceCh !== undefined) { + parts.push(_scanner.getTokenValue().replace(/[^\r\n]/g, replaceCh)); + } + offset = _scanner.getPosition(); + break; + } + } while (kind !== 17 /* EOF */); + return parts.join(''); + } + exports.stripComments = stripComments; + function getNodeType(value) { + switch (typeof value) { + case 'boolean': return 'boolean'; + case 'number': return 'number'; + case 'string': return 'string'; + case 'object': { + if (!value) { + return 'null'; + } + else if (Array.isArray(value)) { + return 'array'; + } + return 'object'; + } + default: return 'null'; + } + } + exports.getNodeType = getNodeType; +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/scanner.js b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/scanner.js new file mode 100644 index 0000000..50f292c --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/impl/scanner.js @@ -0,0 +1,376 @@ +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; + } + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); + } +})(function (require, exports) { + /*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + 'use strict'; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createScanner = void 0; + /** + * Creates a JSON scanner on the given text. + * If ignoreTrivia is set, whitespaces or comments are ignored. + */ + function createScanner(text, ignoreTrivia) { + if (ignoreTrivia === void 0) { ignoreTrivia = false; } + var len = text.length; + var pos = 0, value = '', tokenOffset = 0, token = 16 /* Unknown */, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0 /* None */; + function scanHexDigits(count, exact) { + var digits = 0; + var value = 0; + while (digits < count || !exact) { + var ch = text.charCodeAt(pos); + if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) { + value = value * 16 + ch - 48 /* _0 */; + } + else if (ch >= 65 /* A */ && ch <= 70 /* F */) { + value = value * 16 + ch - 65 /* A */ + 10; + } + else if (ch >= 97 /* a */ && ch <= 102 /* f */) { + value = value * 16 + ch - 97 /* a */ + 10; + } + else { + break; + } + pos++; + digits++; + } + if (digits < count) { + value = -1; + } + return value; + } + function setPosition(newPosition) { + pos = newPosition; + value = ''; + tokenOffset = 0; + token = 16 /* Unknown */; + scanError = 0 /* None */; + } + function scanNumber() { + var start = pos; + if (text.charCodeAt(pos) === 48 /* _0 */) { + pos++; + } + else { + pos++; + while (pos < text.length && isDigit(text.charCodeAt(pos))) { + pos++; + } + } + if (pos < text.length && text.charCodeAt(pos) === 46 /* dot */) { + pos++; + if (pos < text.length && isDigit(text.charCodeAt(pos))) { + pos++; + while (pos < text.length && isDigit(text.charCodeAt(pos))) { + pos++; + } + } + else { + scanError = 3 /* UnexpectedEndOfNumber */; + return text.substring(start, pos); + } + } + var end = pos; + if (pos < text.length && (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */)) { + pos++; + if (pos < text.length && text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) { + pos++; + } + if (pos < text.length && isDigit(text.charCodeAt(pos))) { + pos++; + while (pos < text.length && isDigit(text.charCodeAt(pos))) { + pos++; + } + end = pos; + } + else { + scanError = 3 /* UnexpectedEndOfNumber */; + } + } + return text.substring(start, end); + } + function scanString() { + var result = '', start = pos; + while (true) { + if (pos >= len) { + result += text.substring(start, pos); + scanError = 2 /* UnexpectedEndOfString */; + break; + } + var ch = text.charCodeAt(pos); + if (ch === 34 /* doubleQuote */) { + result += text.substring(start, pos); + pos++; + break; + } + if (ch === 92 /* backslash */) { + result += text.substring(start, pos); + pos++; + if (pos >= len) { + scanError = 2 /* UnexpectedEndOfString */; + break; + } + var ch2 = text.charCodeAt(pos++); + switch (ch2) { + case 34 /* doubleQuote */: + result += '\"'; + break; + case 92 /* backslash */: + result += '\\'; + break; + case 47 /* slash */: + result += '/'; + break; + case 98 /* b */: + result += '\b'; + break; + case 102 /* f */: + result += '\f'; + break; + case 110 /* n */: + result += '\n'; + break; + case 114 /* r */: + result += '\r'; + break; + case 116 /* t */: + result += '\t'; + break; + case 117 /* u */: + var ch3 = scanHexDigits(4, true); + if (ch3 >= 0) { + result += String.fromCharCode(ch3); + } + else { + scanError = 4 /* InvalidUnicode */; + } + break; + default: + scanError = 5 /* InvalidEscapeCharacter */; + } + start = pos; + continue; + } + if (ch >= 0 && ch <= 0x1f) { + if (isLineBreak(ch)) { + result += text.substring(start, pos); + scanError = 2 /* UnexpectedEndOfString */; + break; + } + else { + scanError = 6 /* InvalidCharacter */; + // mark as error but continue with string + } + } + pos++; + } + return result; + } + function scanNext() { + value = ''; + scanError = 0 /* None */; + tokenOffset = pos; + lineStartOffset = lineNumber; + prevTokenLineStartOffset = tokenLineStartOffset; + if (pos >= len) { + // at the end + tokenOffset = len; + return token = 17 /* EOF */; + } + var code = text.charCodeAt(pos); + // trivia: whitespace + if (isWhiteSpace(code)) { + do { + pos++; + value += String.fromCharCode(code); + code = text.charCodeAt(pos); + } while (isWhiteSpace(code)); + return token = 15 /* Trivia */; + } + // trivia: newlines + if (isLineBreak(code)) { + pos++; + value += String.fromCharCode(code); + if (code === 13 /* carriageReturn */ && text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + value += '\n'; + } + lineNumber++; + tokenLineStartOffset = pos; + return token = 14 /* LineBreakTrivia */; + } + switch (code) { + // tokens: []{}:, + case 123 /* openBrace */: + pos++; + return token = 1 /* OpenBraceToken */; + case 125 /* closeBrace */: + pos++; + return token = 2 /* CloseBraceToken */; + case 91 /* openBracket */: + pos++; + return token = 3 /* OpenBracketToken */; + case 93 /* closeBracket */: + pos++; + return token = 4 /* CloseBracketToken */; + case 58 /* colon */: + pos++; + return token = 6 /* ColonToken */; + case 44 /* comma */: + pos++; + return token = 5 /* CommaToken */; + // strings + case 34 /* doubleQuote */: + pos++; + value = scanString(); + return token = 10 /* StringLiteral */; + // comments + case 47 /* slash */: + var start = pos - 1; + // Single-line comment + if (text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + while (pos < len) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + value = text.substring(start, pos); + return token = 12 /* LineCommentTrivia */; + } + // Multi-line comment + if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + pos += 2; + var safeLength = len - 1; // For lookahead. + var commentClosed = false; + while (pos < safeLength) { + var ch = text.charCodeAt(pos); + if (ch === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + commentClosed = true; + break; + } + pos++; + if (isLineBreak(ch)) { + if (ch === 13 /* carriageReturn */ && text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + } + lineNumber++; + tokenLineStartOffset = pos; + } + } + if (!commentClosed) { + pos++; + scanError = 1 /* UnexpectedEndOfComment */; + } + value = text.substring(start, pos); + return token = 13 /* BlockCommentTrivia */; + } + // just a single slash + value += String.fromCharCode(code); + pos++; + return token = 16 /* Unknown */; + // numbers + case 45 /* minus */: + value += String.fromCharCode(code); + pos++; + if (pos === len || !isDigit(text.charCodeAt(pos))) { + return token = 16 /* Unknown */; + } + // found a minus, followed by a number so + // we fall through to proceed with scanning + // numbers + case 48 /* _0 */: + case 49 /* _1 */: + case 50 /* _2 */: + case 51 /* _3 */: + case 52 /* _4 */: + case 53 /* _5 */: + case 54 /* _6 */: + case 55 /* _7 */: + case 56 /* _8 */: + case 57 /* _9 */: + value += scanNumber(); + return token = 11 /* NumericLiteral */; + // literals and unknown symbols + default: + // is a literal? Read the full word. + while (pos < len && isUnknownContentCharacter(code)) { + pos++; + code = text.charCodeAt(pos); + } + if (tokenOffset !== pos) { + value = text.substring(tokenOffset, pos); + // keywords: true, false, null + switch (value) { + case 'true': return token = 8 /* TrueKeyword */; + case 'false': return token = 9 /* FalseKeyword */; + case 'null': return token = 7 /* NullKeyword */; + } + return token = 16 /* Unknown */; + } + // some + value += String.fromCharCode(code); + pos++; + return token = 16 /* Unknown */; + } + } + function isUnknownContentCharacter(code) { + if (isWhiteSpace(code) || isLineBreak(code)) { + return false; + } + switch (code) { + case 125 /* closeBrace */: + case 93 /* closeBracket */: + case 123 /* openBrace */: + case 91 /* openBracket */: + case 34 /* doubleQuote */: + case 58 /* colon */: + case 44 /* comma */: + case 47 /* slash */: + return false; + } + return true; + } + function scanNextNonTrivia() { + var result; + do { + result = scanNext(); + } while (result >= 12 /* LineCommentTrivia */ && result <= 15 /* Trivia */); + return result; + } + return { + setPosition: setPosition, + getPosition: function () { return pos; }, + scan: ignoreTrivia ? scanNextNonTrivia : scanNext, + getToken: function () { return token; }, + getTokenValue: function () { return value; }, + getTokenOffset: function () { return tokenOffset; }, + getTokenLength: function () { return pos - tokenOffset; }, + getTokenStartLine: function () { return lineStartOffset; }, + getTokenStartCharacter: function () { return tokenOffset - prevTokenLineStartOffset; }, + getTokenError: function () { return scanError; }, + }; + } + exports.createScanner = createScanner; + function isWhiteSpace(ch) { + return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ || + ch === 160 /* nonBreakingSpace */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ || + ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */; + } + function isLineBreak(ch) { + return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */; + } + function isDigit(ch) { + return ch >= 48 /* _0 */ && ch <= 57 /* _9 */; + } +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/main.d.ts b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/main.d.ts new file mode 100644 index 0000000..cce5f84 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/main.d.ts @@ -0,0 +1,312 @@ +/** + * Creates a JSON scanner on the given text. + * If ignoreTrivia is set, whitespaces or comments are ignored. + */ +export declare const createScanner: (text: string, ignoreTrivia?: boolean) => JSONScanner; +export declare const enum ScanError { + None = 0, + UnexpectedEndOfComment = 1, + UnexpectedEndOfString = 2, + UnexpectedEndOfNumber = 3, + InvalidUnicode = 4, + InvalidEscapeCharacter = 5, + InvalidCharacter = 6 +} +export declare const enum SyntaxKind { + OpenBraceToken = 1, + CloseBraceToken = 2, + OpenBracketToken = 3, + CloseBracketToken = 4, + CommaToken = 5, + ColonToken = 6, + NullKeyword = 7, + TrueKeyword = 8, + FalseKeyword = 9, + StringLiteral = 10, + NumericLiteral = 11, + LineCommentTrivia = 12, + BlockCommentTrivia = 13, + LineBreakTrivia = 14, + Trivia = 15, + Unknown = 16, + EOF = 17 +} +/** + * The scanner object, representing a JSON scanner at a position in the input string. + */ +export interface JSONScanner { + /** + * Sets the scan position to a new offset. A call to 'scan' is needed to get the first token. + */ + setPosition(pos: number): void; + /** + * Read the next token. Returns the token code. + */ + scan(): SyntaxKind; + /** + * Returns the current scan position, which is after the last read token. + */ + getPosition(): number; + /** + * Returns the last read token. + */ + getToken(): SyntaxKind; + /** + * Returns the last read token value. The value for strings is the decoded string content. For numbers it's of type number, for boolean it's true or false. + */ + getTokenValue(): string; + /** + * The start offset of the last read token. + */ + getTokenOffset(): number; + /** + * The length of the last read token. + */ + getTokenLength(): number; + /** + * The zero-based start line number of the last read token. + */ + getTokenStartLine(): number; + /** + * The zero-based start character (column) of the last read token. + */ + getTokenStartCharacter(): number; + /** + * An error code of the last scan. + */ + getTokenError(): ScanError; +} +/** + * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index. + */ +export declare const getLocation: (text: string, position: number) => Location; +/** + * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + * Therefore, always check the errors list to find out if the input was valid. + */ +export declare const parse: (text: string, errors?: ParseError[], options?: ParseOptions) => any; +/** + * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + */ +export declare const parseTree: (text: string, errors?: ParseError[], options?: ParseOptions) => Node; +/** + * Finds the node at the given path in a JSON DOM. + */ +export declare const findNodeAtLocation: (root: Node, path: JSONPath) => Node | undefined; +/** + * Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset. + */ +export declare const findNodeAtOffset: (root: Node, offset: number, includeRightBound?: boolean) => Node | undefined; +/** + * Gets the JSON path of the given JSON DOM node + */ +export declare const getNodePath: (node: Node) => JSONPath; +/** + * Evaluates the JavaScript object of the given JSON DOM node + */ +export declare const getNodeValue: (node: Node) => any; +/** + * Parses the given text and invokes the visitor functions for each object, array and literal reached. + */ +export declare const visit: (text: string, visitor: JSONVisitor, options?: ParseOptions) => any; +/** + * Takes JSON with JavaScript-style comments and remove + * them. Optionally replaces every none-newline character + * of comments with a replaceCharacter + */ +export declare const stripComments: (text: string, replaceCh?: string) => string; +export interface ParseError { + error: ParseErrorCode; + offset: number; + length: number; +} +export declare const enum ParseErrorCode { + InvalidSymbol = 1, + InvalidNumberFormat = 2, + PropertyNameExpected = 3, + ValueExpected = 4, + ColonExpected = 5, + CommaExpected = 6, + CloseBraceExpected = 7, + CloseBracketExpected = 8, + EndOfFileExpected = 9, + InvalidCommentToken = 10, + UnexpectedEndOfComment = 11, + UnexpectedEndOfString = 12, + UnexpectedEndOfNumber = 13, + InvalidUnicode = 14, + InvalidEscapeCharacter = 15, + InvalidCharacter = 16 +} +export declare function printParseErrorCode(code: ParseErrorCode): "InvalidSymbol" | "InvalidNumberFormat" | "PropertyNameExpected" | "ValueExpected" | "ColonExpected" | "CommaExpected" | "CloseBraceExpected" | "CloseBracketExpected" | "EndOfFileExpected" | "InvalidCommentToken" | "UnexpectedEndOfComment" | "UnexpectedEndOfString" | "UnexpectedEndOfNumber" | "InvalidUnicode" | "InvalidEscapeCharacter" | "InvalidCharacter" | ""; +export declare type NodeType = 'object' | 'array' | 'property' | 'string' | 'number' | 'boolean' | 'null'; +export interface Node { + readonly type: NodeType; + readonly value?: any; + readonly offset: number; + readonly length: number; + readonly colonOffset?: number; + readonly parent?: Node; + readonly children?: Node[]; +} +export declare type Segment = string | number; +export declare type JSONPath = Segment[]; +export interface Location { + /** + * The previous property key or literal value (string, number, boolean or null) or undefined. + */ + previousNode?: Node; + /** + * The path describing the location in the JSON document. The path consists of a sequence of strings + * representing an object property or numbers for array indices. + */ + path: JSONPath; + /** + * Matches the locations path against a pattern consisting of strings (for properties) and numbers (for array indices). + * '*' will match a single segment of any property name or index. + * '**' will match a sequence of segments of any property name or index, or no segment. + */ + matches: (patterns: JSONPath) => boolean; + /** + * If set, the location's offset is at a property key. + */ + isAtPropertyKey: boolean; +} +export interface ParseOptions { + disallowComments?: boolean; + allowTrailingComma?: boolean; + allowEmptyContent?: boolean; +} +export interface JSONVisitor { + /** + * Invoked when an open brace is encountered and an object is started. The offset and length represent the location of the open brace. + */ + onObjectBegin?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a property is encountered. The offset and length represent the location of the property name. + */ + onObjectProperty?: (property: string, offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a closing brace is encountered and an object is completed. The offset and length represent the location of the closing brace. + */ + onObjectEnd?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when an open bracket is encountered. The offset and length represent the location of the open bracket. + */ + onArrayBegin?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a closing bracket is encountered. The offset and length represent the location of the closing bracket. + */ + onArrayEnd?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a literal value is encountered. The offset and length represent the location of the literal value. + */ + onLiteralValue?: (value: any, offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked when a comma or colon separator is encountered. The offset and length represent the location of the separator. + */ + onSeparator?: (character: string, offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * When comments are allowed, invoked when a line or block comment is encountered. The offset and length represent the location of the comment. + */ + onComment?: (offset: number, length: number, startLine: number, startCharacter: number) => void; + /** + * Invoked on an error. + */ + onError?: (error: ParseErrorCode, offset: number, length: number, startLine: number, startCharacter: number) => void; +} +/** + * Represents a text modification + */ +export interface Edit { + /** + * The start offset of the modification. + */ + offset: number; + /** + * The length of the modification. Must not be negative. Empty length represents an *insert*. + */ + length: number; + /** + * The new content. Empty content represents a *remove*. + */ + content: string; +} +/** + * A text range in the document +*/ +export interface Range { + /** + * The start offset of the range. + */ + offset: number; + /** + * The length of the range. Must not be negative. + */ + length: number; +} +export interface FormattingOptions { + /** + * If indentation is based on spaces (`insertSpaces` = true), the number of spaces that make an indent. + */ + tabSize?: number; + /** + * Is indentation based on spaces? + */ + insertSpaces?: boolean; + /** + * The default 'end of line' character. If not set, '\n' is used as default. + */ + eol?: string; +} +/** + * Computes the edits needed to format a JSON document. + * + * @param documentText The input text + * @param range The range to format or `undefined` to format the full content + * @param options The formatting options + * @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or + * removals of text segments. All offsets refer to the original state of the document. No two edits must change or remove the same range of + * text in the original document. However, multiple edits can have + * the same offset, for example multiple inserts, or an insert followed by a remove or replace. The order in the array defines which edit is applied first. + * To apply edits to an input, you can use `applyEdits`. + */ +export declare function format(documentText: string, range: Range | undefined, options: FormattingOptions): Edit[]; +/** + * Options used when computing the modification edits + */ +export interface ModificationOptions { + /** + * Formatting options. If undefined, the newly inserted code will be inserted unformatted. + */ + formattingOptions?: FormattingOptions; + /** + * Default false. If `JSONPath` refers to an index of an array and {@property isArrayInsertion} is `true`, then + * {@function modify} will insert a new item at that location instead of overwriting its contents. + */ + isArrayInsertion?: boolean; + /** + * Optional function to define the insertion index given an existing list of properties. + */ + getInsertionIndex?: (properties: string[]) => number; +} +/** + * Computes the edits needed to modify a value in the JSON document. + * + * @param documentText The input text + * @param path The path of the value to change. The path represents either to the document root, a property or an array item. + * If the path points to an non-existing property or item, it will be created. + * @param value The new value for the specified property or item. If the value is undefined, + * the property or item will be removed. + * @param options Options + * @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or + * removals of text segments. All offsets refer to the original state of the document. No two edits must change or remove the same range of + * text in the original document. However, multiple edits can have + * the same offset, for example multiple inserts, or an insert followed by a remove or replace. The order in the array defines which edit is applied first. + * To apply edits to an input, you can use `applyEdits`. + */ +export declare function modify(text: string, path: JSONPath, value: any, options: ModificationOptions): Edit[]; +/** + * Applies edits to a input string. + */ +export declare function applyEdits(text: string, edits: Edit[]): string; diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/main.js b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/main.js new file mode 100644 index 0000000..e89639b --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/lib/umd/main.js @@ -0,0 +1,132 @@ +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; + } + else if (typeof define === "function" && define.amd) { + define(["require", "exports", "./impl/format", "./impl/edit", "./impl/scanner", "./impl/parser"], factory); + } +})(function (require, exports) { + /*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + 'use strict'; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.applyEdits = exports.modify = exports.format = exports.printParseErrorCode = exports.stripComments = exports.visit = exports.getNodeValue = exports.getNodePath = exports.findNodeAtOffset = exports.findNodeAtLocation = exports.parseTree = exports.parse = exports.getLocation = exports.createScanner = void 0; + var formatter = require("./impl/format"); + var edit = require("./impl/edit"); + var scanner = require("./impl/scanner"); + var parser = require("./impl/parser"); + /** + * Creates a JSON scanner on the given text. + * If ignoreTrivia is set, whitespaces or comments are ignored. + */ + exports.createScanner = scanner.createScanner; + /** + * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index. + */ + exports.getLocation = parser.getLocation; + /** + * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + * Therefore, always check the errors list to find out if the input was valid. + */ + exports.parse = parser.parse; + /** + * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. + */ + exports.parseTree = parser.parseTree; + /** + * Finds the node at the given path in a JSON DOM. + */ + exports.findNodeAtLocation = parser.findNodeAtLocation; + /** + * Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset. + */ + exports.findNodeAtOffset = parser.findNodeAtOffset; + /** + * Gets the JSON path of the given JSON DOM node + */ + exports.getNodePath = parser.getNodePath; + /** + * Evaluates the JavaScript object of the given JSON DOM node + */ + exports.getNodeValue = parser.getNodeValue; + /** + * Parses the given text and invokes the visitor functions for each object, array and literal reached. + */ + exports.visit = parser.visit; + /** + * Takes JSON with JavaScript-style comments and remove + * them. Optionally replaces every none-newline character + * of comments with a replaceCharacter + */ + exports.stripComments = parser.stripComments; + function printParseErrorCode(code) { + switch (code) { + case 1 /* InvalidSymbol */: return 'InvalidSymbol'; + case 2 /* InvalidNumberFormat */: return 'InvalidNumberFormat'; + case 3 /* PropertyNameExpected */: return 'PropertyNameExpected'; + case 4 /* ValueExpected */: return 'ValueExpected'; + case 5 /* ColonExpected */: return 'ColonExpected'; + case 6 /* CommaExpected */: return 'CommaExpected'; + case 7 /* CloseBraceExpected */: return 'CloseBraceExpected'; + case 8 /* CloseBracketExpected */: return 'CloseBracketExpected'; + case 9 /* EndOfFileExpected */: return 'EndOfFileExpected'; + case 10 /* InvalidCommentToken */: return 'InvalidCommentToken'; + case 11 /* UnexpectedEndOfComment */: return 'UnexpectedEndOfComment'; + case 12 /* UnexpectedEndOfString */: return 'UnexpectedEndOfString'; + case 13 /* UnexpectedEndOfNumber */: return 'UnexpectedEndOfNumber'; + case 14 /* InvalidUnicode */: return 'InvalidUnicode'; + case 15 /* InvalidEscapeCharacter */: return 'InvalidEscapeCharacter'; + case 16 /* InvalidCharacter */: return 'InvalidCharacter'; + } + return ''; + } + exports.printParseErrorCode = printParseErrorCode; + /** + * Computes the edits needed to format a JSON document. + * + * @param documentText The input text + * @param range The range to format or `undefined` to format the full content + * @param options The formatting options + * @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or + * removals of text segments. All offsets refer to the original state of the document. No two edits must change or remove the same range of + * text in the original document. However, multiple edits can have + * the same offset, for example multiple inserts, or an insert followed by a remove or replace. The order in the array defines which edit is applied first. + * To apply edits to an input, you can use `applyEdits`. + */ + function format(documentText, range, options) { + return formatter.format(documentText, range, options); + } + exports.format = format; + /** + * Computes the edits needed to modify a value in the JSON document. + * + * @param documentText The input text + * @param path The path of the value to change. The path represents either to the document root, a property or an array item. + * If the path points to an non-existing property or item, it will be created. + * @param value The new value for the specified property or item. If the value is undefined, + * the property or item will be removed. + * @param options Options + * @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or + * removals of text segments. All offsets refer to the original state of the document. No two edits must change or remove the same range of + * text in the original document. However, multiple edits can have + * the same offset, for example multiple inserts, or an insert followed by a remove or replace. The order in the array defines which edit is applied first. + * To apply edits to an input, you can use `applyEdits`. + */ + function modify(text, path, value, options) { + return edit.setProperty(text, path, value, options); + } + exports.modify = modify; + /** + * Applies edits to a input string. + */ + function applyEdits(text, edits) { + for (var i = edits.length - 1; i >= 0; i--) { + text = edit.applyEdit(text, edits[i]); + } + return text; + } + exports.applyEdits = applyEdits; +}); diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/package.json b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/package.json new file mode 100644 index 0000000..28fef6b --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/jsonc-parser/package.json @@ -0,0 +1,40 @@ +{ + "name": "jsonc-parser", + "version": "2.3.1", + "description": "Scanner and parser for JSON with comments.", + "main": "./lib/umd/main.js", + "typings": "./lib/umd/main", + "module": "./lib/esm/main.js", + "author": "Microsoft Corporation", + "repository": { + "type": "git", + "url": "https://github.com/microsoft/node-jsonc-parser" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/microsoft/node-jsonc-parser/issues" + }, + "devDependencies": { + "mocha": "^8.1.3", + "typescript": "^4.0.2", + "@types/node": "^10.12.12", + "@types/mocha": "^5.2.7", + "@typescript-eslint/eslint-plugin": "^4.1.1", + "@typescript-eslint/parser": "^4.1.1", + "eslint": "^7.9.0", + "rimraf": "^3.0.2" + }, + "scripts": { + "prepublishOnly": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs", + "postpublish": "node ./build/post-publish.js", + "compile": "tsc -p ./src && npm run lint", + "compile-esm": "tsc -p ./src/tsconfig.esm.json", + "remove-sourcemap-refs": "node ./build/remove-sourcemap-refs.js", + "clean": "rimraf lib", + "watch": "tsc -w -p ./src", + "test": "npm run compile && mocha ./lib/umd/test", + "lint": "eslint src/**/*.ts", + "preversion": "npm test", + "postversion": "git push && git push --tags" + } +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/ms/index.js b/coc/extensions/node_modules/coc-yaml/node_modules/ms/index.js new file mode 100644 index 0000000..6a522b1 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/ms/index.js @@ -0,0 +1,152 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + 'd'; + } + if (ms >= h) { + return Math.round(ms / h) + 'h'; + } + if (ms >= m) { + return Math.round(ms / m) + 'm'; + } + if (ms >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/ms/license.md b/coc/extensions/node_modules/coc-yaml/node_modules/ms/license.md new file mode 100644 index 0000000..69b6125 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +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/coc/extensions/node_modules/coc-yaml/node_modules/ms/package.json b/coc/extensions/node_modules/coc-yaml/node_modules/ms/package.json new file mode 100644 index 0000000..6a31c81 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/ms/package.json @@ -0,0 +1,37 @@ +{ + "name": "ms", + "version": "2.0.0", + "description": "Tiny milisecond conversion utility", + "repository": "zeit/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "3.19.0", + "expect.js": "0.3.1", + "husky": "0.13.3", + "lint-staged": "3.4.1", + "mocha": "3.4.1" + } +} diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/ms/readme.md b/coc/extensions/node_modules/coc-yaml/node_modules/ms/readme.md new file mode 100644 index 0000000..84a9974 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/ms/readme.md @@ -0,0 +1,51 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +``` + +### Convert from milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(ms('10 hours')) // "10h" +``` + +### Time format written-out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [node](https://nodejs.org) and in the browser. +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of equivalent ms is returned. + +## Caught a bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/prettier/LICENSE b/coc/extensions/node_modules/coc-yaml/node_modules/prettier/LICENSE new file mode 100755 index 0000000..5767e34 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/prettier/LICENSE @@ -0,0 +1,7 @@ +Copyright © James Long and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/prettier/README.md b/coc/extensions/node_modules/coc-yaml/node_modules/prettier/README.md new file mode 100755 index 0000000..76f2e04 --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/prettier/README.md @@ -0,0 +1,111 @@ +![Prettier Banner](https://raw.githubusercontent.com/prettier/prettier-logo/master/images/prettier-banner-light.png) + +

Opinionated Code Formatter

+ +

+ + JavaScript + · TypeScript + · Flow + · JSX + · JSON + +
+ + CSS + · SCSS + · Less + +
+ + HTML + · Vue + · Angular + +
+ + GraphQL + · Markdown + · YAML + +
+ + + Your favorite language? + + +

+ +

+ + Github Actions Build Status + + Github Actions Build Status + + Github Actions Build Status + + Codecov Coverage Status + + Blazing Fast +
+ + npm version + + weekly downloads from npm + + code style: prettier + + Chat on Gitter + + Follow Prettier on Twitter +

+ +## Intro + +Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary. + +### Input + + +```js +foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne()); +``` + +### Output + +```js +foo( + reallyLongArg(), + omgSoManyParameters(), + IShouldRefactorThis(), + isThereSeriouslyAnotherOne() +); +``` + +Prettier can be run [in your editor](http://prettier.io/docs/en/editors.html) on-save, in a [pre-commit hook](https://prettier.io/docs/en/precommit.html), or in [CI environments](https://prettier.io/docs/en/cli.html#list-different) to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again! + +--- + +**[Documentation](https://prettier.io/docs/en/)** + + +[Install](https://prettier.io/docs/en/install.html) · +[Options](https://prettier.io/docs/en/options.html) · +[CLI](https://prettier.io/docs/en/cli.html) · +[API](https://prettier.io/docs/en/api.html) + +**[Playground](https://prettier.io/playground/)** + +--- + +## Badge + +Show the world you're using _Prettier_ → [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) + +```md +[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) +``` + +## Contributing + +See [CONTRIBUTING.md](CONTRIBUTING.md). diff --git a/coc/extensions/node_modules/coc-yaml/node_modules/prettier/bin-prettier.js b/coc/extensions/node_modules/coc-yaml/node_modules/prettier/bin-prettier.js new file mode 100755 index 0000000..6acda2d --- /dev/null +++ b/coc/extensions/node_modules/coc-yaml/node_modules/prettier/bin-prettier.js @@ -0,0 +1,54351 @@ +#!/usr/bin/env node +'use strict'; + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var fs$3 = _interopDefault(require('fs')); +var path$2 = _interopDefault(require('path')); +var os$1 = _interopDefault(require('os')); +var tty$1 = _interopDefault(require('tty')); +var assert$1 = _interopDefault(require('assert')); +var util$4 = _interopDefault(require('util')); +var stream$6 = _interopDefault(require('stream')); +var events$1 = _interopDefault(require('events')); +var readline$1 = _interopDefault(require('readline')); + +var semverCompare = function cmp(a, b) { + var pa = a.split('.'); + var pb = b.split('.'); + + for (var i = 0; i < 3; i++) { + var na = Number(pa[i]); + var nb = Number(pb[i]); + if (na > nb) return 1; + if (nb > na) return -1; + if (!isNaN(na) && isNaN(nb)) return 1; + if (isNaN(na) && !isNaN(nb)) return -1; + } + + return 0; +}; + +var pleaseUpgradeNode = function pleaseUpgradeNode(pkg, opts) { + var opts = opts || {}; + var requiredVersion = pkg.engines.node.replace('>=', ''); + var currentVersion = process.version.replace('v', ''); + + if (semverCompare(currentVersion, requiredVersion) === -1) { + if (opts.message) { + console.error(opts.message(requiredVersion)); + } else { + console.error(pkg.name + ' requires at least version ' + requiredVersion + ' of Node, please upgrade'); + } + + if (opts.hasOwnProperty('exitCode')) { + process.exit(opts.exitCode); + } else { + process.exit(1); + } + } +}; + +var name = "prettier"; +var version = "2.0.5"; +var description = "Prettier is an opinionated code formatter"; +var bin = "./bin/prettier.js"; +var repository = "prettier/prettier"; +var homepage = "https://prettier.io"; +var author = "James Long"; +var license = "MIT"; +var main = "./index.js"; +var engines = { + node: ">=10.13.0" +}; +var dependencies = { + "@angular/compiler": "9.0.5", + "@babel/code-frame": "7.8.0", + "@babel/parser": "7.9.4", + "@glimmer/syntax": "0.50.0", + "@iarna/toml": "2.2.3", + "@typescript-eslint/typescript-estree": "2.26.0", + "angular-estree-parser": "1.3.0", + "angular-html-parser": "1.4.0", + camelcase: "5.3.1", + chalk: "4.0.0", + "ci-info": "watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540", + "cjk-regex": "2.0.0", + cosmiconfig: "6.0.0", + dashify: "2.0.0", + dedent: "0.7.0", + diff: "4.0.2", + editorconfig: "0.15.3", + "editorconfig-to-prettier": "0.1.1", + "escape-string-regexp": "2.0.0", + esutils: "2.0.3", + "fast-glob": "3.2.2", + "find-parent-dir": "0.3.0", + "find-project-root": "1.1.1", + "flow-parser": "0.122.0", + "get-stream": "5.1.0", + globby: "11.0.0", + graphql: "15.0.0", + "html-element-attributes": "2.2.1", + "html-styles": "1.0.0", + "html-tag-names": "1.1.5", + ignore: "4.0.6", + "jest-docblock": "25.2.6", + "json-stable-stringify": "1.0.1", + leven: "3.1.0", + "lines-and-columns": "1.1.6", + "linguist-languages": "7.9.0", + lodash: "4.17.15", + mem: "6.0.1", + minimatch: "3.0.4", + minimist: "1.2.5", + "n-readlines": "1.0.0", + "please-upgrade-node": "3.2.0", + "postcss-less": "3.1.4", + "postcss-media-query-parser": "0.2.3", + "postcss-scss": "2.0.0", + "postcss-selector-parser": "2.2.3", + "postcss-values-parser": "2.0.1", + "regexp-util": "1.2.2", + "remark-math": "1.0.6", + "remark-parse": "5.0.0", + resolve: "1.16.1", + semver: "7.1.3", + srcset: "2.0.1", + "string-width": "4.2.0", + typescript: "3.8.3", + "unicode-regex": "3.0.0", + unified: "9.0.0", + vnopts: "1.0.2", + "yaml-unist-parser": "1.1.1" +}; +var devDependencies = { + "@babel/core": "7.9.0", + "@babel/preset-env": "7.9.0", + "@rollup/plugin-alias": "3.0.1", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "4.0.2", + "@rollup/plugin-node-resolve": "7.1.1", + "@rollup/plugin-replace": "2.3.1", + "babel-loader": "8.1.0", + benchmark: "2.1.4", + "builtin-modules": "3.1.0", + codecov: "3.6.5", + "cross-env": "7.0.2", + cspell: "4.0.55", + eslint: "6.8.0", + "eslint-config-prettier": "6.10.1", + "eslint-formatter-friendly": "7.0.0", + "eslint-plugin-import": "2.20.2", + "eslint-plugin-prettier": "3.1.2", + "eslint-plugin-react": "7.19.0", + "eslint-plugin-unicorn": "18.0.1", + execa: "4.0.0", + jest: "25.2.7", + "jest-snapshot-serializer-ansi": "1.0.0", + "jest-snapshot-serializer-raw": "1.1.0", + "jest-watch-typeahead": "0.5.0", + prettier: "2.0.4", + rimraf: "3.0.2", + rollup: "2.3.2", + "rollup-plugin-babel": "4.4.0", + "rollup-plugin-node-globals": "1.4.0", + "rollup-plugin-terser": "5.3.0", + shelljs: "0.8.3", + "snapshot-diff": "0.7.0", + "strip-ansi": "6.0.0", + "synchronous-promise": "2.0.10", + tempy: "0.5.0", + "terser-webpack-plugin": "2.3.5", + webpack: "4.42.1" +}; +var scripts = { + prepublishOnly: "echo \"Error: must publish from dist/\" && exit 1", + "prepare-release": "yarn && yarn build && yarn test:dist", + test: "jest", + "test:dist": "cross-env NODE_ENV=production jest", + "test:dist-standalone": "cross-env NODE_ENV=production TEST_STANDALONE=1 jest tests/", + "test:integration": "jest tests_integration", + "perf:repeat": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null", + "perf:repeat-inspect": "yarn && yarn build && cross-env NODE_ENV=production node --inspect-brk ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null", + "perf:benchmark": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-benchmark --loglevel debug ${PERF_FILE:-./index.js} > /dev/null", + "lint:typecheck": "tsc", + "lint:eslint": "cross-env EFF_NO_LINK_RULES=true eslint . --format friendly", + "lint:changelog": "node ./scripts/lint-changelog.js", + "lint:prettier": "prettier \"**/*.{md,json,yml,html,css}\" --check", + "lint:dist": "eslint --no-eslintrc --no-ignore --env=es6,browser --parser-options=ecmaVersion:2016 \"dist/!(bin-prettier|index|third-party).js\"", + "lint:spellcheck": "cspell {bin,scripts,src,website}/**/*.js {docs,website/blog,changelog_unreleased}/**/*.md", + "lint:deps": "node ./scripts/check-deps.js", + build: "node --max-old-space-size=3072 ./scripts/build/build.js", + "build-docs": "node ./scripts/build-docs.js" +}; +var _package = { + name: name, + version: version, + description: description, + bin: bin, + repository: repository, + homepage: homepage, + author: author, + license: license, + main: main, + engines: engines, + dependencies: dependencies, + devDependencies: devDependencies, + scripts: scripts +}; + +var _package$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name, + version: version, + description: description, + bin: bin, + repository: repository, + homepage: homepage, + author: author, + license: license, + main: main, + engines: engines, + dependencies: dependencies, + devDependencies: devDependencies, + scripts: scripts, + 'default': _package +}); + +function Diff() {} + +Diff.prototype = { + diff: function diff(oldString, newString) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var callback = options.callback; + + if (typeof options === 'function') { + callback = options; + options = {}; + } + + this.options = options; + var self = this; + + function done(value) { + if (callback) { + setTimeout(function () { + callback(undefined, value); + }, 0); + return true; + } else { + return value; + } + } // Allow subclasses to massage the input prior to running + + + oldString = this.castInput(oldString); + newString = this.castInput(newString); + oldString = this.removeEmpty(this.tokenize(oldString)); + newString = this.removeEmpty(this.tokenize(newString)); + var newLen = newString.length, + oldLen = oldString.length; + var editLength = 1; + var maxEditLength = newLen + oldLen; + var bestPath = [{ + newPos: -1, + components: [] + }]; // Seed editLength = 0, i.e. the content starts with the same values + + var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); + + if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { + // Identity per the equality and tokenizer + return done([{ + value: this.join(newString), + count: newString.length + }]); + } // Main worker method. checks all permutations of a given edit length for acceptance. + + + function execEditLength() { + for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { + var basePath = void 0; + + var addPath = bestPath[diagonalPath - 1], + removePath = bestPath[diagonalPath + 1], + _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; + + if (addPath) { + // No one else is going to attempt to use this value, clear it + bestPath[diagonalPath - 1] = undefined; + } + + var canAdd = addPath && addPath.newPos + 1 < newLen, + canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; + + if (!canAdd && !canRemove) { + // If this path is a terminal then prune + bestPath[diagonalPath] = undefined; + continue; + } // Select the diagonal that we want to branch from. We select the prior + // path whose position in the new string is the farthest from the origin + // and does not pass the bounds of the diff graph + + + if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { + basePath = clonePath(removePath); + self.pushComponent(basePath.components, undefined, true); + } else { + basePath = addPath; // No need to clone, we've pulled it from the list + + basePath.newPos++; + self.pushComponent(basePath.components, true, undefined); + } + + _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done + + if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { + return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); + } else { + // Otherwise track this path as a potential candidate and continue. + bestPath[diagonalPath] = basePath; + } + } + + editLength++; + } // Performs the length of edit iteration. Is a bit fugly as this has to support the + // sync and async mode which is never fun. Loops over execEditLength until a value + // is produced. + + + if (callback) { + (function exec() { + setTimeout(function () { + // This should not happen, but we want to be safe. + + /* istanbul ignore next */ + if (editLength > maxEditLength) { + return callback(); + } + + if (!execEditLength()) { + exec(); + } + }, 0); + })(); + } else { + while (editLength <= maxEditLength) { + var ret = execEditLength(); + + if (ret) { + return ret; + } + } + } + }, + pushComponent: function pushComponent(components, added, removed) { + var last = components[components.length - 1]; + + if (last && last.added === added && last.removed === removed) { + // We need to clone here as the component clone operation is just + // as shallow array clone + components[components.length - 1] = { + count: last.count + 1, + added: added, + removed: removed + }; + } else { + components.push({ + count: 1, + added: added, + removed: removed + }); + } + }, + extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { + var newLen = newString.length, + oldLen = oldString.length, + newPos = basePath.newPos, + oldPos = newPos - diagonalPath, + commonCount = 0; + + while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { + newPos++; + oldPos++; + commonCount++; + } + + if (commonCount) { + basePath.components.push({ + count: commonCount + }); + } + + basePath.newPos = newPos; + return oldPos; + }, + equals: function equals(left, right) { + if (this.options.comparator) { + return this.options.comparator(left, right); + } else { + return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); + } + }, + removeEmpty: function removeEmpty(array) { + var ret = []; + + for (var i = 0; i < array.length; i++) { + if (array[i]) { + ret.push(array[i]); + } + } + + return ret; + }, + castInput: function castInput(value) { + return value; + }, + tokenize: function tokenize(value) { + return value.split(''); + }, + join: function join(chars) { + return chars.join(''); + } +}; + +function buildValues(diff, components, newString, oldString, useLongestToken) { + var componentPos = 0, + componentLen = components.length, + newPos = 0, + oldPos = 0; + + for (; componentPos < componentLen; componentPos++) { + var component = components[componentPos]; + + if (!component.removed) { + if (!component.added && useLongestToken) { + var value = newString.slice(newPos, newPos + component.count); + value = value.map(function (value, i) { + var oldValue = oldString[oldPos + i]; + return oldValue.length > value.length ? oldValue : value; + }); + component.value = diff.join(value); + } else { + component.value = diff.join(newString.slice(newPos, newPos + component.count)); + } + + newPos += component.count; // Common case + + if (!component.added) { + oldPos += component.count; + } + } else { + component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); + oldPos += component.count; // Reverse add and remove so removes are output first to match common convention + // The diffing algorithm is tied to add then remove output and this is the simplest + // route to get the desired output with minimal overhead. + + if (componentPos && components[componentPos - 1].added) { + var tmp = components[componentPos - 1]; + components[componentPos - 1] = components[componentPos]; + components[componentPos] = tmp; + } + } + } // Special case handle for when one terminal is ignored (i.e. whitespace). + // For this case we merge the terminal into the prior string and drop the change. + // This is only available for string mode. + + + var lastComponent = components[componentLen - 1]; + + if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { + components[componentLen - 2].value += lastComponent.value; + components.pop(); + } + + return components; +} + +function clonePath(path) { + return { + newPos: path.newPos, + components: path.components.slice(0) + }; +} + +var characterDiff = new Diff(); + +function diffChars(oldStr, newStr, options) { + return characterDiff.diff(oldStr, newStr, options); +} + +function generateOptions(options, defaults) { + if (typeof options === 'function') { + defaults.callback = options; + } else if (options) { + for (var name in options) { + /* istanbul ignore else */ + if (options.hasOwnProperty(name)) { + defaults[name] = options[name]; + } + } + } + + return defaults; +} // +// Ranges and exceptions: +// Latin-1 Supplement, 0080–00FF +// - U+00D7 × Multiplication sign +// - U+00F7 ÷ Division sign +// Latin Extended-A, 0100–017F +// Latin Extended-B, 0180–024F +// IPA Extensions, 0250–02AF +// Spacing Modifier Letters, 02B0–02FF +// - U+02C7 ˇ ˇ Caron +// - U+02D8 ˘ ˘ Breve +// - U+02D9 ˙ ˙ Dot Above +// - U+02DA ˚ ˚ Ring Above +// - U+02DB ˛ ˛ Ogonek +// - U+02DC ˜ ˜ Small Tilde +// - U+02DD ˝ ˝ Double Acute Accent +// Latin Extended Additional, 1E00–1EFF + + +var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; +var reWhitespace = /\S/; +var wordDiff = new Diff(); + +wordDiff.equals = function (left, right) { + if (this.options.ignoreCase) { + left = left.toLowerCase(); + right = right.toLowerCase(); + } + + return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); +}; + +wordDiff.tokenize = function (value) { + var tokens = value.split(/(\s+|[()[\]{}'"]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. + + for (var i = 0; i < tokens.length - 1; i++) { + // If we have an empty string in the next field and we have only word chars before and after, merge + if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { + tokens[i] += tokens[i + 2]; + tokens.splice(i + 1, 2); + i--; + } + } + + return tokens; +}; + +function diffWords(oldStr, newStr, options) { + options = generateOptions(options, { + ignoreWhitespace: true + }); + return wordDiff.diff(oldStr, newStr, options); +} + +function diffWordsWithSpace(oldStr, newStr, options) { + return wordDiff.diff(oldStr, newStr, options); +} + +var lineDiff = new Diff(); + +lineDiff.tokenize = function (value) { + var retLines = [], + linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line + + if (!linesAndNewlines[linesAndNewlines.length - 1]) { + linesAndNewlines.pop(); + } // Merge the content and line separators into single tokens + + + for (var i = 0; i < linesAndNewlines.length; i++) { + var line = linesAndNewlines[i]; + + if (i % 2 && !this.options.newlineIsToken) { + retLines[retLines.length - 1] += line; + } else { + if (this.options.ignoreWhitespace) { + line = line.trim(); + } + + retLines.push(line); + } + } + + return retLines; +}; + +function diffLines(oldStr, newStr, callback) { + return lineDiff.diff(oldStr, newStr, callback); +} + +function diffTrimmedLines(oldStr, newStr, callback) { + var options = generateOptions(callback, { + ignoreWhitespace: true + }); + return lineDiff.diff(oldStr, newStr, options); +} + +var sentenceDiff = new Diff(); + +sentenceDiff.tokenize = function (value) { + return value.split(/(\S.+?[.!?])(?=\s+|$)/); +}; + +function diffSentences(oldStr, newStr, callback) { + return sentenceDiff.diff(oldStr, newStr, callback); +} + +var cssDiff = new Diff(); + +cssDiff.tokenize = function (value) { + return value.split(/([{}:;,]|\s+)/); +}; + +function diffCss(oldStr, newStr, callback) { + return cssDiff.diff(oldStr, newStr, callback); +} + +function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); +} + +function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); +} + +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } +} + +function _iterableToArray(iter) { + if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); +} + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance"); +} + +var objectPrototypeToString = Object.prototype.toString; +var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a +// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: + +jsonDiff.useLongestToken = true; +jsonDiff.tokenize = lineDiff.tokenize; + +jsonDiff.castInput = function (value) { + var _this$options = this.options, + undefinedReplacement = _this$options.undefinedReplacement, + _this$options$stringi = _this$options.stringifyReplacer, + stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) { + return typeof v === 'undefined' ? undefinedReplacement : v; + } : _this$options$stringi; + return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); +}; + +jsonDiff.equals = function (left, right) { + return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')); +}; + +function diffJson(oldObj, newObj, options) { + return jsonDiff.diff(oldObj, newObj, options); +} // This function handles the presence of circular references by bailing out when encountering an +// object that is already on the "stack" of items being processed. Accepts an optional replacer + + +function canonicalize(obj, stack, replacementStack, replacer, key) { + stack = stack || []; + replacementStack = replacementStack || []; + + if (replacer) { + obj = replacer(key, obj); + } + + var i; + + for (i = 0; i < stack.length; i += 1) { + if (stack[i] === obj) { + return replacementStack[i]; + } + } + + var canonicalizedObj; + + if ('[object Array]' === objectPrototypeToString.call(obj)) { + stack.push(obj); + canonicalizedObj = new Array(obj.length); + replacementStack.push(canonicalizedObj); + + for (i = 0; i < obj.length; i += 1) { + canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); + } + + stack.pop(); + replacementStack.pop(); + return canonicalizedObj; + } + + if (obj && obj.toJSON) { + obj = obj.toJSON(); + } + + if (_typeof(obj) === 'object' && obj !== null) { + stack.push(obj); + canonicalizedObj = {}; + replacementStack.push(canonicalizedObj); + + var sortedKeys = [], + _key; + + for (_key in obj) { + /* istanbul ignore else */ + if (obj.hasOwnProperty(_key)) { + sortedKeys.push(_key); + } + } + + sortedKeys.sort(); + + for (i = 0; i < sortedKeys.length; i += 1) { + _key = sortedKeys[i]; + canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); + } + + stack.pop(); + replacementStack.pop(); + } else { + canonicalizedObj = obj; + } + + return canonicalizedObj; +} + +var arrayDiff = new Diff(); + +arrayDiff.tokenize = function (value) { + return value.slice(); +}; + +arrayDiff.join = arrayDiff.removeEmpty = function (value) { + return value; +}; + +function diffArrays(oldArr, newArr, callback) { + return arrayDiff.diff(oldArr, newArr, callback); +} + +function parsePatch(uniDiff) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), + delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], + list = [], + i = 0; + + function parseIndex() { + var index = {}; + list.push(index); // Parse diff metadata + + while (i < diffstr.length) { + var line = diffstr[i]; // File header found, end parsing diff metadata + + if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { + break; + } // Diff index + + + var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); + + if (header) { + index.index = header[1]; + } + + i++; + } // Parse file headers if they are defined. Unified diff requires them, but + // there's no technical issues to have an isolated hunk without file header + + + parseFileHeader(index); + parseFileHeader(index); // Parse hunks + + index.hunks = []; + + while (i < diffstr.length) { + var _line = diffstr[i]; + + if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) { + break; + } else if (/^@@/.test(_line)) { + index.hunks.push(parseHunk()); + } else if (_line && options.strict) { + // Ignore unexpected content unless in strict mode + throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); + } else { + i++; + } + } + } // Parses the --- and +++ headers, if none are found, no lines + // are consumed. + + + function parseFileHeader(index) { + var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]); + + if (fileHeader) { + var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; + var data = fileHeader[2].split('\t', 2); + var fileName = data[0].replace(/\\\\/g, '\\'); + + if (/^".*"$/.test(fileName)) { + fileName = fileName.substr(1, fileName.length - 2); + } + + index[keyPrefix + 'FileName'] = fileName; + index[keyPrefix + 'Header'] = (data[1] || '').trim(); + i++; + } + } // Parses a hunk + // This assumes that we are at the start of a hunk. + + + function parseHunk() { + var chunkHeaderIndex = i, + chunkHeaderLine = diffstr[i++], + chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); + var hunk = { + oldStart: +chunkHeader[1], + oldLines: +chunkHeader[2] || 1, + newStart: +chunkHeader[3], + newLines: +chunkHeader[4] || 1, + lines: [], + linedelimiters: [] + }; + var addCount = 0, + removeCount = 0; + + for (; i < diffstr.length; i++) { + // Lines starting with '---' could be mistaken for the "remove line" operation + // But they could be the header for the next file. Therefore prune such cases out. + if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) { + break; + } + + var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; + + if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { + hunk.lines.push(diffstr[i]); + hunk.linedelimiters.push(delimiters[i] || '\n'); + + if (operation === '+') { + addCount++; + } else if (operation === '-') { + removeCount++; + } else if (operation === ' ') { + addCount++; + removeCount++; + } + } else { + break; + } + } // Handle the empty block count case + + + if (!addCount && hunk.newLines === 1) { + hunk.newLines = 0; + } + + if (!removeCount && hunk.oldLines === 1) { + hunk.oldLines = 0; + } // Perform optional sanity checking + + + if (options.strict) { + if (addCount !== hunk.newLines) { + throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + + if (removeCount !== hunk.oldLines) { + throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + } + + return hunk; + } + + while (i < diffstr.length) { + parseIndex(); + } + + return list; +} // Iterator that traverses in the range of [min, max], stepping +// by distance from a given start position. I.e. for [0, 4], with +// start of 2, this will iterate 2, 3, 1, 4, 0. + + +function distanceIterator(start, minLine, maxLine) { + var wantForward = true, + backwardExhausted = false, + forwardExhausted = false, + localOffset = 1; + return function iterator() { + if (wantForward && !forwardExhausted) { + if (backwardExhausted) { + localOffset++; + } else { + wantForward = false; + } // Check if trying to fit beyond text length, and if not, check it fits + // after offset location (or desired location on first iteration) + + + if (start + localOffset <= maxLine) { + return localOffset; + } + + forwardExhausted = true; + } + + if (!backwardExhausted) { + if (!forwardExhausted) { + wantForward = true; + } // Check if trying to fit before text beginning, and if not, check it fits + // before offset location + + + if (minLine <= start - localOffset) { + return -localOffset++; + } + + backwardExhausted = true; + return iterator(); + } // We tried to fit hunk before text beginning and beyond text length, then + // hunk can't fit on the text. Return undefined + + }; +} + +function applyPatch(source, uniDiff) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + if (typeof uniDiff === 'string') { + uniDiff = parsePatch(uniDiff); + } + + if (Array.isArray(uniDiff)) { + if (uniDiff.length > 1) { + throw new Error('applyPatch only works with a single input.'); + } + + uniDiff = uniDiff[0]; + } // Apply the diff to the input + + + var lines = source.split(/\r\n|[\n\v\f\r\x85]/), + delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], + hunks = uniDiff.hunks, + compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { + return line === patchContent; + }, + errorCount = 0, + fuzzFactor = options.fuzzFactor || 0, + minLine = 0, + offset = 0, + removeEOFNL, + addEOFNL; + /** + * Checks if the hunk exactly fits on the provided location + */ + + + function hunkFits(hunk, toPos) { + for (var j = 0; j < hunk.lines.length; j++) { + var line = hunk.lines[j], + operation = line.length > 0 ? line[0] : ' ', + content = line.length > 0 ? line.substr(1) : line; + + if (operation === ' ' || operation === '-') { + // Context sanity check + if (!compareLine(toPos + 1, lines[toPos], operation, content)) { + errorCount++; + + if (errorCount > fuzzFactor) { + return false; + } + } + + toPos++; + } + } + + return true; + } // Search best fit offsets for each hunk based on the previous ones + + + for (var i = 0; i < hunks.length; i++) { + var hunk = hunks[i], + maxLine = lines.length - hunk.oldLines, + localOffset = 0, + toPos = offset + hunk.oldStart - 1; + var iterator = distanceIterator(toPos, minLine, maxLine); + + for (; localOffset !== undefined; localOffset = iterator()) { + if (hunkFits(hunk, toPos + localOffset)) { + hunk.offset = offset += localOffset; + break; + } + } + + if (localOffset === undefined) { + return false; + } // Set lower text limit to end of the current hunk, so next ones don't try + // to fit over already patched text + + + minLine = hunk.offset + hunk.oldStart + hunk.oldLines; + } // Apply patch hunks + + + var diffOffset = 0; + + for (var _i = 0; _i < hunks.length; _i++) { + var _hunk = hunks[_i], + _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1; + + diffOffset += _hunk.newLines - _hunk.oldLines; + + if (_toPos < 0) { + // Creating a new file + _toPos = 0; + } + + for (var j = 0; j < _hunk.lines.length; j++) { + var line = _hunk.lines[j], + operation = line.length > 0 ? line[0] : ' ', + content = line.length > 0 ? line.substr(1) : line, + delimiter = _hunk.linedelimiters[j]; + + if (operation === ' ') { + _toPos++; + } else if (operation === '-') { + lines.splice(_toPos, 1); + delimiters.splice(_toPos, 1); + /* istanbul ignore else */ + } else if (operation === '+') { + lines.splice(_toPos, 0, content); + delimiters.splice(_toPos, 0, delimiter); + _toPos++; + } else if (operation === '\\') { + var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; + + if (previousOperation === '+') { + removeEOFNL = true; + } else if (previousOperation === '-') { + addEOFNL = true; + } + } + } + } // Handle EOFNL insertion/removal + + + if (removeEOFNL) { + while (!lines[lines.length - 1]) { + lines.pop(); + delimiters.pop(); + } + } else if (addEOFNL) { + lines.push(''); + delimiters.push('\n'); + } + + for (var _k = 0; _k < lines.length - 1; _k++) { + lines[_k] = lines[_k] + delimiters[_k]; + } + + return lines.join(''); +} // Wrapper that supports multiple file patches via callbacks. + + +function applyPatches(uniDiff, options) { + if (typeof uniDiff === 'string') { + uniDiff = parsePatch(uniDiff); + } + + var currentIndex = 0; + + function processIndex() { + var index = uniDiff[currentIndex++]; + + if (!index) { + return options.complete(); + } + + options.loadFile(index, function (err, data) { + if (err) { + return options.complete(err); + } + + var updatedContent = applyPatch(data, index, options); + options.patched(index, updatedContent, function (err) { + if (err) { + return options.complete(err); + } + + processIndex(); + }); + }); + } + + processIndex(); +} + +function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { + if (!options) { + options = {}; + } + + if (typeof options.context === 'undefined') { + options.context = 4; + } + + var diff = diffLines(oldStr, newStr, options); + diff.push({ + value: '', + lines: [] + }); // Append an empty value to make cleanup easier + + function contextLines(lines) { + return lines.map(function (entry) { + return ' ' + entry; + }); + } + + var hunks = []; + var oldRangeStart = 0, + newRangeStart = 0, + curRange = [], + oldLine = 1, + newLine = 1; + + var _loop = function _loop(i) { + var current = diff[i], + lines = current.lines || current.value.replace(/\n$/, '').split('\n'); + current.lines = lines; + + if (current.added || current.removed) { + var _curRange; // If we have previous context, start with that + + + if (!oldRangeStart) { + var prev = diff[i - 1]; + oldRangeStart = oldLine; + newRangeStart = newLine; + + if (prev) { + curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } + } // Output our changes + + + (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { + return (current.added ? '+' : '-') + entry; + }))); // Track the updated file position + + + if (current.added) { + newLine += lines.length; + } else { + oldLine += lines.length; + } + } else { + // Identical context lines. Track line changes + if (oldRangeStart) { + // Close out any changes that have been output (or join overlapping) + if (lines.length <= options.context * 2 && i < diff.length - 2) { + var _curRange2; // Overlapping + + + (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); + } else { + var _curRange3; // end the range and output + + + var contextSize = Math.min(lines.length, options.context); + + (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); + + var hunk = { + oldStart: oldRangeStart, + oldLines: oldLine - oldRangeStart + contextSize, + newStart: newRangeStart, + newLines: newLine - newRangeStart + contextSize, + lines: curRange + }; + + if (i >= diff.length - 2 && lines.length <= options.context) { + // EOF is inside this hunk + var oldEOFNewline = /\n$/.test(oldStr); + var newEOFNewline = /\n$/.test(newStr); + var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; + + if (!oldEOFNewline && noNlBeforeAdds) { + // special case: old has no eol and no trailing context; no-nl can end up before adds + curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); + } + + if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { + curRange.push('\\ No newline at end of file'); + } + } + + hunks.push(hunk); + oldRangeStart = 0; + newRangeStart = 0; + curRange = []; + } + } + + oldLine += lines.length; + newLine += lines.length; + } + }; + + for (var i = 0; i < diff.length; i++) { + _loop(i); + } + + return { + oldFileName: oldFileName, + newFileName: newFileName, + oldHeader: oldHeader, + newHeader: newHeader, + hunks: hunks + }; +} + +function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { + var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); + var ret = []; + + if (oldFileName == newFileName) { + ret.push('Index: ' + oldFileName); + } + + ret.push('==================================================================='); + ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); + ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); + + for (var i = 0; i < diff.hunks.length; i++) { + var hunk = diff.hunks[i]; + ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); + ret.push.apply(ret, hunk.lines); + } + + return ret.join('\n') + '\n'; +} + +function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { + return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); +} + +function arrayEqual(a, b) { + if (a.length !== b.length) { + return false; + } + + return arrayStartsWith(a, b); +} + +function arrayStartsWith(array, start) { + if (start.length > array.length) { + return false; + } + + for (var i = 0; i < start.length; i++) { + if (start[i] !== array[i]) { + return false; + } + } + + return true; +} + +function calcLineCount(hunk) { + var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), + oldLines = _calcOldNewLineCount.oldLines, + newLines = _calcOldNewLineCount.newLines; + + if (oldLines !== undefined) { + hunk.oldLines = oldLines; + } else { + delete hunk.oldLines; + } + + if (newLines !== undefined) { + hunk.newLines = newLines; + } else { + delete hunk.newLines; + } +} + +function merge(mine, theirs, base) { + mine = loadPatch(mine, base); + theirs = loadPatch(theirs, base); + var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning. + // Leaving sanity checks on this to the API consumer that may know more about the + // meaning in their own context. + + if (mine.index || theirs.index) { + ret.index = mine.index || theirs.index; + } + + if (mine.newFileName || theirs.newFileName) { + if (!fileNameChanged(mine)) { + // No header or no change in ours, use theirs (and ours if theirs does not exist) + ret.oldFileName = theirs.oldFileName || mine.oldFileName; + ret.newFileName = theirs.newFileName || mine.newFileName; + ret.oldHeader = theirs.oldHeader || mine.oldHeader; + ret.newHeader = theirs.newHeader || mine.newHeader; + } else if (!fileNameChanged(theirs)) { + // No header or no change in theirs, use ours + ret.oldFileName = mine.oldFileName; + ret.newFileName = mine.newFileName; + ret.oldHeader = mine.oldHeader; + ret.newHeader = mine.newHeader; + } else { + // Both changed... figure it out + ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName); + ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName); + ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader); + ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); + } + } + + ret.hunks = []; + var mineIndex = 0, + theirsIndex = 0, + mineOffset = 0, + theirsOffset = 0; + + while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { + var mineCurrent = mine.hunks[mineIndex] || { + oldStart: Infinity + }, + theirsCurrent = theirs.hunks[theirsIndex] || { + oldStart: Infinity + }; + + if (hunkBefore(mineCurrent, theirsCurrent)) { + // This patch does not overlap with any of the others, yay. + ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); + mineIndex++; + theirsOffset += mineCurrent.newLines - mineCurrent.oldLines; + } else if (hunkBefore(theirsCurrent, mineCurrent)) { + // This patch does not overlap with any of the others, yay. + ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset)); + theirsIndex++; + mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines; + } else { + // Overlap, merge as best we can + var mergedHunk = { + oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart), + oldLines: 0, + newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset), + newLines: 0, + lines: [] + }; + mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines); + theirsIndex++; + mineIndex++; + ret.hunks.push(mergedHunk); + } + } + + return ret; +} + +function loadPatch(param, base) { + if (typeof param === 'string') { + if (/^@@/m.test(param) || /^Index:/m.test(param)) { + return parsePatch(param)[0]; + } + + if (!base) { + throw new Error('Must provide a base reference or pass in a patch'); + } + + return structuredPatch(undefined, undefined, base, param); + } + + return param; +} + +function fileNameChanged(patch) { + return patch.newFileName && patch.newFileName !== patch.oldFileName; +} + +function selectField(index, mine, theirs) { + if (mine === theirs) { + return mine; + } else { + index.conflict = true; + return { + mine: mine, + theirs: theirs + }; + } +} + +function hunkBefore(test, check) { + return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; +} + +function cloneHunk(hunk, offset) { + return { + oldStart: hunk.oldStart, + oldLines: hunk.oldLines, + newStart: hunk.newStart + offset, + newLines: hunk.newLines, + lines: hunk.lines + }; +} + +function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { + // This will generally result in a conflicted hunk, but there are cases where the context + // is the only overlap where we can successfully merge the content here. + var mine = { + offset: mineOffset, + lines: mineLines, + index: 0 + }, + their = { + offset: theirOffset, + lines: theirLines, + index: 0 + }; // Handle any leading content + + insertLeading(hunk, mine, their); + insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each. + + while (mine.index < mine.lines.length && their.index < their.lines.length) { + var mineCurrent = mine.lines[mine.index], + theirCurrent = their.lines[their.index]; + + if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { + // Both modified ... + mutualChange(hunk, mine, their); + } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { + var _hunk$lines; // Mine inserted + + + (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine))); + } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { + var _hunk$lines2; // Theirs inserted + + + (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their))); + } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { + // Mine removed or edited + removal(hunk, mine, their); + } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') { + // Their removed or edited + removal(hunk, their, mine, true); + } else if (mineCurrent === theirCurrent) { + // Context identity + hunk.lines.push(mineCurrent); + mine.index++; + their.index++; + } else { + // Context mismatch + conflict(hunk, collectChange(mine), collectChange(their)); + } + } // Now push anything that may be remaining + + + insertTrailing(hunk, mine); + insertTrailing(hunk, their); + calcLineCount(hunk); +} + +function mutualChange(hunk, mine, their) { + var myChanges = collectChange(mine), + theirChanges = collectChange(their); + + if (allRemoves(myChanges) && allRemoves(theirChanges)) { + // Special case for remove changes that are supersets of one another + if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { + var _hunk$lines3; + + (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges)); + + return; + } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { + var _hunk$lines4; + + (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges)); + + return; + } + } else if (arrayEqual(myChanges, theirChanges)) { + var _hunk$lines5; + + (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges)); + + return; + } + + conflict(hunk, myChanges, theirChanges); +} + +function removal(hunk, mine, their, swap) { + var myChanges = collectChange(mine), + theirChanges = collectContext(their, myChanges); + + if (theirChanges.merged) { + var _hunk$lines6; + + (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged)); + } else { + conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); + } +} + +function conflict(hunk, mine, their) { + hunk.conflict = true; + hunk.lines.push({ + conflict: true, + mine: mine, + theirs: their + }); +} + +function insertLeading(hunk, insert, their) { + while (insert.offset < their.offset && insert.index < insert.lines.length) { + var line = insert.lines[insert.index++]; + hunk.lines.push(line); + insert.offset++; + } +} + +function insertTrailing(hunk, insert) { + while (insert.index < insert.lines.length) { + var line = insert.lines[insert.index++]; + hunk.lines.push(line); + } +} + +function collectChange(state) { + var ret = [], + operation = state.lines[state.index][0]; + + while (state.index < state.lines.length) { + var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. + + if (operation === '-' && line[0] === '+') { + operation = '+'; + } + + if (operation === line[0]) { + ret.push(line); + state.index++; + } else { + break; + } + } + + return ret; +} + +function collectContext(state, matchChanges) { + var changes = [], + merged = [], + matchIndex = 0, + contextChanges = false, + conflicted = false; + + while (matchIndex < matchChanges.length && state.index < state.lines.length) { + var change = state.lines[state.index], + match = matchChanges[matchIndex]; // Once we've hit our add, then we are done + + if (match[0] === '+') { + break; + } + + contextChanges = contextChanges || change[0] !== ' '; + merged.push(match); + matchIndex++; // Consume any additions in the other block as a conflict to attempt + // to pull in the remaining context after this + + if (change[0] === '+') { + conflicted = true; + + while (change[0] === '+') { + changes.push(change); + change = state.lines[++state.index]; + } + } + + if (match.substr(1) === change.substr(1)) { + changes.push(change); + state.index++; + } else { + conflicted = true; + } + } + + if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { + conflicted = true; + } + + if (conflicted) { + return changes; + } + + while (matchIndex < matchChanges.length) { + merged.push(matchChanges[matchIndex++]); + } + + return { + merged: merged, + changes: changes + }; +} + +function allRemoves(changes) { + return changes.reduce(function (prev, change) { + return prev && change[0] === '-'; + }, true); +} + +function skipRemoveSuperset(state, removeChanges, delta) { + for (var i = 0; i < delta; i++) { + var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); + + if (state.lines[state.index + i] !== ' ' + changeContent) { + return false; + } + } + + state.index += delta; + return true; +} + +function calcOldNewLineCount(lines) { + var oldLines = 0; + var newLines = 0; + lines.forEach(function (line) { + if (typeof line !== 'string') { + var myCount = calcOldNewLineCount(line.mine); + var theirCount = calcOldNewLineCount(line.theirs); + + if (oldLines !== undefined) { + if (myCount.oldLines === theirCount.oldLines) { + oldLines += myCount.oldLines; + } else { + oldLines = undefined; + } + } + + if (newLines !== undefined) { + if (myCount.newLines === theirCount.newLines) { + newLines += myCount.newLines; + } else { + newLines = undefined; + } + } + } else { + if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { + newLines++; + } + + if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { + oldLines++; + } + } + }); + return { + oldLines: oldLines, + newLines: newLines + }; +} // See: http://code.google.com/p/google-diff-match-patch/wiki/API + + +function convertChangesToDMP(changes) { + var ret = [], + change, + operation; + + for (var i = 0; i < changes.length; i++) { + change = changes[i]; + + if (change.added) { + operation = 1; + } else if (change.removed) { + operation = -1; + } else { + operation = 0; + } + + ret.push([operation, change.value]); + } + + return ret; +} + +function convertChangesToXML(changes) { + var ret = []; + + for (var i = 0; i < changes.length; i++) { + var change = changes[i]; + + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + + ret.push(escapeHTML(change.value)); + + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + } + + return ret.join(''); +} + +function escapeHTML(s) { + var n = s; + n = n.replace(/&/g, '&'); + n = n.replace(//g, '>'); + n = n.replace(/"/g, '"'); + return n; +} + +var index_es6 = /*#__PURE__*/Object.freeze({ + __proto__: null, + Diff: Diff, + diffChars: diffChars, + diffWords: diffWords, + diffWordsWithSpace: diffWordsWithSpace, + diffLines: diffLines, + diffTrimmedLines: diffTrimmedLines, + diffSentences: diffSentences, + diffCss: diffCss, + diffJson: diffJson, + diffArrays: diffArrays, + structuredPatch: structuredPatch, + createTwoFilesPatch: createTwoFilesPatch, + createPatch: createPatch, + applyPatch: applyPatch, + applyPatches: applyPatches, + parsePatch: parsePatch, + merge: merge, + convertChangesToDMP: convertChangesToDMP, + convertChangesToXML: convertChangesToXML, + canonicalize: canonicalize +}); + +/** + * @class + */ + + +class LineByLine { + constructor(file, options) { + options = options || {}; + if (!options.readChunk) options.readChunk = 1024; + + if (!options.newLineCharacter) { + options.newLineCharacter = 0x0a; //linux line ending + } else { + options.newLineCharacter = options.newLineCharacter.charCodeAt(0); + } + + if (typeof file === 'number') { + this.fd = file; + } else { + this.fd = fs$3.openSync(file, 'r'); + } + + this.options = options; + this.newLineCharacter = options.newLineCharacter; + this.reset(); + } + + _searchInBuffer(buffer, hexNeedle) { + let found = -1; + + for (let i = 0; i <= buffer.length; i++) { + let b_byte = buffer[i]; + + if (b_byte === hexNeedle) { + found = i; + break; + } + } + + return found; + } + + reset() { + this.eofReached = false; + this.linesCache = []; + this.fdPosition = 0; + } + + close() { + fs$3.closeSync(this.fd); + this.fd = null; + } + + _extractLines(buffer) { + let line; + const lines = []; + let bufferPosition = 0; + let lastNewLineBufferPosition = 0; + + while (true) { + let bufferPositionValue = buffer[bufferPosition++]; + + if (bufferPositionValue === this.newLineCharacter) { + line = buffer.slice(lastNewLineBufferPosition, bufferPosition); + lines.push(line); + lastNewLineBufferPosition = bufferPosition; + } else if (!bufferPositionValue) { + break; + } + } + + let leftovers = buffer.slice(lastNewLineBufferPosition, bufferPosition); + + if (leftovers.length) { + lines.push(leftovers); + } + + return lines; + } + + _readChunk(lineLeftovers) { + let totalBytesRead = 0; + let bytesRead; + const buffers = []; + + do { + const readBuffer = new Buffer(this.options.readChunk); + bytesRead = fs$3.readSync(this.fd, readBuffer, 0, this.options.readChunk, this.fdPosition); + totalBytesRead = totalBytesRead + bytesRead; + this.fdPosition = this.fdPosition + bytesRead; + buffers.push(readBuffer); + } while (bytesRead && this._searchInBuffer(buffers[buffers.length - 1], this.options.newLineCharacter) === -1); + + let bufferData = Buffer.concat(buffers); + + if (bytesRead < this.options.readChunk) { + this.eofReached = true; + bufferData = bufferData.slice(0, totalBytesRead); + } + + if (totalBytesRead) { + this.linesCache = this._extractLines(bufferData); + + if (lineLeftovers) { + this.linesCache[0] = Buffer.concat([lineLeftovers, this.linesCache[0]]); + } + } + + return totalBytesRead; + } + + next() { + if (!this.fd) return false; + let line = false; + + if (this.eofReached && this.linesCache.length === 0) { + return line; + } + + let bytesRead; + + if (!this.linesCache.length) { + bytesRead = this._readChunk(); + } + + if (this.linesCache.length) { + line = this.linesCache.shift(); + const lastLineCharacter = line[line.length - 1]; + + if (lastLineCharacter !== 0x0a) { + bytesRead = this._readChunk(line); + + if (bytesRead) { + line = this.linesCache.shift(); + } + } + } + + if (this.eofReached && this.linesCache.length === 0) { + this.close(); + } + + if (line && line[line.length - 1] === this.newLineCharacter) { + line = line.slice(0, line.length - 1); + } + + return line; + } + +} + +var readlines = LineByLine; + +/** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} pairs The key-value pairs. + * @returns {Object} Returns the new object. + * @example + * + * _.fromPairs([['a', 1], ['b', 2]]); + * // => { 'a': 1, 'b': 2 } + */ +function fromPairs(pairs) { + var index = -1, + length = pairs == null ? 0 : pairs.length, + result = {}; + + while (++index < length) { + var pair = pairs[index]; + result[pair[0]] = pair[1]; + } + + return result; +} + +var fromPairs_1 = fromPairs; + +class ConfigError extends Error {} + +class DebugError extends Error {} + +class UndefinedParserError extends Error {} + +var errors = { + ConfigError, + DebugError, + UndefinedParserError +}; + +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; +} + +const debug = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error('SEMVER', ...args) : () => {}; +var debug_1 = debug; + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0'; +const MAX_LENGTH = 256; +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || +/* istanbul ignore next */ +9007199254740991; // Max safe segment length for coercion. + +const MAX_SAFE_COMPONENT_LENGTH = 16; +var constants = { + SEMVER_SPEC_VERSION, + MAX_LENGTH, + MAX_SAFE_INTEGER, + MAX_SAFE_COMPONENT_LENGTH +}; + +function unwrapExports (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; +} + +function getCjsExportFromNamespace (n) { + return n && n['default'] || n; +} + +var re_1 = createCommonjsModule(function (module, exports) { + const { + MAX_SAFE_COMPONENT_LENGTH + } = constants; + exports = module.exports = {}; // The actual regexps go on exports.re + + const re = exports.re = []; + const src = exports.src = []; + const t = exports.t = {}; + let R = 0; + + const createToken = (name, value, isGlobal) => { + const index = R++; + debug_1(index, value); + t[name] = index; + src[index] = value; + re[index] = new RegExp(value, isGlobal ? 'g' : undefined); + }; // The following Regular Expressions can be used for tokenizing, + // validating, and parsing SemVer version strings. + // ## Numeric Identifier + // A single `0`, or a non-zero digit followed by zero or more digits. + + + createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*'); + createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+'); // ## Non-numeric Identifier + // Zero or more digits, followed by a letter or hyphen, and then zero or + // more letters, digits, or hyphens. + + createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*'); // ## Main Version + // Three dot-separated numeric identifiers. + + createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`); + createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`); // ## Pre-release Version Identifier + // A numeric identifier, or a non-numeric identifier. + + createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`); + createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`); // ## Pre-release Version + // Hyphen, followed by one or more dot-separated pre-release version + // identifiers. + + createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); + createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); // ## Build Metadata Identifier + // Any combination of digits, letters, or hyphens. + + createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+'); // ## Build Metadata + // Plus sign, followed by one or more period-separated build metadata + // identifiers. + + createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`); // ## Full Version String + // A main version, followed optionally by a pre-release version and + // build metadata. + // Note that the only major, minor, patch, and pre-release sections of + // the version string are capturing groups. The build metadata is not a + // capturing group, because it should not ever be used in version + // comparison. + + createToken('FULLPLAIN', `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`); + createToken('FULL', `^${src[t.FULLPLAIN]}$`); // like full, but allows v1.2.3 and =1.2.3, which people do sometimes. + // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty + // common in the npm registry. + + createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`); + createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`); + createToken('GTLT', '((?:<|>)?=?)'); // Something like "2.*" or "1.2.x". + // Note that "x.x" is a valid xRange identifer, meaning "any version" + // Only the first item is strictly required. + + createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); + createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); + createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`); + createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`); + createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); + createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); // Coercion. + // Extract anything that could conceivably be a part of a valid semver + + createToken('COERCE', `${'(^|[^\\d])' + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:$|[^\\d])`); + createToken('COERCERTL', src[t.COERCE], true); // Tilde ranges. + // Meaning is "reasonably at or greater than" + + createToken('LONETILDE', '(?:~>?)'); + createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true); + exports.tildeTrimReplace = '$1~'; + createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); + createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); // Caret ranges. + // Meaning is "at least and backwards compatible with" + + createToken('LONECARET', '(?:\\^)'); + createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true); + exports.caretTrimReplace = '$1^'; + createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); + createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); // A simple gt/lt/eq thing, or just "" to indicate "any version" + + createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); + createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); // An expression to strip any whitespace between the gtlt and the thing + // it modifies, so that `> 1.2.3` ==> `>1.2.3` + + createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); + exports.comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4` + // Note that these all use the loose form, because they'll be + // checked against either the strict or loose comparator form + // later. + + createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`); + createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`); // Star ranges basically just allow anything at all. + + createToken('STAR', '(<|>)?=?\\s*\\*'); +}); +var re_2 = re_1.re; +var re_3 = re_1.src; +var re_4 = re_1.t; +var re_5 = re_1.tildeTrimReplace; +var re_6 = re_1.caretTrimReplace; +var re_7 = re_1.comparatorTrimReplace; + +const numeric = /^[0-9]+$/; + +const compareIdentifiers = (a, b) => { + const anum = numeric.test(a); + const bnum = numeric.test(b); + + if (anum && bnum) { + a = +a; + b = +b; + } + + return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; +}; + +const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a); + +var identifiers = { + compareIdentifiers, + rcompareIdentifiers +}; + +const { + MAX_LENGTH: MAX_LENGTH$1, + MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1 +} = constants; +const { + re, + t +} = re_1; +const { + compareIdentifiers: compareIdentifiers$1 +} = identifiers; + +class SemVer { + constructor(version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + }; + } + + if (version instanceof SemVer) { + if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) { + return version; + } else { + version = version.version; + } + } else if (typeof version !== 'string') { + throw new TypeError(`Invalid Version: ${version}`); + } + + if (version.length > MAX_LENGTH$1) { + throw new TypeError(`version is longer than ${MAX_LENGTH$1} characters`); + } + + debug_1('SemVer', version, options); + this.options = options; + this.loose = !!options.loose; // this isn't actually relevant for versions, but keep it so that we + // don't run into trouble passing this.options around. + + this.includePrerelease = !!options.includePrerelease; + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]); + + if (!m) { + throw new TypeError(`Invalid Version: ${version}`); + } + + this.raw = version; // these are actually numbers + + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + + if (this.major > MAX_SAFE_INTEGER$1 || this.major < 0) { + throw new TypeError('Invalid major version'); + } + + if (this.minor > MAX_SAFE_INTEGER$1 || this.minor < 0) { + throw new TypeError('Invalid minor version'); + } + + if (this.patch > MAX_SAFE_INTEGER$1 || this.patch < 0) { + throw new TypeError('Invalid patch version'); + } // numberify any prerelease numeric ids + + + if (!m[4]) { + this.prerelease = []; + } else { + this.prerelease = m[4].split('.').map(id => { + if (/^[0-9]+$/.test(id)) { + const num = +id; + + if (num >= 0 && num < MAX_SAFE_INTEGER$1) { + return num; + } + } + + return id; + }); + } + + this.build = m[5] ? m[5].split('.') : []; + this.format(); + } + + format() { + this.version = `${this.major}.${this.minor}.${this.patch}`; + + if (this.prerelease.length) { + this.version += `-${this.prerelease.join('.')}`; + } + + return this.version; + } + + toString() { + return this.version; + } + + compare(other) { + debug_1('SemVer.compare', this.version, this.options, other); + + if (!(other instanceof SemVer)) { + if (typeof other === 'string' && other === this.version) { + return 0; + } + + other = new SemVer(other, this.options); + } + + if (other.version === this.version) { + return 0; + } + + return this.compareMain(other) || this.comparePre(other); + } + + compareMain(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + + return compareIdentifiers$1(this.major, other.major) || compareIdentifiers$1(this.minor, other.minor) || compareIdentifiers$1(this.patch, other.patch); + } + + comparePre(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } // NOT having a prerelease is > having one + + + if (this.prerelease.length && !other.prerelease.length) { + return -1; + } else if (!this.prerelease.length && other.prerelease.length) { + return 1; + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0; + } + + let i = 0; + + do { + const a = this.prerelease[i]; + const b = other.prerelease[i]; + debug_1('prerelease compare', i, a, b); + + if (a === undefined && b === undefined) { + return 0; + } else if (b === undefined) { + return 1; + } else if (a === undefined) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers$1(a, b); + } + } while (++i); + } + + compareBuild(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + + let i = 0; + + do { + const a = this.build[i]; + const b = other.build[i]; + debug_1('prerelease compare', i, a, b); + + if (a === undefined && b === undefined) { + return 0; + } else if (b === undefined) { + return 1; + } else if (a === undefined) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers$1(a, b); + } + } while (++i); + } // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + + + inc(release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc('pre', identifier); + break; + + case 'preminor': + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc('pre', identifier); + break; + + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0; + this.inc('patch', identifier); + this.inc('pre', identifier); + break; + // If the input is a non-prerelease version, this acts the same as + // prepatch. + + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier); + } + + this.inc('pre', identifier); + break; + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { + this.major++; + } + + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++; + } + + this.patch = 0; + this.prerelease = []; + break; + + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++; + } + + this.prerelease = []; + break; + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0]; + } else { + let i = this.prerelease.length; + + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++; + i = -2; + } + } + + if (i === -1) { + // didn't increment anything + this.prerelease.push(0); + } + } + + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0]; + } + } else { + this.prerelease = [identifier, 0]; + } + } + + break; + + default: + throw new Error(`invalid increment argument: ${release}`); + } + + this.format(); + this.raw = this.version; + return this; + } + +} + +var semver = SemVer; + +const compare = (a, b, loose) => new semver(a, loose).compare(new semver(b, loose)); + +var compare_1 = compare; + +const lt = (a, b, loose) => compare_1(a, b, loose) < 0; + +var lt_1 = lt; + +const gte = (a, b, loose) => compare_1(a, b, loose) >= 0; + +var gte_1 = gte; + +var arrayify = (object, keyName) => Object.entries(object).map(([key, value]) => Object.assign({ + [keyName]: key +}, value)); + +var dedent_1 = createCommonjsModule(function (module) { + + function dedent(strings) { + var raw = void 0; + + if (typeof strings === "string") { + // dedent can be used as a plain function + raw = [strings]; + } else { + raw = strings.raw; + } // first, perform interpolation + + + var result = ""; + + for (var i = 0; i < raw.length; i++) { + result += raw[i]. // join lines when there is a suppressed newline + replace(/\\\n[ \t]*/g, ""). // handle escaped backticks + replace(/\\`/g, "`"); + + if (i < (arguments.length <= 1 ? 0 : arguments.length - 1)) { + result += arguments.length <= i + 1 ? undefined : arguments[i + 1]; + } + } // now strip indentation + + + var lines = result.split("\n"); + var mindent = null; + lines.forEach(function (l) { + var m = l.match(/^(\s+)\S+/); + + if (m) { + var indent = m[1].length; + + if (!mindent) { + // this is the first indented line + mindent = indent; + } else { + mindent = Math.min(mindent, indent); + } + } + }); + + if (mindent !== null) { + result = lines.map(function (l) { + return l[0] === " " ? l.slice(mindent) : l; + }).join("\n"); + } // dedent eats leading and trailing whitespace too + + + result = result.trim(); // handle escaped newlines at the end to ensure they don't get stripped too + + return result.replace(/\\n/g, "\n"); + } + + { + module.exports = dedent; + } +}); + +const CATEGORY_CONFIG = "Config"; +const CATEGORY_EDITOR = "Editor"; +const CATEGORY_FORMAT = "Format"; +const CATEGORY_OTHER = "Other"; +const CATEGORY_OUTPUT = "Output"; +const CATEGORY_GLOBAL = "Global"; +const CATEGORY_SPECIAL = "Special"; +/** + * @typedef {Object} OptionInfo + * @property {string} [since] - available since version + * @property {string} category + * @property {'int' | 'boolean' | 'choice' | 'path'} type + * @property {boolean} [array] - indicate it's an array of the specified type + * @property {OptionValueInfo} [default] + * @property {OptionRangeInfo} [range] - for type int + * @property {string} description + * @property {string} [deprecated] - deprecated since version + * @property {OptionRedirectInfo} [redirect] - redirect deprecated option + * @property {(value: any) => boolean} [exception] + * @property {OptionChoiceInfo[]} [choices] - for type choice + * @property {string} [cliName] + * @property {string} [cliCategory] + * @property {string} [cliDescription] + * + * @typedef {number | boolean | string} OptionValue + * @typedef {OptionValue | [{ value: OptionValue[] }] | Array<{ since: string, value: OptionValue}>} OptionValueInfo + * + * @typedef {Object} OptionRedirectInfo + * @property {string} option + * @property {OptionValue} value + * + * @typedef {Object} OptionRangeInfo + * @property {number} start - recommended range start + * @property {number} end - recommended range end + * @property {number} step - recommended range step + * + * @typedef {Object} OptionChoiceInfo + * @property {boolean | string} value - boolean for the option that is originally boolean type + * @property {string} description + * @property {string} [since] - undefined if available since the first version of the option + * @property {string} [deprecated] - deprecated since version + * @property {OptionValueInfo} [redirect] - redirect deprecated value + */ + +/** @type {{ [name: string]: OptionInfo }} */ + +const options = { + cursorOffset: { + since: "1.4.0", + category: CATEGORY_SPECIAL, + type: "int", + default: -1, + range: { + start: -1, + end: Infinity, + step: 1 + }, + description: dedent_1` + Print (to stderr) where a cursor at the given position would move to after formatting. + This option cannot be used with --range-start and --range-end. + `, + cliCategory: CATEGORY_EDITOR + }, + endOfLine: { + since: "1.15.0", + category: CATEGORY_GLOBAL, + type: "choice", + default: [{ + since: "1.15.0", + value: "auto" + }, { + since: "2.0.0", + value: "lf" + }], + description: "Which end of line characters to apply.", + choices: [{ + value: "lf", + description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos" + }, { + value: "crlf", + description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows" + }, { + value: "cr", + description: "Carriage Return character only (\\r), used very rarely" + }, { + value: "auto", + description: dedent_1` + Maintain existing + (mixed values within one file are normalised by looking at what's used after the first line) + ` + }] + }, + filepath: { + since: "1.4.0", + category: CATEGORY_SPECIAL, + type: "path", + description: "Specify the input filepath. This will be used to do parser inference.", + cliName: "stdin-filepath", + cliCategory: CATEGORY_OTHER, + cliDescription: "Path to the file to pretend that stdin comes from." + }, + insertPragma: { + since: "1.8.0", + category: CATEGORY_SPECIAL, + type: "boolean", + default: false, + description: "Insert @format pragma into file's first docblock comment.", + cliCategory: CATEGORY_OTHER + }, + parser: { + since: "0.0.10", + category: CATEGORY_GLOBAL, + type: "choice", + default: [{ + since: "0.0.10", + value: "babylon" + }, { + since: "1.13.0", + value: undefined + }], + description: "Which parser to use.", + exception: value => typeof value === "string" || typeof value === "function", + choices: [{ + value: "flow", + description: "Flow" + }, { + value: "babel", + since: "1.16.0", + description: "JavaScript" + }, { + value: "babel-flow", + since: "1.16.0", + description: "Flow" + }, { + value: "babel-ts", + since: "2.0.0", + description: "TypeScript" + }, { + value: "typescript", + since: "1.4.0", + description: "TypeScript" + }, { + value: "css", + since: "1.7.1", + description: "CSS" + }, { + value: "less", + since: "1.7.1", + description: "Less" + }, { + value: "scss", + since: "1.7.1", + description: "SCSS" + }, { + value: "json", + since: "1.5.0", + description: "JSON" + }, { + value: "json5", + since: "1.13.0", + description: "JSON5" + }, { + value: "json-stringify", + since: "1.13.0", + description: "JSON.stringify" + }, { + value: "graphql", + since: "1.5.0", + description: "GraphQL" + }, { + value: "markdown", + since: "1.8.0", + description: "Markdown" + }, { + value: "mdx", + since: "1.15.0", + description: "MDX" + }, { + value: "vue", + since: "1.10.0", + description: "Vue" + }, { + value: "yaml", + since: "1.14.0", + description: "YAML" + }, { + value: "glimmer", + since: null, + description: "Handlebars" + }, { + value: "html", + since: "1.15.0", + description: "HTML" + }, { + value: "angular", + since: "1.15.0", + description: "Angular" + }, { + value: "lwc", + since: "1.17.0", + description: "Lightning Web Components" + }] + }, + plugins: { + since: "1.10.0", + type: "path", + array: true, + default: [{ + value: [] + }], + category: CATEGORY_GLOBAL, + description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.", + exception: value => typeof value === "string" || typeof value === "object", + cliName: "plugin", + cliCategory: CATEGORY_CONFIG + }, + pluginSearchDirs: { + since: "1.13.0", + type: "path", + array: true, + default: [{ + value: [] + }], + category: CATEGORY_GLOBAL, + description: dedent_1` + Custom directory that contains prettier plugins in node_modules subdirectory. + Overrides default behavior when plugins are searched relatively to the location of Prettier. + Multiple values are accepted. + `, + exception: value => typeof value === "string" || typeof value === "object", + cliName: "plugin-search-dir", + cliCategory: CATEGORY_CONFIG + }, + printWidth: { + since: "0.0.0", + category: CATEGORY_GLOBAL, + type: "int", + default: 80, + description: "The line length where Prettier will try wrap.", + range: { + start: 0, + end: Infinity, + step: 1 + } + }, + rangeEnd: { + since: "1.4.0", + category: CATEGORY_SPECIAL, + type: "int", + default: Infinity, + range: { + start: 0, + end: Infinity, + step: 1 + }, + description: dedent_1` + Format code ending at a given character offset (exclusive). + The range will extend forwards to the end of the selected statement. + This option cannot be used with --cursor-offset. + `, + cliCategory: CATEGORY_EDITOR + }, + rangeStart: { + since: "1.4.0", + category: CATEGORY_SPECIAL, + type: "int", + default: 0, + range: { + start: 0, + end: Infinity, + step: 1 + }, + description: dedent_1` + Format code starting at a given character offset. + The range will extend backwards to the start of the first line containing the selected statement. + This option cannot be used with --cursor-offset. + `, + cliCategory: CATEGORY_EDITOR + }, + requirePragma: { + since: "1.7.0", + category: CATEGORY_SPECIAL, + type: "boolean", + default: false, + description: dedent_1` + Require either '@prettier' or '@format' to be present in the file's first docblock comment + in order for it to be formatted. + `, + cliCategory: CATEGORY_OTHER + }, + tabWidth: { + type: "int", + category: CATEGORY_GLOBAL, + default: 2, + description: "Number of spaces per indentation level.", + range: { + start: 0, + end: Infinity, + step: 1 + } + }, + useTabs: { + since: "1.0.0", + category: CATEGORY_GLOBAL, + type: "boolean", + default: false, + description: "Indent with tabs instead of spaces." + } +}; +var coreOptions = { + CATEGORY_CONFIG, + CATEGORY_EDITOR, + CATEGORY_FORMAT, + CATEGORY_OTHER, + CATEGORY_OUTPUT, + CATEGORY_GLOBAL, + CATEGORY_SPECIAL, + options +}; + +var require$$1 = getCjsExportFromNamespace(_package$1); + +const semver$1 = { + compare: compare_1, + lt: lt_1, + gte: gte_1 +}; +const currentVersion = require$$1.version; +const coreOptions$1 = coreOptions.options; +/** + * Strings in `plugins` and `pluginSearchDirs` are handled by a wrapped version + * of this function created by `withPlugins`. Don't pass them here directly. + * @param {object} param0 + * @param {(string | object)[]=} param0.plugins Strings are resolved by `withPlugins`. + * @param {string[]=} param0.pluginSearchDirs Added by `withPlugins`. + * @param {boolean=} param0.showUnreleased + * @param {boolean=} param0.showDeprecated + * @param {boolean=} param0.showInternal + */ + +function getSupportInfo({ + plugins = [], + showUnreleased = false, + showDeprecated = false, + showInternal = false +} = {}) { + // pre-release version is smaller than the normal version in semver, + // we need to treat it as the normal one so as to test new features. + const version = currentVersion.split("-", 1)[0]; + const options = arrayify(Object.assign({}, ...plugins.map(({ + options + }) => options), coreOptions$1), "name").filter(option => filterSince(option) && filterDeprecated(option)).sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1).map(mapInternal).map(option => { + option = Object.assign({}, option); + + if (Array.isArray(option.default)) { + option.default = option.default.length === 1 ? option.default[0].value : option.default.filter(filterSince).sort((info1, info2) => semver$1.compare(info2.since, info1.since))[0].value; + } + + if (Array.isArray(option.choices)) { + option.choices = option.choices.filter(option => filterSince(option) && filterDeprecated(option)); + } + + const filteredPlugins = plugins.filter(plugin => plugin.defaultOptions && plugin.defaultOptions[option.name] !== undefined); + const pluginDefaults = filteredPlugins.reduce((reduced, plugin) => { + reduced[plugin.name] = plugin.defaultOptions[option.name]; + return reduced; + }, {}); + return Object.assign({}, option, { + pluginDefaults + }); + }); + const languages = plugins.reduce((all, plugin) => all.concat(plugin.languages || []), []).filter(filterSince); + return { + languages, + options + }; + + function filterSince(object) { + return showUnreleased || !("since" in object) || object.since && semver$1.gte(version, object.since); + } + + function filterDeprecated(object) { + return showDeprecated || !("deprecated" in object) || object.deprecated && semver$1.lt(version, object.deprecated); + } + + function mapInternal(object) { + if (showInternal) { + return object; + } + + const newObject = _objectWithoutPropertiesLoose(object, ["cliName", "cliCategory", "cliDescription"]); + + return newObject; + } +} + +var support = { + getSupportInfo +}; + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +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 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/* global Reflect, Promise */ +var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || { + __proto__: [] + } instanceof Array && function (d, b) { + d.__proto__ = b; + } || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); +}; + +function __extends(d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} +var __assign = function () { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + + return t; + }; + + return __assign.apply(this, arguments); +}; +function __rest(s, e) { + var t = {}; + + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; + + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; + } + return t; +} +function __decorate(decorators, target, key, desc) { + var c = arguments.length, + r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, + d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} +function __param(paramIndex, decorator) { + return function (target, key) { + decorator(target, key, paramIndex); + }; +} +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} +function __awaiter(thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : new P(function (resolve) { + resolve(result.value); + }).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} +function __generator(thisArg, body) { + var _ = { + label: 0, + sent: function () { + if (t[0] & 1) throw t[1]; + return t[1]; + }, + trys: [], + ops: [] + }, + f, + y, + t, + g; + return g = { + next: verb(0), + "throw": verb(1), + "return": verb(2) + }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { + return this; + }), g; + + function verb(n) { + return function (v) { + return step([n, v]); + }; + } + + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + + switch (op[0]) { + case 0: + case 1: + t = op; + break; + + case 4: + _.label++; + return { + value: op[1], + done: false + }; + + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + + case 7: + op = _.ops.pop(); + + _.trys.pop(); + + continue; + + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + + if (t && _.label < t[2]) { + _.label = t[2]; + + _.ops.push(op); + + break; + } + + if (t[2]) _.ops.pop(); + + _.trys.pop(); + + continue; + } + + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + + if (op[0] & 5) throw op[1]; + return { + value: op[0] ? op[1] : void 0, + done: true + }; + } +} +function __exportStar(m, exports) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +function __values(o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], + i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { + value: o && o[i++], + done: !o + }; + } + }; +} +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), + r, + ar = [], + e; + + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { + e = { + error: error + }; + } finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } finally { + if (e) throw e.error; + } + } + + return ar; +} +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + + return ar; +} +function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + + for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; + + return r; +} +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), + i, + q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { + return this; + }, i; + + function verb(n) { + if (g[n]) i[n] = function (v) { + return new Promise(function (a, b) { + q.push([n, v, a, b]) > 1 || resume(n, v); + }); + }; + } + + function resume(n, v) { + try { + step(g[n](v)); + } catch (e) { + settle(q[0][3], e); + } + } + + function step(r) { + r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); + } + + function fulfill(value) { + resume("next", value); + } + + function reject(value) { + resume("throw", value); + } + + function settle(f, v) { + if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); + } +} +function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { + throw e; + }), verb("return"), i[Symbol.iterator] = function () { + return this; + }, i; + + function verb(n, f) { + i[n] = o[n] ? function (v) { + return (p = !p) ? { + value: __await(o[n](v)), + done: n === "return" + } : f ? f(v) : v; + } : f; + } +} +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], + i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { + return this; + }, i); + + function verb(n) { + i[n] = o[n] && function (v) { + return new Promise(function (resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; + } + + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function (v) { + resolve({ + value: v, + done: d + }); + }, reject); + } +} +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { + Object.defineProperty(cooked, "raw", { + value: raw + }); + } else { + cooked.raw = raw; + } + + return cooked; +} +function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result.default = mod; + return result; +} +function __importDefault(mod) { + return mod && mod.__esModule ? mod : { + default: mod + }; +} + +var tslib_es6 = /*#__PURE__*/Object.freeze({ + __proto__: null, + __extends: __extends, + get __assign () { return __assign; }, + __rest: __rest, + __decorate: __decorate, + __param: __param, + __metadata: __metadata, + __awaiter: __awaiter, + __generator: __generator, + __exportStar: __exportStar, + __values: __values, + __read: __read, + __spread: __spread, + __spreadArrays: __spreadArrays, + __await: __await, + __asyncGenerator: __asyncGenerator, + __asyncDelegator: __asyncDelegator, + __asyncValues: __asyncValues, + __makeTemplateObject: __makeTemplateObject, + __importStar: __importStar, + __importDefault: __importDefault +}); + +var api = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.apiDescriptor = { + key: key => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(key) ? key : JSON.stringify(key), + + value(value) { + if (value === null || typeof value !== 'object') { + return JSON.stringify(value); + } + + if (Array.isArray(value)) { + return `[${value.map(subValue => exports.apiDescriptor.value(subValue)).join(', ')}]`; + } + + const keys = Object.keys(value); + return keys.length === 0 ? '{}' : `{ ${keys.map(key => `${exports.apiDescriptor.key(key)}: ${exports.apiDescriptor.value(value[key])}`).join(', ')} }`; + }, + + pair: ({ + key, + value + }) => exports.apiDescriptor.value({ + [key]: value + }) + }; +}); +unwrapExports(api); +var api_1 = api.apiDescriptor; + +var tslib_1 = getCjsExportFromNamespace(tslib_es6); + +var descriptors = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + tslib_1.__exportStar(api, exports); +}); +unwrapExports(descriptors); + +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; + +var escapeStringRegexp = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + + return str.replace(matchOperatorsRe, '\\$&'); +}; + +var colorName = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; + +var conversions = createCommonjsModule(function (module) { + /* MIT license */ + // NOTE: conversions should only return primitive values (i.e. arrays, or + // values that give correct `typeof` results). + // do not use box values types (i.e. Number(), String(), etc.) + var reverseKeywords = {}; + + for (var key in colorName) { + if (colorName.hasOwnProperty(key)) { + reverseKeywords[colorName[key]] = key; + } + } + + var convert = module.exports = { + rgb: { + channels: 3, + labels: 'rgb' + }, + hsl: { + channels: 3, + labels: 'hsl' + }, + hsv: { + channels: 3, + labels: 'hsv' + }, + hwb: { + channels: 3, + labels: 'hwb' + }, + cmyk: { + channels: 4, + labels: 'cmyk' + }, + xyz: { + channels: 3, + labels: 'xyz' + }, + lab: { + channels: 3, + labels: 'lab' + }, + lch: { + channels: 3, + labels: 'lch' + }, + hex: { + channels: 1, + labels: ['hex'] + }, + keyword: { + channels: 1, + labels: ['keyword'] + }, + ansi16: { + channels: 1, + labels: ['ansi16'] + }, + ansi256: { + channels: 1, + labels: ['ansi256'] + }, + hcg: { + channels: 3, + labels: ['h', 'c', 'g'] + }, + apple: { + channels: 3, + labels: ['r16', 'g16', 'b16'] + }, + gray: { + channels: 1, + labels: ['gray'] + } + }; // hide .channels and .labels properties + + for (var model in convert) { + if (convert.hasOwnProperty(model)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); + } + + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); + } + + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); + } + + var channels = convert[model].channels; + var labels = convert[model].labels; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', { + value: channels + }); + Object.defineProperty(convert[model], 'labels', { + value: labels + }); + } + } + + convert.rgb.hsl = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var delta = max - min; + var h; + var s; + var l; + + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } + + h = Math.min(h * 60, 360); + + if (h < 0) { + h += 360; + } + + l = (min + max) / 2; + + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } + + return [h, s * 100, l * 100]; + }; + + convert.rgb.hsv = function (rgb) { + var rdif; + var gdif; + var bdif; + var h; + var s; + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var v = Math.max(r, g, b); + var diff = v - Math.min(r, g, b); + + var diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; + + if (diff === 0) { + h = s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); + + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = 1 / 3 + rdif - bdif; + } else if (b === v) { + h = 2 / 3 + gdif - rdif; + } + + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + } + + return [h * 360, s * 100, v * 100]; + }; + + convert.rgb.hwb = function (rgb) { + var r = rgb[0]; + var g = rgb[1]; + var b = rgb[2]; + var h = convert.rgb.hsl(rgb)[0]; + var w = 1 / 255 * Math.min(r, Math.min(g, b)); + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); + return [h, w * 100, b * 100]; + }; + + convert.rgb.cmyk = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var c; + var m; + var y; + var k; + k = Math.min(1 - r, 1 - g, 1 - b); + c = (1 - r - k) / (1 - k) || 0; + m = (1 - g - k) / (1 - k) || 0; + y = (1 - b - k) / (1 - k) || 0; + return [c * 100, m * 100, y * 100, k * 100]; + }; + /** + * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + * */ + + + function comparativeDistance(x, y) { + return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2); + } + + convert.rgb.keyword = function (rgb) { + var reversed = reverseKeywords[rgb]; + + if (reversed) { + return reversed; + } + + var currentClosestDistance = Infinity; + var currentClosestKeyword; + + for (var keyword in colorName) { + if (colorName.hasOwnProperty(keyword)) { + var value = colorName[keyword]; // Compute comparative distance + + var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest + + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } + } + + return currentClosestKeyword; + }; + + convert.keyword.rgb = function (keyword) { + return colorName[keyword]; + }; + + convert.rgb.xyz = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; // assume sRGB + + r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92; + g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92; + b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92; + var x = r * 0.4124 + g * 0.3576 + b * 0.1805; + var y = r * 0.2126 + g * 0.7152 + b * 0.0722; + var z = r * 0.0193 + g * 0.1192 + b * 0.9505; + return [x * 100, y * 100, z * 100]; + }; + + convert.rgb.lab = function (rgb) { + var xyz = convert.rgb.xyz(rgb); + var x = xyz[0]; + var y = xyz[1]; + var z = xyz[2]; + var l; + var a; + var b; + x /= 95.047; + y /= 100; + z /= 108.883; + x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116; + y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116; + z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116; + l = 116 * y - 16; + a = 500 * (x - y); + b = 200 * (y - z); + return [l, a, b]; + }; + + convert.hsl.rgb = function (hsl) { + var h = hsl[0] / 360; + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var t1; + var t2; + var t3; + var rgb; + var val; + + if (s === 0) { + val = l * 255; + return [val, val, val]; + } + + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } + + t1 = 2 * l - t2; + rgb = [0, 0, 0]; + + for (var i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + + if (t3 < 0) { + t3++; + } + + if (t3 > 1) { + t3--; + } + + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } + + rgb[i] = val * 255; + } + + return rgb; + }; + + convert.hsl.hsv = function (hsl) { + var h = hsl[0]; + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var smin = s; + var lmin = Math.max(l, 0.01); + var sv; + var v; + l *= 2; + s *= l <= 1 ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + v = (l + s) / 2; + sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s); + return [h, sv * 100, v * 100]; + }; + + convert.hsv.rgb = function (hsv) { + var h = hsv[0] / 60; + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var hi = Math.floor(h) % 6; + var f = h - Math.floor(h); + var p = 255 * v * (1 - s); + var q = 255 * v * (1 - s * f); + var t = 255 * v * (1 - s * (1 - f)); + v *= 255; + + switch (hi) { + case 0: + return [v, t, p]; + + case 1: + return [q, v, p]; + + case 2: + return [p, v, t]; + + case 3: + return [p, q, v]; + + case 4: + return [t, p, v]; + + case 5: + return [v, p, q]; + } + }; + + convert.hsv.hsl = function (hsv) { + var h = hsv[0]; + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var vmin = Math.max(v, 0.01); + var lmin; + var sl; + var l; + l = (2 - s) * v; + lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= lmin <= 1 ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; + return [h, sl * 100, l * 100]; + }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb + + + convert.hwb.rgb = function (hwb) { + var h = hwb[0] / 360; + var wh = hwb[1] / 100; + var bl = hwb[2] / 100; + var ratio = wh + bl; + var i; + var v; + var f; + var n; // wh + bl cant be > 1 + + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } + + i = Math.floor(6 * h); + v = 1 - bl; + f = 6 * h - i; + + if ((i & 0x01) !== 0) { + f = 1 - f; + } + + n = wh + f * (v - wh); // linear interpolation + + var r; + var g; + var b; + + switch (i) { + default: + case 6: + case 0: + r = v; + g = n; + b = wh; + break; + + case 1: + r = n; + g = v; + b = wh; + break; + + case 2: + r = wh; + g = v; + b = n; + break; + + case 3: + r = wh; + g = n; + b = v; + break; + + case 4: + r = n; + g = wh; + b = v; + break; + + case 5: + r = v; + g = wh; + b = n; + break; + } + + return [r * 255, g * 255, b * 255]; + }; + + convert.cmyk.rgb = function (cmyk) { + var c = cmyk[0] / 100; + var m = cmyk[1] / 100; + var y = cmyk[2] / 100; + var k = cmyk[3] / 100; + var r; + var g; + var b; + r = 1 - Math.min(1, c * (1 - k) + k); + g = 1 - Math.min(1, m * (1 - k) + k); + b = 1 - Math.min(1, y * (1 - k) + k); + return [r * 255, g * 255, b * 255]; + }; + + convert.xyz.rgb = function (xyz) { + var x = xyz[0] / 100; + var y = xyz[1] / 100; + var z = xyz[2] / 100; + var r; + var g; + var b; + r = x * 3.2406 + y * -1.5372 + z * -0.4986; + g = x * -0.9689 + y * 1.8758 + z * 0.0415; + b = x * 0.0557 + y * -0.2040 + z * 1.0570; // assume sRGB + + r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92; + g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92; + b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92; + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); + return [r * 255, g * 255, b * 255]; + }; + + convert.xyz.lab = function (xyz) { + var x = xyz[0]; + var y = xyz[1]; + var z = xyz[2]; + var l; + var a; + var b; + x /= 95.047; + y /= 100; + z /= 108.883; + x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116; + y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116; + z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116; + l = 116 * y - 16; + a = 500 * (x - y); + b = 200 * (y - z); + return [l, a, b]; + }; + + convert.lab.xyz = function (lab) { + var l = lab[0]; + var a = lab[1]; + var b = lab[2]; + var x; + var y; + var z; + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; + var y2 = Math.pow(y, 3); + var x2 = Math.pow(x, 3); + var z2 = Math.pow(z, 3); + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; + x *= 95.047; + y *= 100; + z *= 108.883; + return [x, y, z]; + }; + + convert.lab.lch = function (lab) { + var l = lab[0]; + var a = lab[1]; + var b = lab[2]; + var hr; + var h; + var c; + hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; + + if (h < 0) { + h += 360; + } + + c = Math.sqrt(a * a + b * b); + return [l, c, h]; + }; + + convert.lch.lab = function (lch) { + var l = lch[0]; + var c = lch[1]; + var h = lch[2]; + var a; + var b; + var hr; + hr = h / 360 * 2 * Math.PI; + a = c * Math.cos(hr); + b = c * Math.sin(hr); + return [l, a, b]; + }; + + convert.rgb.ansi16 = function (args) { + var r = args[0]; + var g = args[1]; + var b = args[2]; + var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization + + value = Math.round(value / 50); + + if (value === 0) { + return 30; + } + + var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255)); + + if (value === 2) { + ansi += 60; + } + + return ansi; + }; + + convert.hsv.ansi16 = function (args) { + // optimization here; we already know the value and don't need to get + // it converted for us. + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); + }; + + convert.rgb.ansi256 = function (args) { + var r = args[0]; + var g = args[1]; + var b = args[2]; // we use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + + if (r === g && g === b) { + if (r < 8) { + return 16; + } + + if (r > 248) { + return 231; + } + + return Math.round((r - 8) / 247 * 24) + 232; + } + + var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5); + return ansi; + }; + + convert.ansi16.rgb = function (args) { + var color = args % 10; // handle greyscale + + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } + + color = color / 10.5 * 255; + return [color, color, color]; + } + + var mult = (~~(args > 50) + 1) * 0.5; + var r = (color & 1) * mult * 255; + var g = (color >> 1 & 1) * mult * 255; + var b = (color >> 2 & 1) * mult * 255; + return [r, g, b]; + }; + + convert.ansi256.rgb = function (args) { + // handle greyscale + if (args >= 232) { + var c = (args - 232) * 10 + 8; + return [c, c, c]; + } + + args -= 16; + var rem; + var r = Math.floor(args / 36) / 5 * 255; + var g = Math.floor((rem = args % 36) / 6) / 5 * 255; + var b = rem % 6 / 5 * 255; + return [r, g, b]; + }; + + convert.rgb.hex = function (args) { + var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF); + var string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; + }; + + convert.hex.rgb = function (args) { + var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + + if (!match) { + return [0, 0, 0]; + } + + var colorString = match[0]; + + if (match[0].length === 3) { + colorString = colorString.split('').map(function (char) { + return char + char; + }).join(''); + } + + var integer = parseInt(colorString, 16); + var r = integer >> 16 & 0xFF; + var g = integer >> 8 & 0xFF; + var b = integer & 0xFF; + return [r, g, b]; + }; + + convert.rgb.hcg = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var max = Math.max(Math.max(r, g), b); + var min = Math.min(Math.min(r, g), b); + var chroma = max - min; + var grayscale; + var hue; + + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } + + if (chroma <= 0) { + hue = 0; + } else if (max === r) { + hue = (g - b) / chroma % 6; + } else if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma + 4; + } + + hue /= 6; + hue %= 1; + return [hue * 360, chroma * 100, grayscale * 100]; + }; + + convert.hsl.hcg = function (hsl) { + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var c = 1; + var f = 0; + + if (l < 0.5) { + c = 2.0 * s * l; + } else { + c = 2.0 * s * (1.0 - l); + } + + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } + + return [hsl[0], c * 100, f * 100]; + }; + + convert.hsv.hcg = function (hsv) { + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var c = s * v; + var f = 0; + + if (c < 1.0) { + f = (v - c) / (1 - c); + } + + return [hsv[0], c * 100, f * 100]; + }; + + convert.hcg.rgb = function (hcg) { + var h = hcg[0] / 360; + var c = hcg[1] / 100; + var g = hcg[2] / 100; + + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } + + var pure = [0, 0, 0]; + var hi = h % 1 * 6; + var v = hi % 1; + var w = 1 - v; + var mg = 0; + + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; + pure[1] = v; + pure[2] = 0; + break; + + case 1: + pure[0] = w; + pure[1] = 1; + pure[2] = 0; + break; + + case 2: + pure[0] = 0; + pure[1] = 1; + pure[2] = v; + break; + + case 3: + pure[0] = 0; + pure[1] = w; + pure[2] = 1; + break; + + case 4: + pure[0] = v; + pure[1] = 0; + pure[2] = 1; + break; + + default: + pure[0] = 1; + pure[1] = 0; + pure[2] = w; + } + + mg = (1.0 - c) * g; + return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255]; + }; + + convert.hcg.hsv = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + var v = c + g * (1.0 - c); + var f = 0; + + if (v > 0.0) { + f = c / v; + } + + return [hcg[0], f * 100, v * 100]; + }; + + convert.hcg.hsl = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + var l = g * (1.0 - c) + 0.5 * c; + var s = 0; + + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } + + return [hcg[0], s * 100, l * 100]; + }; + + convert.hcg.hwb = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + var v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; + }; + + convert.hwb.hcg = function (hwb) { + var w = hwb[1] / 100; + var b = hwb[2] / 100; + var v = 1 - b; + var c = v - w; + var g = 0; + + if (c < 1) { + g = (v - c) / (1 - c); + } + + return [hwb[0], c * 100, g * 100]; + }; + + convert.apple.rgb = function (apple) { + return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255]; + }; + + convert.rgb.apple = function (rgb) { + return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535]; + }; + + convert.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; + }; + + convert.gray.hsl = convert.gray.hsv = function (args) { + return [0, 0, args[0]]; + }; + + convert.gray.hwb = function (gray) { + return [0, 100, gray[0]]; + }; + + convert.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; + }; + + convert.gray.lab = function (gray) { + return [gray[0], 0, 0]; + }; + + convert.gray.hex = function (gray) { + var val = Math.round(gray[0] / 100 * 255) & 0xFF; + var integer = (val << 16) + (val << 8) + val; + var string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; + }; + + convert.rgb.gray = function (rgb) { + var val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; + }; +}); +var conversions_1 = conversions.rgb; +var conversions_2 = conversions.hsl; +var conversions_3 = conversions.hsv; +var conversions_4 = conversions.hwb; +var conversions_5 = conversions.cmyk; +var conversions_6 = conversions.xyz; +var conversions_7 = conversions.lab; +var conversions_8 = conversions.lch; +var conversions_9 = conversions.hex; +var conversions_10 = conversions.keyword; +var conversions_11 = conversions.ansi16; +var conversions_12 = conversions.ansi256; +var conversions_13 = conversions.hcg; +var conversions_14 = conversions.apple; +var conversions_15 = conversions.gray; + +/* + this function routes a model to all other models. + + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). + + conversions that are not possible simply are not included. +*/ + +function buildGraph() { + var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + + var models = Object.keys(conversions); + + for (var len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } + + return graph; +} // https://en.wikipedia.org/wiki/Breadth-first_search + + +function deriveBFS(fromModel) { + var graph = buildGraph(); + var queue = [fromModel]; // unshift -> queue -> pop + + graph[fromModel].distance = 0; + + while (queue.length) { + var current = queue.pop(); + var adjacents = Object.keys(conversions[current]); + + for (var len = adjacents.length, i = 0; i < len; i++) { + var adjacent = adjacents[i]; + var node = graph[adjacent]; + + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } + } + + return graph; +} + +function link(from, to) { + return function (args) { + return to(from(args)); + }; +} + +function wrapConversion(toModel, graph) { + var path = [graph[toModel].parent, toModel]; + var fn = conversions[graph[toModel].parent][toModel]; + var cur = graph[toModel].parent; + + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link(conversions[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } + + fn.conversion = path; + return fn; +} + +var route = function (fromModel) { + var graph = deriveBFS(fromModel); + var conversion = {}; + var models = Object.keys(graph); + + for (var len = models.length, i = 0; i < len; i++) { + var toModel = models[i]; + var node = graph[toModel]; + + if (node.parent === null) { + // no possible conversion, or this node is the source model. + continue; + } + + conversion[toModel] = wrapConversion(toModel, graph); + } + + return conversion; +}; + +var convert = {}; +var models = Object.keys(conversions); + +function wrapRaw(fn) { + var wrappedFn = function (args) { + if (args === undefined || args === null) { + return args; + } + + if (arguments.length > 1) { + args = Array.prototype.slice.call(arguments); + } + + return fn(args); + }; // preserve .conversion property if there is one + + + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +function wrapRounded(fn) { + var wrappedFn = function (args) { + if (args === undefined || args === null) { + return args; + } + + if (arguments.length > 1) { + args = Array.prototype.slice.call(arguments); + } + + var result = fn(args); // we're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + + if (typeof result === 'object') { + for (var len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } + } + + return result; + }; // preserve .conversion property if there is one + + + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +models.forEach(function (fromModel) { + convert[fromModel] = {}; + Object.defineProperty(convert[fromModel], 'channels', { + value: conversions[fromModel].channels + }); + Object.defineProperty(convert[fromModel], 'labels', { + value: conversions[fromModel].labels + }); + var routes = route(fromModel); + var routeModels = Object.keys(routes); + routeModels.forEach(function (toModel) { + var fn = routes[toModel]; + convert[fromModel][toModel] = wrapRounded(fn); + convert[fromModel][toModel].raw = wrapRaw(fn); + }); +}); +var colorConvert = convert; + +var ansiStyles = createCommonjsModule(function (module) { + + const wrapAnsi16 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${code + offset}m`; + }; + + const wrapAnsi256 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};5;${code}m`; + }; + + const wrapAnsi16m = (fn, offset) => function () { + const rgb = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; + }; + + function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + // Bright color + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; // Fix humans + + styles.color.grey = styles.color.gray; + + for (const groupName of Object.keys(styles)) { + const group = styles[groupName]; + + for (const styleName of Object.keys(group)) { + const style = group[styleName]; + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + group[styleName] = styles[styleName]; + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + } + + const ansi2ansi = n => n; + + const rgb2rgb = (r, g, b) => [r, g, b]; + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + styles.color.ansi = { + ansi: wrapAnsi16(ansi2ansi, 0) + }; + styles.color.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 0) + }; + styles.color.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 0) + }; + styles.bgColor.ansi = { + ansi: wrapAnsi16(ansi2ansi, 10) + }; + styles.bgColor.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 10) + }; + styles.bgColor.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 10) + }; + + for (let key of Object.keys(colorConvert)) { + if (typeof colorConvert[key] !== 'object') { + continue; + } + + const suite = colorConvert[key]; + + if (key === 'ansi16') { + key = 'ansi'; + } + + if ('ansi16' in suite) { + styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); + styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); + } + + if ('ansi256' in suite) { + styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); + styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); + } + + if ('rgb' in suite) { + styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); + styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); + } + } + + return styles; + } // Make the export immutable + + + Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles + }); +}); + +var hasFlag = (flag, argv) => { + argv = argv || process.argv; + const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--'; + const pos = argv.indexOf(prefix + flag); + const terminatorPos = argv.indexOf('--'); + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +}; + +const env = process.env; +let forceColor; + +if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { + forceColor = false; +} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) { + forceColor = true; +} + +if ('FORCE_COLOR' in env) { + forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} + +function supportsColor(stream) { + if (forceColor === false) { + return 0; + } + + if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (stream && !stream.isTTY && forceColor !== true) { + return 0; + } + + const min = forceColor ? 1 : 0; + + if (process.platform === 'win32') { + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows + // release that supports 256 colors. Windows 10 build 14931 is the first release + // that supports 16m/TrueColor. + const osRelease = os$1.release().split('.'); + + if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } + + if (env.COLORTERM === 'truecolor') { + return 3; + } + + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + if (env.TERM === 'dumb') { + return min; + } + + return min; +} + +function getSupportLevel(stream) { + const level = supportsColor(stream); + return translateLevel(level); +} + +var supportsColor_1 = { + supportsColor: getSupportLevel, + stdout: getSupportLevel(process.stdout), + stderr: getSupportLevel(process.stderr) +}; + +const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi; +const ESCAPES = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]); + +function unescape(c) { + if (c[0] === 'u' && c.length === 5 || c[0] === 'x' && c.length === 3) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } + + return ESCAPES.get(c) || c; +} + +function parseArguments(name, args) { + const results = []; + const chunks = args.trim().split(/\s*,\s*/g); + let matches; + + for (const chunk of chunks) { + if (!isNaN(chunk)) { + results.push(Number(chunk)); + } else if (matches = chunk.match(STRING_REGEX)) { + results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } + + return results; +} + +function parseStyle(style) { + STYLE_REGEX.lastIndex = 0; + const results = []; + let matches; + + while ((matches = STYLE_REGEX.exec(style)) !== null) { + const name = matches[1]; + + if (matches[2]) { + const args = parseArguments(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } + } + + return results; +} + +function buildStyle(chalk, styles) { + const enabled = {}; + + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } + + let current = chalk; + + for (const styleName of Object.keys(enabled)) { + if (Array.isArray(enabled[styleName])) { + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } + + if (enabled[styleName].length > 0) { + current = current[styleName].apply(current, enabled[styleName]); + } else { + current = current[styleName]; + } + } + } + + return current; +} + +var templates = (chalk, tmp) => { + const styles = []; + const chunks = []; + let chunk = []; // eslint-disable-next-line max-params + + tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => { + if (escapeChar) { + chunk.push(unescape(escapeChar)); + } else if (style) { + const str = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str)); + styles.push({ + inverse, + styles: parseStyle(style) + }); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } + + chunks.push(buildStyle(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); + } else { + chunk.push(chr); + } + }); + chunks.push(chunk.join('')); + + if (styles.length > 0) { + const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMsg); + } + + return chunks.join(''); +}; + +var chalk = createCommonjsModule(function (module) { + + const stdoutColor = supportsColor_1.stdout; + const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` → `ansiStyles.color[name]` mapping + + const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such + + const skipModels = new Set(['gray']); + const styles = Object.create(null); + + function applyOptions(obj, options) { + options = options || {}; // Detect level if not set manually + + const scLevel = stdoutColor ? stdoutColor.level : 0; + obj.level = options.level === undefined ? scLevel : options.level; + obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; + } + + function Chalk(options) { + // We check for this.template here since calling `chalk.constructor()` + // by itself will have a `this` of a previously constructed chalk object + if (!this || !(this instanceof Chalk) || this.template) { + const chalk = {}; + applyOptions(chalk, options); + + chalk.template = function () { + const args = [].slice.call(arguments); + return chalkTag.apply(null, [chalk.template].concat(args)); + }; + + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); + chalk.template.constructor = Chalk; + return chalk.template; + } + + applyOptions(this, options); + } // Use bright blue on Windows as the normal blue color is illegible + + + if (isSimpleWindowsTerm) { + ansiStyles.blue.open = '\u001B[94m'; + } + + for (const key of Object.keys(ansiStyles)) { + ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + styles[key] = { + get() { + const codes = ansiStyles[key]; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); + } + + }; + } + + styles.visible = { + get() { + return build.call(this, this._styles || [], true, 'visible'); + } + + }; + ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); + + for (const model of Object.keys(ansiStyles.color.ansi)) { + if (skipModels.has(model)) { + continue; + } + + styles[model] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles.color.close, + closeRe: ansiStyles.color.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + }; + } + + }; + } + + ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); + + for (const model of Object.keys(ansiStyles.bgColor.ansi)) { + if (skipModels.has(model)) { + continue; + } + + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles.bgColor.close, + closeRe: ansiStyles.bgColor.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + }; + } + + }; + } + + const proto = Object.defineProperties(() => {}, styles); + + function build(_styles, _empty, key) { + const builder = function () { + return applyStyle.apply(builder, arguments); + }; + + builder._styles = _styles; + builder._empty = _empty; + const self = this; + Object.defineProperty(builder, 'level', { + enumerable: true, + + get() { + return self.level; + }, + + set(level) { + self.level = level; + } + + }); + Object.defineProperty(builder, 'enabled', { + enumerable: true, + + get() { + return self.enabled; + }, + + set(enabled) { + self.enabled = enabled; + } + + }); // See below for fix regarding invisible grey/dim combination on Windows + + builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; // `__proto__` is used because we must return a function, but there is + // no way to create a function with a different prototype + + builder.__proto__ = proto; // eslint-disable-line no-proto + + return builder; + } + + function applyStyle() { + // Support varags, but simply cast to string in case there's only one arg + const args = arguments; + const argsLen = args.length; + let str = String(arguments[0]); + + if (argsLen === 0) { + return ''; + } + + if (argsLen > 1) { + // Don't slice `arguments`, it prevents V8 optimizations + for (let a = 1; a < argsLen; a++) { + str += ' ' + args[a]; + } + } + + if (!this.enabled || this.level <= 0 || !str) { + return this._empty ? '' : str; + } // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, + // see https://github.com/chalk/chalk/issues/58 + // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. + + + const originalDim = ansiStyles.dim.open; + + if (isSimpleWindowsTerm && this.hasGrey) { + ansiStyles.dim.open = ''; + } + + for (const code of this._styles.slice().reverse()) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + str = code.open + str.replace(code.closeRe, code.open) + code.close; // Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS + // https://github.com/chalk/chalk/pull/92 + + str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); + } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue + + + ansiStyles.dim.open = originalDim; + return str; + } + + function chalkTag(chalk, strings) { + if (!Array.isArray(strings)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return [].slice.call(arguments, 1).join(' '); + } + + const args = [].slice.call(arguments, 2); + const parts = [strings.raw[0]]; + + for (let i = 1; i < strings.length; i++) { + parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); + parts.push(String(strings.raw[i])); + } + + return templates(chalk, parts.join('')); + } + + Object.defineProperties(Chalk.prototype, styles); + module.exports = Chalk(); // eslint-disable-line new-cap + + module.exports.supportsColor = stdoutColor; + module.exports.default = module.exports; // For TypeScript +}); +var chalk_1 = chalk.supportsColor; + +var common = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + exports.commonDeprecatedHandler = (keyOrPair, redirectTo, { + descriptor + }) => { + const messages = [`${chalk.default.yellow(typeof keyOrPair === 'string' ? descriptor.key(keyOrPair) : descriptor.pair(keyOrPair))} is deprecated`]; + + if (redirectTo) { + messages.push(`we now treat it as ${chalk.default.blue(typeof redirectTo === 'string' ? descriptor.key(redirectTo) : descriptor.pair(redirectTo))}`); + } + + return messages.join('; ') + '.'; + }; +}); +unwrapExports(common); +var common_1 = common.commonDeprecatedHandler; + +var deprecated = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + tslib_1.__exportStar(common, exports); +}); +unwrapExports(deprecated); + +var common$1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + exports.commonInvalidHandler = (key, value, utils) => [`Invalid ${chalk.default.red(utils.descriptor.key(key))} value.`, `Expected ${chalk.default.blue(utils.schemas[key].expected(utils))},`, `but received ${chalk.default.red(utils.descriptor.value(value))}.`].join(' '); +}); +unwrapExports(common$1); +var common_1$1 = common$1.commonInvalidHandler; + +var invalid = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + tslib_1.__exportStar(common$1, exports); +}); +unwrapExports(invalid); + +/* eslint-disable no-nested-ternary */ + +var arr = []; +var charCodeCache = []; + +var leven = function (a, b) { + if (a === b) { + return 0; + } + + var swap = a; // Swapping the strings if `a` is longer than `b` so we know which one is the + // shortest & which one is the longest + + if (a.length > b.length) { + a = b; + b = swap; + } + + var aLen = a.length; + var bLen = b.length; + + if (aLen === 0) { + return bLen; + } + + if (bLen === 0) { + return aLen; + } // Performing suffix trimming: + // We can linearly drop suffix common to both strings since they + // don't increase distance at all + // Note: `~-` is the bitwise way to perform a `- 1` operation + + + while (aLen > 0 && a.charCodeAt(~-aLen) === b.charCodeAt(~-bLen)) { + aLen--; + bLen--; + } + + if (aLen === 0) { + return bLen; + } // Performing prefix trimming + // We can linearly drop prefix common to both strings since they + // don't increase distance at all + + + var start = 0; + + while (start < aLen && a.charCodeAt(start) === b.charCodeAt(start)) { + start++; + } + + aLen -= start; + bLen -= start; + + if (aLen === 0) { + return bLen; + } + + var bCharCode; + var ret; + var tmp; + var tmp2; + var i = 0; + var j = 0; + + while (i < aLen) { + charCodeCache[start + i] = a.charCodeAt(start + i); + arr[i] = ++i; + } + + while (j < bLen) { + bCharCode = b.charCodeAt(start + j); + tmp = j++; + ret = j; + + for (i = 0; i < aLen; i++) { + tmp2 = bCharCode === charCodeCache[start + i] ? tmp : tmp + 1; + tmp = arr[i]; + ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2; + } + } + + return ret; +}; + +var leven_1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + exports.levenUnknownHandler = (key, value, { + descriptor, + logger, + schemas + }) => { + const messages = [`Ignored unknown option ${chalk.default.yellow(descriptor.pair({ + key, + value + }))}.`]; + const suggestion = Object.keys(schemas).sort().find(knownKey => leven(key, knownKey) < 3); + + if (suggestion) { + messages.push(`Did you mean ${chalk.default.blue(descriptor.key(suggestion))}?`); + } + + logger.warn(messages.join(' ')); + }; +}); +unwrapExports(leven_1); +var leven_2 = leven_1.levenUnknownHandler; + +var unknown = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + tslib_1.__exportStar(leven_1, exports); +}); +unwrapExports(unknown); + +var handlers = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + tslib_1.__exportStar(deprecated, exports); + + tslib_1.__exportStar(invalid, exports); + + tslib_1.__exportStar(unknown, exports); +}); +unwrapExports(handlers); + +var schema = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + const HANDLER_KEYS = ['default', 'expected', 'validate', 'deprecated', 'forward', 'redirect', 'overlap', 'preprocess', 'postprocess']; + + function createSchema(SchemaConstructor, parameters) { + const schema = new SchemaConstructor(parameters); + const subSchema = Object.create(schema); + + for (const handlerKey of HANDLER_KEYS) { + if (handlerKey in parameters) { + subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema, Schema.prototype[handlerKey].length); + } + } + + return subSchema; + } + + exports.createSchema = createSchema; + + class Schema { + constructor(parameters) { + this.name = parameters.name; + } + + static create(parameters) { + // @ts-ignore: https://github.com/Microsoft/TypeScript/issues/5863 + return createSchema(this, parameters); + } + + default(_utils) { + return undefined; + } // istanbul ignore next: this is actually an abstract method but we need a placeholder to get `function.length` + + + expected(_utils) { + return 'nothing'; + } // istanbul ignore next: this is actually an abstract method but we need a placeholder to get `function.length` + + + validate(_value, _utils) { + return false; + } + + deprecated(_value, _utils) { + return false; + } + + forward(_value, _utils) { + return undefined; + } + + redirect(_value, _utils) { + return undefined; + } + + overlap(currentValue, _newValue, _utils) { + return currentValue; + } + + preprocess(value, _utils) { + return value; + } + + postprocess(value, _utils) { + return value; + } + + } + + exports.Schema = Schema; + + function normalizeHandler(handler, superSchema, handlerArgumentsLength) { + return typeof handler === 'function' ? (...args) => handler(...args.slice(0, handlerArgumentsLength - 1), superSchema, ...args.slice(handlerArgumentsLength - 1)) : () => handler; + } +}); +unwrapExports(schema); +var schema_1 = schema.createSchema; +var schema_2 = schema.Schema; + +var alias = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class AliasSchema extends schema.Schema { + constructor(parameters) { + super(parameters); + this._sourceName = parameters.sourceName; + } + + expected(utils) { + return utils.schemas[this._sourceName].expected(utils); + } + + validate(value, utils) { + return utils.schemas[this._sourceName].validate(value, utils); + } + + redirect(_value, _utils) { + return this._sourceName; + } + + } + + exports.AliasSchema = AliasSchema; +}); +unwrapExports(alias); +var alias_1 = alias.AliasSchema; + +var any = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class AnySchema extends schema.Schema { + expected() { + return 'anything'; + } + + validate() { + return true; + } + + } + + exports.AnySchema = AnySchema; +}); +unwrapExports(any); +var any_1 = any.AnySchema; + +var array = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class ArraySchema extends schema.Schema { + constructor(_a) { + var { + valueSchema, + name = valueSchema.name + } = _a, + handlers = tslib_1.__rest(_a, ["valueSchema", "name"]); + + super(Object.assign({}, handlers, { + name + })); + this._valueSchema = valueSchema; + } + + expected(utils) { + return `an array of ${this._valueSchema.expected(utils)}`; + } + + validate(value, utils) { + if (!Array.isArray(value)) { + return false; + } + + const invalidValues = []; + + for (const subValue of value) { + const subValidateResult = utils.normalizeValidateResult(this._valueSchema.validate(subValue, utils), subValue); + + if (subValidateResult !== true) { + invalidValues.push(subValidateResult.value); + } + } + + return invalidValues.length === 0 ? true : { + value: invalidValues + }; + } + + deprecated(value, utils) { + const deprecatedResult = []; + + for (const subValue of value) { + const subDeprecatedResult = utils.normalizeDeprecatedResult(this._valueSchema.deprecated(subValue, utils), subValue); + + if (subDeprecatedResult !== false) { + deprecatedResult.push(...subDeprecatedResult.map(({ + value: deprecatedValue + }) => ({ + value: [deprecatedValue] + }))); + } + } + + return deprecatedResult; + } + + forward(value, utils) { + const forwardResult = []; + + for (const subValue of value) { + const subForwardResult = utils.normalizeForwardResult(this._valueSchema.forward(subValue, utils), subValue); + forwardResult.push(...subForwardResult.map(wrapTransferResult)); + } + + return forwardResult; + } + + redirect(value, utils) { + const remain = []; + const redirect = []; + + for (const subValue of value) { + const subRedirectResult = utils.normalizeRedirectResult(this._valueSchema.redirect(subValue, utils), subValue); + + if ('remain' in subRedirectResult) { + remain.push(subRedirectResult.remain); + } + + redirect.push(...subRedirectResult.redirect.map(wrapTransferResult)); + } + + return remain.length === 0 ? { + redirect + } : { + redirect, + remain + }; + } + + overlap(currentValue, newValue) { + return currentValue.concat(newValue); + } + + } + + exports.ArraySchema = ArraySchema; + + function wrapTransferResult({ + from, + to + }) { + return { + from: [from], + to + }; + } +}); +unwrapExports(array); +var array_1 = array.ArraySchema; + +var boolean_1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class BooleanSchema extends schema.Schema { + expected() { + return 'true or false'; + } + + validate(value) { + return typeof value === 'boolean'; + } + + } + + exports.BooleanSchema = BooleanSchema; +}); +unwrapExports(boolean_1); +var boolean_2 = boolean_1.BooleanSchema; + +var utils = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function recordFromArray(array, mainKey) { + const record = Object.create(null); + + for (const value of array) { + const key = value[mainKey]; // istanbul ignore next + + if (record[key]) { + throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key)}`); + } // @ts-ignore + + + record[key] = value; + } + + return record; + } + + exports.recordFromArray = recordFromArray; + + function mapFromArray(array, mainKey) { + const map = new Map(); + + for (const value of array) { + const key = value[mainKey]; // istanbul ignore next + + if (map.has(key)) { + throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key)}`); + } + + map.set(key, value); + } + + return map; + } + + exports.mapFromArray = mapFromArray; + + function createAutoChecklist() { + const map = Object.create(null); + return id => { + const idString = JSON.stringify(id); + + if (map[idString]) { + return true; + } + + map[idString] = true; + return false; + }; + } + + exports.createAutoChecklist = createAutoChecklist; + + function partition(array, predicate) { + const trueArray = []; + const falseArray = []; + + for (const value of array) { + if (predicate(value)) { + trueArray.push(value); + } else { + falseArray.push(value); + } + } + + return [trueArray, falseArray]; + } + + exports.partition = partition; + + function isInt(value) { + return value === Math.floor(value); + } + + exports.isInt = isInt; + + function comparePrimitive(a, b) { + if (a === b) { + return 0; + } + + const typeofA = typeof a; + const typeofB = typeof b; + const orders = ['undefined', 'object', 'boolean', 'number', 'string']; + + if (typeofA !== typeofB) { + return orders.indexOf(typeofA) - orders.indexOf(typeofB); + } + + if (typeofA !== 'string') { + return Number(a) - Number(b); + } + + return a.localeCompare(b); + } + + exports.comparePrimitive = comparePrimitive; + + function normalizeDefaultResult(result) { + return result === undefined ? {} : result; + } + + exports.normalizeDefaultResult = normalizeDefaultResult; + + function normalizeValidateResult(result, value) { + return result === true ? true : result === false ? { + value + } : result; + } + + exports.normalizeValidateResult = normalizeValidateResult; + + function normalizeDeprecatedResult(result, value, doNotNormalizeTrue = false) { + return result === false ? false : result === true ? doNotNormalizeTrue ? true : [{ + value + }] : 'value' in result ? [result] : result.length === 0 ? false : result; + } + + exports.normalizeDeprecatedResult = normalizeDeprecatedResult; + + function normalizeTransferResult(result, value) { + return typeof result === 'string' || 'key' in result ? { + from: value, + to: result + } : 'from' in result ? { + from: result.from, + to: result.to + } : { + from: value, + to: result.to + }; + } + + exports.normalizeTransferResult = normalizeTransferResult; + + function normalizeForwardResult(result, value) { + return result === undefined ? [] : Array.isArray(result) ? result.map(transferResult => normalizeTransferResult(transferResult, value)) : [normalizeTransferResult(result, value)]; + } + + exports.normalizeForwardResult = normalizeForwardResult; + + function normalizeRedirectResult(result, value) { + const redirect = normalizeForwardResult(typeof result === 'object' && 'redirect' in result ? result.redirect : result, value); + return redirect.length === 0 ? { + remain: value, + redirect + } : typeof result === 'object' && 'remain' in result ? { + remain: result.remain, + redirect + } : { + redirect + }; + } + + exports.normalizeRedirectResult = normalizeRedirectResult; +}); +unwrapExports(utils); +var utils_1 = utils.recordFromArray; +var utils_2 = utils.mapFromArray; +var utils_3 = utils.createAutoChecklist; +var utils_4 = utils.partition; +var utils_5 = utils.isInt; +var utils_6 = utils.comparePrimitive; +var utils_7 = utils.normalizeDefaultResult; +var utils_8 = utils.normalizeValidateResult; +var utils_9 = utils.normalizeDeprecatedResult; +var utils_10 = utils.normalizeTransferResult; +var utils_11 = utils.normalizeForwardResult; +var utils_12 = utils.normalizeRedirectResult; + +var choice = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class ChoiceSchema extends schema.Schema { + constructor(parameters) { + super(parameters); + this._choices = utils.mapFromArray(parameters.choices.map(choice => choice && typeof choice === 'object' ? choice : { + value: choice + }), 'value'); + } + + expected({ + descriptor + }) { + const choiceValues = Array.from(this._choices.keys()).map(value => this._choices.get(value)).filter(choiceInfo => !choiceInfo.deprecated).map(choiceInfo => choiceInfo.value).sort(utils.comparePrimitive).map(descriptor.value); + const head = choiceValues.slice(0, -2); + const tail = choiceValues.slice(-2); + return head.concat(tail.join(' or ')).join(', '); + } + + validate(value) { + return this._choices.has(value); + } + + deprecated(value) { + const choiceInfo = this._choices.get(value); + + return choiceInfo && choiceInfo.deprecated ? { + value + } : false; + } + + forward(value) { + const choiceInfo = this._choices.get(value); + + return choiceInfo ? choiceInfo.forward : undefined; + } + + redirect(value) { + const choiceInfo = this._choices.get(value); + + return choiceInfo ? choiceInfo.redirect : undefined; + } + + } + + exports.ChoiceSchema = ChoiceSchema; +}); +unwrapExports(choice); +var choice_1 = choice.ChoiceSchema; + +var number = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class NumberSchema extends schema.Schema { + expected() { + return 'a number'; + } + + validate(value, _utils) { + return typeof value === 'number'; + } + + } + + exports.NumberSchema = NumberSchema; +}); +unwrapExports(number); +var number_1 = number.NumberSchema; + +var integer = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class IntegerSchema extends number.NumberSchema { + expected() { + return 'an integer'; + } + + validate(value, utils$1) { + return utils$1.normalizeValidateResult(super.validate(value, utils$1), value) === true && utils.isInt(value); + } + + } + + exports.IntegerSchema = IntegerSchema; +}); +unwrapExports(integer); +var integer_1 = integer.IntegerSchema; + +var string = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class StringSchema extends schema.Schema { + expected() { + return 'a string'; + } + + validate(value) { + return typeof value === 'string'; + } + + } + + exports.StringSchema = StringSchema; +}); +unwrapExports(string); +var string_1 = string.StringSchema; + +var schemas = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + tslib_1.__exportStar(alias, exports); + + tslib_1.__exportStar(any, exports); + + tslib_1.__exportStar(array, exports); + + tslib_1.__exportStar(boolean_1, exports); + + tslib_1.__exportStar(choice, exports); + + tslib_1.__exportStar(integer, exports); + + tslib_1.__exportStar(number, exports); + + tslib_1.__exportStar(string, exports); +}); +unwrapExports(schemas); + +var defaults = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.defaultDescriptor = api.apiDescriptor; + exports.defaultUnknownHandler = leven_1.levenUnknownHandler; + exports.defaultInvalidHandler = invalid.commonInvalidHandler; + exports.defaultDeprecatedHandler = common.commonDeprecatedHandler; +}); +unwrapExports(defaults); +var defaults_1 = defaults.defaultDescriptor; +var defaults_2 = defaults.defaultUnknownHandler; +var defaults_3 = defaults.defaultInvalidHandler; +var defaults_4 = defaults.defaultDeprecatedHandler; + +var normalize = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + exports.normalize = (options, schemas, opts) => new Normalizer(schemas, opts).normalize(options); + + class Normalizer { + constructor(schemas, opts) { + // istanbul ignore next + const { + logger = console, + descriptor = defaults.defaultDescriptor, + unknown = defaults.defaultUnknownHandler, + invalid = defaults.defaultInvalidHandler, + deprecated = defaults.defaultDeprecatedHandler + } = opts || {}; + this._utils = { + descriptor, + logger: + /* istanbul ignore next */ + logger || { + warn: () => {} + }, + schemas: utils.recordFromArray(schemas, 'name'), + normalizeDefaultResult: utils.normalizeDefaultResult, + normalizeDeprecatedResult: utils.normalizeDeprecatedResult, + normalizeForwardResult: utils.normalizeForwardResult, + normalizeRedirectResult: utils.normalizeRedirectResult, + normalizeValidateResult: utils.normalizeValidateResult + }; + this._unknownHandler = unknown; + this._invalidHandler = invalid; + this._deprecatedHandler = deprecated; + this.cleanHistory(); + } + + cleanHistory() { + this._hasDeprecationWarned = utils.createAutoChecklist(); + } + + normalize(options) { + const normalized = {}; + const restOptionsArray = [options]; + + const applyNormalization = () => { + while (restOptionsArray.length !== 0) { + const currentOptions = restOptionsArray.shift(); + + const transferredOptionsArray = this._applyNormalization(currentOptions, normalized); + + restOptionsArray.push(...transferredOptionsArray); + } + }; + + applyNormalization(); + + for (const key of Object.keys(this._utils.schemas)) { + const schema = this._utils.schemas[key]; + + if (!(key in normalized)) { + const defaultResult = utils.normalizeDefaultResult(schema.default(this._utils)); + + if ('value' in defaultResult) { + restOptionsArray.push({ + [key]: defaultResult.value + }); + } + } + } + + applyNormalization(); + + for (const key of Object.keys(this._utils.schemas)) { + const schema = this._utils.schemas[key]; + + if (key in normalized) { + normalized[key] = schema.postprocess(normalized[key], this._utils); + } + } + + return normalized; + } + + _applyNormalization(options, normalized) { + const transferredOptionsArray = []; + const [knownOptionNames, unknownOptionNames] = utils.partition(Object.keys(options), key => key in this._utils.schemas); + + for (const key of knownOptionNames) { + const schema = this._utils.schemas[key]; + const value = schema.preprocess(options[key], this._utils); + const validateResult = utils.normalizeValidateResult(schema.validate(value, this._utils), value); + + if (validateResult !== true) { + const { + value: invalidValue + } = validateResult; + + const errorMessageOrError = this._invalidHandler(key, invalidValue, this._utils); + + throw typeof errorMessageOrError === 'string' ? new Error(errorMessageOrError) : + /* istanbul ignore next*/ + errorMessageOrError; + } + + const appendTransferredOptions = ({ + from, + to + }) => { + transferredOptionsArray.push(typeof to === 'string' ? { + [to]: from + } : { + [to.key]: to.value + }); + }; + + const warnDeprecated = ({ + value: currentValue, + redirectTo + }) => { + const deprecatedResult = utils.normalizeDeprecatedResult(schema.deprecated(currentValue, this._utils), value, + /* doNotNormalizeTrue */ + true); + + if (deprecatedResult === false) { + return; + } + + if (deprecatedResult === true) { + if (!this._hasDeprecationWarned(key)) { + this._utils.logger.warn(this._deprecatedHandler(key, redirectTo, this._utils)); + } + } else { + for (const { + value: deprecatedValue + } of deprecatedResult) { + const pair = { + key, + value: deprecatedValue + }; + + if (!this._hasDeprecationWarned(pair)) { + const redirectToPair = typeof redirectTo === 'string' ? { + key: redirectTo, + value: deprecatedValue + } : redirectTo; + + this._utils.logger.warn(this._deprecatedHandler(pair, redirectToPair, this._utils)); + } + } + } + }; + + const forwardResult = utils.normalizeForwardResult(schema.forward(value, this._utils), value); + forwardResult.forEach(appendTransferredOptions); + const redirectResult = utils.normalizeRedirectResult(schema.redirect(value, this._utils), value); + redirectResult.redirect.forEach(appendTransferredOptions); + + if ('remain' in redirectResult) { + const remainingValue = redirectResult.remain; + normalized[key] = key in normalized ? schema.overlap(normalized[key], remainingValue, this._utils) : remainingValue; + warnDeprecated({ + value: remainingValue + }); + } + + for (const { + from, + to + } of redirectResult.redirect) { + warnDeprecated({ + value: from, + redirectTo: to + }); + } + } + + for (const key of unknownOptionNames) { + const value = options[key]; + + const unknownResult = this._unknownHandler(key, value, this._utils); + + if (unknownResult) { + for (const unknownKey of Object.keys(unknownResult)) { + const unknownOption = { + [unknownKey]: unknownResult[unknownKey] + }; + + if (unknownKey in this._utils.schemas) { + transferredOptionsArray.push(unknownOption); + } else { + Object.assign(normalized, unknownOption); + } + } + } + } + + return transferredOptionsArray; + } + + } + + exports.Normalizer = Normalizer; +}); +unwrapExports(normalize); +var normalize_1 = normalize.normalize; +var normalize_2 = normalize.Normalizer; + +var lib = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + tslib_1.__exportStar(descriptors, exports); + + tslib_1.__exportStar(handlers, exports); + + tslib_1.__exportStar(schemas, exports); + + tslib_1.__exportStar(normalize, exports); + + tslib_1.__exportStar(schema, exports); +}); +unwrapExports(lib); + +const array$1 = []; +const charCodeCache$1 = []; + +const leven$1 = (left, right) => { + if (left === right) { + return 0; + } + + const swap = left; // Swapping the strings if `a` is longer than `b` so we know which one is the + // shortest & which one is the longest + + if (left.length > right.length) { + left = right; + right = swap; + } + + let leftLength = left.length; + let rightLength = right.length; // Performing suffix trimming: + // We can linearly drop suffix common to both strings since they + // don't increase distance at all + // Note: `~-` is the bitwise way to perform a `- 1` operation + + while (leftLength > 0 && left.charCodeAt(~-leftLength) === right.charCodeAt(~-rightLength)) { + leftLength--; + rightLength--; + } // Performing prefix trimming + // We can linearly drop prefix common to both strings since they + // don't increase distance at all + + + let start = 0; + + while (start < leftLength && left.charCodeAt(start) === right.charCodeAt(start)) { + start++; + } + + leftLength -= start; + rightLength -= start; + + if (leftLength === 0) { + return rightLength; + } + + let bCharCode; + let result; + let temp; + let temp2; + let i = 0; + let j = 0; + + while (i < leftLength) { + charCodeCache$1[i] = left.charCodeAt(start + i); + array$1[i] = ++i; + } + + while (j < rightLength) { + bCharCode = right.charCodeAt(start + j); + temp = j++; + result = j; + + for (i = 0; i < leftLength; i++) { + temp2 = bCharCode === charCodeCache$1[i] ? temp : temp + 1; + temp = array$1[i]; // eslint-disable-next-line no-multi-assign + + result = array$1[i] = temp > result ? temp2 > result ? result + 1 : temp2 : temp2 > temp ? temp + 1 : temp2; + } + } + + return result; +}; + +var leven_1$1 = leven$1; // TODO: Remove this for the next major release + +var default_1 = leven$1; +leven_1$1.default = default_1; + +var colorName$1 = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; + +/* MIT license */ + +/* eslint-disable no-mixed-operators */ +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). +// do not use box values types (i.e. Number(), String(), etc.) + +const reverseKeywords = {}; + +for (const key of Object.keys(colorName$1)) { + reverseKeywords[colorName$1[key]] = key; +} + +const convert$1 = { + rgb: { + channels: 3, + labels: 'rgb' + }, + hsl: { + channels: 3, + labels: 'hsl' + }, + hsv: { + channels: 3, + labels: 'hsv' + }, + hwb: { + channels: 3, + labels: 'hwb' + }, + cmyk: { + channels: 4, + labels: 'cmyk' + }, + xyz: { + channels: 3, + labels: 'xyz' + }, + lab: { + channels: 3, + labels: 'lab' + }, + lch: { + channels: 3, + labels: 'lch' + }, + hex: { + channels: 1, + labels: ['hex'] + }, + keyword: { + channels: 1, + labels: ['keyword'] + }, + ansi16: { + channels: 1, + labels: ['ansi16'] + }, + ansi256: { + channels: 1, + labels: ['ansi256'] + }, + hcg: { + channels: 3, + labels: ['h', 'c', 'g'] + }, + apple: { + channels: 3, + labels: ['r16', 'g16', 'b16'] + }, + gray: { + channels: 1, + labels: ['gray'] + } +}; +var conversions$1 = convert$1; // Hide .channels and .labels properties + +for (const model of Object.keys(convert$1)) { + if (!('channels' in convert$1[model])) { + throw new Error('missing channels property: ' + model); + } + + if (!('labels' in convert$1[model])) { + throw new Error('missing channel labels property: ' + model); + } + + if (convert$1[model].labels.length !== convert$1[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); + } + + const { + channels, + labels + } = convert$1[model]; + delete convert$1[model].channels; + delete convert$1[model].labels; + Object.defineProperty(convert$1[model], 'channels', { + value: channels + }); + Object.defineProperty(convert$1[model], 'labels', { + value: labels + }); +} + +convert$1.rgb.hsl = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const min = Math.min(r, g, b); + const max = Math.max(r, g, b); + const delta = max - min; + let h; + let s; + + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } + + h = Math.min(h * 60, 360); + + if (h < 0) { + h += 360; + } + + const l = (min + max) / 2; + + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } + + return [h, s * 100, l * 100]; +}; + +convert$1.rgb.hsv = function (rgb) { + let rdif; + let gdif; + let bdif; + let h; + let s; + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const v = Math.max(r, g, b); + const diff = v - Math.min(r, g, b); + + const diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; + + if (diff === 0) { + h = 0; + s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); + + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = 1 / 3 + rdif - bdif; + } else if (b === v) { + h = 2 / 3 + gdif - rdif; + } + + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + } + + return [h * 360, s * 100, v * 100]; +}; + +convert$1.rgb.hwb = function (rgb) { + const r = rgb[0]; + const g = rgb[1]; + let b = rgb[2]; + const h = convert$1.rgb.hsl(rgb)[0]; + const w = 1 / 255 * Math.min(r, Math.min(g, b)); + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); + return [h, w * 100, b * 100]; +}; + +convert$1.rgb.cmyk = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const k = Math.min(1 - r, 1 - g, 1 - b); + const c = (1 - r - k) / (1 - k) || 0; + const m = (1 - g - k) / (1 - k) || 0; + const y = (1 - b - k) / (1 - k) || 0; + return [c * 100, m * 100, y * 100, k * 100]; +}; + +function comparativeDistance(x, y) { + /* + See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + */ + return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2; +} + +convert$1.rgb.keyword = function (rgb) { + const reversed = reverseKeywords[rgb]; + + if (reversed) { + return reversed; + } + + let currentClosestDistance = Infinity; + let currentClosestKeyword; + + for (const keyword of Object.keys(colorName$1)) { + const value = colorName$1[keyword]; // Compute comparative distance + + const distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest + + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } + + return currentClosestKeyword; +}; + +convert$1.keyword.rgb = function (keyword) { + return colorName$1[keyword]; +}; + +convert$1.rgb.xyz = function (rgb) { + let r = rgb[0] / 255; + let g = rgb[1] / 255; + let b = rgb[2] / 255; // Assume sRGB + + r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92; + g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92; + b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92; + const x = r * 0.4124 + g * 0.3576 + b * 0.1805; + const y = r * 0.2126 + g * 0.7152 + b * 0.0722; + const z = r * 0.0193 + g * 0.1192 + b * 0.9505; + return [x * 100, y * 100, z * 100]; +}; + +convert$1.rgb.lab = function (rgb) { + const xyz = convert$1.rgb.xyz(rgb); + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; + x /= 95.047; + y /= 100; + z /= 108.883; + x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116; + y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116; + z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116; + const l = 116 * y - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + return [l, a, b]; +}; + +convert$1.hsl.rgb = function (hsl) { + const h = hsl[0] / 360; + const s = hsl[1] / 100; + const l = hsl[2] / 100; + let t2; + let t3; + let val; + + if (s === 0) { + val = l * 255; + return [val, val, val]; + } + + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } + + const t1 = 2 * l - t2; + const rgb = [0, 0, 0]; + + for (let i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + + if (t3 < 0) { + t3++; + } + + if (t3 > 1) { + t3--; + } + + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } + + rgb[i] = val * 255; + } + + return rgb; +}; + +convert$1.hsl.hsv = function (hsl) { + const h = hsl[0]; + let s = hsl[1] / 100; + let l = hsl[2] / 100; + let smin = s; + const lmin = Math.max(l, 0.01); + l *= 2; + s *= l <= 1 ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + const v = (l + s) / 2; + const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s); + return [h, sv * 100, v * 100]; +}; + +convert$1.hsv.rgb = function (hsv) { + const h = hsv[0] / 60; + const s = hsv[1] / 100; + let v = hsv[2] / 100; + const hi = Math.floor(h) % 6; + const f = h - Math.floor(h); + const p = 255 * v * (1 - s); + const q = 255 * v * (1 - s * f); + const t = 255 * v * (1 - s * (1 - f)); + v *= 255; + + switch (hi) { + case 0: + return [v, t, p]; + + case 1: + return [q, v, p]; + + case 2: + return [p, v, t]; + + case 3: + return [p, q, v]; + + case 4: + return [t, p, v]; + + case 5: + return [v, p, q]; + } +}; + +convert$1.hsv.hsl = function (hsv) { + const h = hsv[0]; + const s = hsv[1] / 100; + const v = hsv[2] / 100; + const vmin = Math.max(v, 0.01); + let sl; + let l; + l = (2 - s) * v; + const lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= lmin <= 1 ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; + return [h, sl * 100, l * 100]; +}; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb + + +convert$1.hwb.rgb = function (hwb) { + const h = hwb[0] / 360; + let wh = hwb[1] / 100; + let bl = hwb[2] / 100; + const ratio = wh + bl; + let f; // Wh + bl cant be > 1 + + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } + + const i = Math.floor(6 * h); + const v = 1 - bl; + f = 6 * h - i; + + if ((i & 0x01) !== 0) { + f = 1 - f; + } + + const n = wh + f * (v - wh); // Linear interpolation + + let r; + let g; + let b; + /* eslint-disable max-statements-per-line,no-multi-spaces */ + + switch (i) { + default: + case 6: + case 0: + r = v; + g = n; + b = wh; + break; + + case 1: + r = n; + g = v; + b = wh; + break; + + case 2: + r = wh; + g = v; + b = n; + break; + + case 3: + r = wh; + g = n; + b = v; + break; + + case 4: + r = n; + g = wh; + b = v; + break; + + case 5: + r = v; + g = wh; + b = n; + break; + } + /* eslint-enable max-statements-per-line,no-multi-spaces */ + + + return [r * 255, g * 255, b * 255]; +}; + +convert$1.cmyk.rgb = function (cmyk) { + const c = cmyk[0] / 100; + const m = cmyk[1] / 100; + const y = cmyk[2] / 100; + const k = cmyk[3] / 100; + const r = 1 - Math.min(1, c * (1 - k) + k); + const g = 1 - Math.min(1, m * (1 - k) + k); + const b = 1 - Math.min(1, y * (1 - k) + k); + return [r * 255, g * 255, b * 255]; +}; + +convert$1.xyz.rgb = function (xyz) { + const x = xyz[0] / 100; + const y = xyz[1] / 100; + const z = xyz[2] / 100; + let r; + let g; + let b; + r = x * 3.2406 + y * -1.5372 + z * -0.4986; + g = x * -0.9689 + y * 1.8758 + z * 0.0415; + b = x * 0.0557 + y * -0.2040 + z * 1.0570; // Assume sRGB + + r = r > 0.0031308 ? 1.055 * r ** (1.0 / 2.4) - 0.055 : r * 12.92; + g = g > 0.0031308 ? 1.055 * g ** (1.0 / 2.4) - 0.055 : g * 12.92; + b = b > 0.0031308 ? 1.055 * b ** (1.0 / 2.4) - 0.055 : b * 12.92; + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); + return [r * 255, g * 255, b * 255]; +}; + +convert$1.xyz.lab = function (xyz) { + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; + x /= 95.047; + y /= 100; + z /= 108.883; + x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116; + y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116; + z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116; + const l = 116 * y - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + return [l, a, b]; +}; + +convert$1.lab.xyz = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let x; + let y; + let z; + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; + const y2 = y ** 3; + const x2 = x ** 3; + const z2 = z ** 3; + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; + x *= 95.047; + y *= 100; + z *= 108.883; + return [x, y, z]; +}; + +convert$1.lab.lch = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let h; + const hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; + + if (h < 0) { + h += 360; + } + + const c = Math.sqrt(a * a + b * b); + return [l, c, h]; +}; + +convert$1.lch.lab = function (lch) { + const l = lch[0]; + const c = lch[1]; + const h = lch[2]; + const hr = h / 360 * 2 * Math.PI; + const a = c * Math.cos(hr); + const b = c * Math.sin(hr); + return [l, a, b]; +}; + +convert$1.rgb.ansi16 = function (args, saturation = null) { + const [r, g, b] = args; + let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization + + value = Math.round(value / 50); + + if (value === 0) { + return 30; + } + + let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255)); + + if (value === 2) { + ansi += 60; + } + + return ansi; +}; + +convert$1.hsv.ansi16 = function (args) { + // Optimization here; we already know the value and don't need to get + // it converted for us. + return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]); +}; + +convert$1.rgb.ansi256 = function (args) { + const r = args[0]; + const g = args[1]; + const b = args[2]; // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + + if (r === g && g === b) { + if (r < 8) { + return 16; + } + + if (r > 248) { + return 231; + } + + return Math.round((r - 8) / 247 * 24) + 232; + } + + const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5); + return ansi; +}; + +convert$1.ansi16.rgb = function (args) { + let color = args % 10; // Handle greyscale + + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } + + color = color / 10.5 * 255; + return [color, color, color]; + } + + const mult = (~~(args > 50) + 1) * 0.5; + const r = (color & 1) * mult * 255; + const g = (color >> 1 & 1) * mult * 255; + const b = (color >> 2 & 1) * mult * 255; + return [r, g, b]; +}; + +convert$1.ansi256.rgb = function (args) { + // Handle greyscale + if (args >= 232) { + const c = (args - 232) * 10 + 8; + return [c, c, c]; + } + + args -= 16; + let rem; + const r = Math.floor(args / 36) / 5 * 255; + const g = Math.floor((rem = args % 36) / 6) / 5 * 255; + const b = rem % 6 / 5 * 255; + return [r, g, b]; +}; + +convert$1.rgb.hex = function (args) { + const integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF); + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; + +convert$1.hex.rgb = function (args) { + const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + + if (!match) { + return [0, 0, 0]; + } + + let colorString = match[0]; + + if (match[0].length === 3) { + colorString = colorString.split('').map(char => { + return char + char; + }).join(''); + } + + const integer = parseInt(colorString, 16); + const r = integer >> 16 & 0xFF; + const g = integer >> 8 & 0xFF; + const b = integer & 0xFF; + return [r, g, b]; +}; + +convert$1.rgb.hcg = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const max = Math.max(Math.max(r, g), b); + const min = Math.min(Math.min(r, g), b); + const chroma = max - min; + let grayscale; + let hue; + + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } + + if (chroma <= 0) { + hue = 0; + } else if (max === r) { + hue = (g - b) / chroma % 6; + } else if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma; + } + + hue /= 6; + hue %= 1; + return [hue * 360, chroma * 100, grayscale * 100]; +}; + +convert$1.hsl.hcg = function (hsl) { + const s = hsl[1] / 100; + const l = hsl[2] / 100; + const c = l < 0.5 ? 2.0 * s * l : 2.0 * s * (1.0 - l); + let f = 0; + + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } + + return [hsl[0], c * 100, f * 100]; +}; + +convert$1.hsv.hcg = function (hsv) { + const s = hsv[1] / 100; + const v = hsv[2] / 100; + const c = s * v; + let f = 0; + + if (c < 1.0) { + f = (v - c) / (1 - c); + } + + return [hsv[0], c * 100, f * 100]; +}; + +convert$1.hcg.rgb = function (hcg) { + const h = hcg[0] / 360; + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } + + const pure = [0, 0, 0]; + const hi = h % 1 * 6; + const v = hi % 1; + const w = 1 - v; + let mg = 0; + /* eslint-disable max-statements-per-line */ + + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; + pure[1] = v; + pure[2] = 0; + break; + + case 1: + pure[0] = w; + pure[1] = 1; + pure[2] = 0; + break; + + case 2: + pure[0] = 0; + pure[1] = 1; + pure[2] = v; + break; + + case 3: + pure[0] = 0; + pure[1] = w; + pure[2] = 1; + break; + + case 4: + pure[0] = v; + pure[1] = 0; + pure[2] = 1; + break; + + default: + pure[0] = 1; + pure[1] = 0; + pure[2] = w; + } + /* eslint-enable max-statements-per-line */ + + + mg = (1.0 - c) * g; + return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255]; +}; + +convert$1.hcg.hsv = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + const v = c + g * (1.0 - c); + let f = 0; + + if (v > 0.0) { + f = c / v; + } + + return [hcg[0], f * 100, v * 100]; +}; + +convert$1.hcg.hsl = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + const l = g * (1.0 - c) + 0.5 * c; + let s = 0; + + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } + + return [hcg[0], s * 100, l * 100]; +}; + +convert$1.hcg.hwb = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + const v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; +}; + +convert$1.hwb.hcg = function (hwb) { + const w = hwb[1] / 100; + const b = hwb[2] / 100; + const v = 1 - b; + const c = v - w; + let g = 0; + + if (c < 1) { + g = (v - c) / (1 - c); + } + + return [hwb[0], c * 100, g * 100]; +}; + +convert$1.apple.rgb = function (apple) { + return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255]; +}; + +convert$1.rgb.apple = function (rgb) { + return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535]; +}; + +convert$1.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +}; + +convert$1.gray.hsl = function (args) { + return [0, 0, args[0]]; +}; + +convert$1.gray.hsv = convert$1.gray.hsl; + +convert$1.gray.hwb = function (gray) { + return [0, 100, gray[0]]; +}; + +convert$1.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; +}; + +convert$1.gray.lab = function (gray) { + return [gray[0], 0, 0]; +}; + +convert$1.gray.hex = function (gray) { + const val = Math.round(gray[0] / 100 * 255) & 0xFF; + const integer = (val << 16) + (val << 8) + val; + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; + +convert$1.rgb.gray = function (rgb) { + const val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; +}; + +/* + This function routes a model to all other models. + + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). + + conversions that are not possible simply are not included. +*/ + +function buildGraph$1() { + const graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + + const models = Object.keys(conversions$1); + + for (let len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } + + return graph; +} // https://en.wikipedia.org/wiki/Breadth-first_search + + +function deriveBFS$1(fromModel) { + const graph = buildGraph$1(); + const queue = [fromModel]; // Unshift -> queue -> pop + + graph[fromModel].distance = 0; + + while (queue.length) { + const current = queue.pop(); + const adjacents = Object.keys(conversions$1[current]); + + for (let len = adjacents.length, i = 0; i < len; i++) { + const adjacent = adjacents[i]; + const node = graph[adjacent]; + + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } + } + + return graph; +} + +function link$1(from, to) { + return function (args) { + return to(from(args)); + }; +} + +function wrapConversion$1(toModel, graph) { + const path = [graph[toModel].parent, toModel]; + let fn = conversions$1[graph[toModel].parent][toModel]; + let cur = graph[toModel].parent; + + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link$1(conversions$1[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } + + fn.conversion = path; + return fn; +} + +var route$1 = function (fromModel) { + const graph = deriveBFS$1(fromModel); + const conversion = {}; + const models = Object.keys(graph); + + for (let len = models.length, i = 0; i < len; i++) { + const toModel = models[i]; + const node = graph[toModel]; + + if (node.parent === null) { + // No possible conversion, or this node is the source model. + continue; + } + + conversion[toModel] = wrapConversion$1(toModel, graph); + } + + return conversion; +}; + +const convert$2 = {}; +const models$1 = Object.keys(conversions$1); + +function wrapRaw$1(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + + if (arg0 === undefined || arg0 === null) { + return arg0; + } + + if (arg0.length > 1) { + args = arg0; + } + + return fn(args); + }; // Preserve .conversion property if there is one + + + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +function wrapRounded$1(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + + if (arg0 === undefined || arg0 === null) { + return arg0; + } + + if (arg0.length > 1) { + args = arg0; + } + + const result = fn(args); // We're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + + if (typeof result === 'object') { + for (let len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } + } + + return result; + }; // Preserve .conversion property if there is one + + + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +models$1.forEach(fromModel => { + convert$2[fromModel] = {}; + Object.defineProperty(convert$2[fromModel], 'channels', { + value: conversions$1[fromModel].channels + }); + Object.defineProperty(convert$2[fromModel], 'labels', { + value: conversions$1[fromModel].labels + }); + const routes = route$1(fromModel); + const routeModels = Object.keys(routes); + routeModels.forEach(toModel => { + const fn = routes[toModel]; + convert$2[fromModel][toModel] = wrapRounded$1(fn); + convert$2[fromModel][toModel].raw = wrapRaw$1(fn); + }); +}); +var colorConvert$1 = convert$2; + +var ansiStyles$1 = createCommonjsModule(function (module) { + + const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; + }; + + const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; + }; + + const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; + }; + + const ansi2ansi = n => n; + + const rgb2rgb = (r, g, b) => [r, g, b]; + + const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); + return value; + }, + enumerable: true, + configurable: true + }); + }; + /** @type {typeof import('color-convert')} */ + + + let colorConvert; + + const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = colorConvert$1; + } + + const offset = isBackground ? 10 : 0; + const styles = {}; + + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } + + return styles; + }; + + function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; // Alias bright black as gray (and grey) + + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + group[styleName] = styles[styleName]; + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); + return styles; + } // Make the export immutable + + + Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles + }); +}); + +var hasFlag$1 = (flag, argv = process.argv) => { + const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--'; + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); +}; + +const { + env: env$1 +} = process; +let forceColor$1; + +if (hasFlag$1('no-color') || hasFlag$1('no-colors') || hasFlag$1('color=false') || hasFlag$1('color=never')) { + forceColor$1 = 0; +} else if (hasFlag$1('color') || hasFlag$1('colors') || hasFlag$1('color=true') || hasFlag$1('color=always')) { + forceColor$1 = 1; +} + +if ('FORCE_COLOR' in env$1) { + if (env$1.FORCE_COLOR === 'true') { + forceColor$1 = 1; + } else if (env$1.FORCE_COLOR === 'false') { + forceColor$1 = 0; + } else { + forceColor$1 = env$1.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env$1.FORCE_COLOR, 10), 3); + } +} + +function translateLevel$1(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} + +function supportsColor$1(haveStream, streamIsTTY) { + if (forceColor$1 === 0) { + return 0; + } + + if (hasFlag$1('color=16m') || hasFlag$1('color=full') || hasFlag$1('color=truecolor')) { + return 3; + } + + if (hasFlag$1('color=256')) { + return 2; + } + + if (haveStream && !streamIsTTY && forceColor$1 === undefined) { + return 0; + } + + const min = forceColor$1 || 0; + + if (env$1.TERM === 'dumb') { + return min; + } + + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os$1.release().split('.'); + + if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env$1) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$1) || env$1.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env$1) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0; + } + + if ('GITHUB_ACTIONS' in env$1) { + return 1; + } + + if (env$1.COLORTERM === 'truecolor') { + return 3; + } + + if ('TERM_PROGRAM' in env$1) { + const version = parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env$1.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env$1.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) { + return 1; + } + + if ('COLORTERM' in env$1) { + return 1; + } + + return min; +} + +function getSupportLevel$1(stream) { + const level = supportsColor$1(stream, stream && stream.isTTY); + return translateLevel$1(level); +} + +var supportsColor_1$1 = { + supportsColor: getSupportLevel$1, + stdout: translateLevel$1(supportsColor$1(true, tty$1.isatty(1))), + stderr: translateLevel$1(supportsColor$1(true, tty$1.isatty(2))) +}; + +const stringReplaceAll = (string, substring, replacer) => { + let index = string.indexOf(substring); + + if (index === -1) { + return string; + } + + const substringLength = substring.length; + let endIndex = 0; + let returnValue = ''; + + do { + returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; + endIndex = index + substringLength; + index = string.indexOf(substring, endIndex); + } while (index !== -1); + + returnValue += string.substr(endIndex); + return returnValue; +}; + +const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => { + let endIndex = 0; + let returnValue = ''; + + do { + const gotCR = string[index - 1] === '\r'; + returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; + endIndex = index + 1; + index = string.indexOf('\n', endIndex); + } while (index !== -1); + + returnValue += string.substr(endIndex); + return returnValue; +}; + +var util = { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +}; + +const TEMPLATE_REGEX$1 = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX$1 = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX$1 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX$1 = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi; +const ESCAPES$1 = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]); + +function unescape$1(c) { + const u = c[0] === 'u'; + const bracket = c[1] === '{'; + + if (u && !bracket && c.length === 5 || c[0] === 'x' && c.length === 3) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } + + if (u && bracket) { + return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); + } + + return ESCAPES$1.get(c) || c; +} + +function parseArguments$1(name, arguments_) { + const results = []; + const chunks = arguments_.trim().split(/\s*,\s*/g); + let matches; + + for (const chunk of chunks) { + const number = Number(chunk); + + if (!Number.isNaN(number)) { + results.push(number); + } else if (matches = chunk.match(STRING_REGEX$1)) { + results.push(matches[2].replace(ESCAPE_REGEX$1, (m, escape, character) => escape ? unescape$1(escape) : character)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } + + return results; +} + +function parseStyle$1(style) { + STYLE_REGEX$1.lastIndex = 0; + const results = []; + let matches; + + while ((matches = STYLE_REGEX$1.exec(style)) !== null) { + const name = matches[1]; + + if (matches[2]) { + const args = parseArguments$1(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } + } + + return results; +} + +function buildStyle$1(chalk, styles) { + const enabled = {}; + + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } + + let current = chalk; + + for (const [styleName, styles] of Object.entries(enabled)) { + if (!Array.isArray(styles)) { + continue; + } + + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } + + current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; + } + + return current; +} + +var templates$1 = (chalk, temporary) => { + const styles = []; + const chunks = []; + let chunk = []; // eslint-disable-next-line max-params + + temporary.replace(TEMPLATE_REGEX$1, (m, escapeCharacter, inverse, style, close, character) => { + if (escapeCharacter) { + chunk.push(unescape$1(escapeCharacter)); + } else if (style) { + const string = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? string : buildStyle$1(chalk, styles)(string)); + styles.push({ + inverse, + styles: parseStyle$1(style) + }); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } + + chunks.push(buildStyle$1(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); + } else { + chunk.push(character); + } + }); + chunks.push(chunk.join('')); + + if (styles.length > 0) { + const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMessage); + } + + return chunks.join(''); +}; + +const { + stdout: stdoutColor, + stderr: stderrColor +} = supportsColor_1$1; +const { + stringReplaceAll: stringReplaceAll$1, + stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1 +} = util; // `supportsColor.level` → `ansiStyles.color[name]` mapping + +const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; +const styles = Object.create(null); + +const applyOptions = (object, options = {}) => { + if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { + throw new Error('The `level` option should be an integer from 0 to 3'); + } // Detect level if not set manually + + + const colorLevel = stdoutColor ? stdoutColor.level : 0; + object.level = options.level === undefined ? colorLevel : options.level; +}; + +class ChalkClass { + constructor(options) { + // eslint-disable-next-line no-constructor-return + return chalkFactory(options); + } + +} + +const chalkFactory = options => { + const chalk = {}; + applyOptions(chalk, options); + + chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); + + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); + + chalk.template.constructor = () => { + throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); + }; + + chalk.template.Instance = ChalkClass; + return chalk.template; +}; + +function Chalk(options) { + return chalkFactory(options); +} + +for (const [styleName, style] of Object.entries(ansiStyles$1)) { + styles[styleName] = { + get() { + const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); + Object.defineProperty(this, styleName, { + value: builder + }); + return builder; + } + + }; +} + +styles.visible = { + get() { + const builder = createBuilder(this, this._styler, true); + Object.defineProperty(this, 'visible', { + value: builder + }); + return builder; + } + +}; +const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; + +for (const model of usedModels) { + styles[model] = { + get() { + const { + level + } = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles$1.color[levelMapping[level]][model](...arguments_), ansiStyles$1.color.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + + }; +} + +for (const model of usedModels) { + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const { + level + } = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles$1.bgColor[levelMapping[level]][model](...arguments_), ansiStyles$1.bgColor.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + + }; +} + +const proto = Object.defineProperties(() => {}, Object.assign({}, styles, { + level: { + enumerable: true, + + get() { + return this._generator.level; + }, + + set(level) { + this._generator.level = level; + } + + } +})); + +const createStyler = (open, close, parent) => { + let openAll; + let closeAll; + + if (parent === undefined) { + openAll = open; + closeAll = close; + } else { + openAll = parent.openAll + open; + closeAll = close + parent.closeAll; + } + + return { + open, + close, + openAll, + closeAll, + parent + }; +}; + +const createBuilder = (self, _styler, _isEmpty) => { + const builder = (...arguments_) => { + // Single argument is hot path, implicit coercion is faster than anything + // eslint-disable-next-line no-implicit-coercion + return applyStyle(builder, arguments_.length === 1 ? '' + arguments_[0] : arguments_.join(' ')); + }; // We alter the prototype because we must return a function, but there is + // no way to create a function with a different prototype + + + Object.setPrototypeOf(builder, proto); + builder._generator = self; + builder._styler = _styler; + builder._isEmpty = _isEmpty; + return builder; +}; + +const applyStyle = (self, string) => { + if (self.level <= 0 || !string) { + return self._isEmpty ? '' : string; + } + + let styler = self._styler; + + if (styler === undefined) { + return string; + } + + const { + openAll, + closeAll + } = styler; + + if (string.indexOf('\u001B') !== -1) { + while (styler !== undefined) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + string = stringReplaceAll$1(string, styler.close, styler.open); + styler = styler.parent; + } + } // We can move both next actions out of loop, because remaining actions in loop won't have + // any/visible effect on parts we add here. Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 + + + const lfIndex = string.indexOf('\n'); + + if (lfIndex !== -1) { + string = stringEncaseCRLFWithFirstIndex$1(string, closeAll, openAll, lfIndex); + } + + return openAll + string + closeAll; +}; + +let template; + +const chalkTag = (chalk, ...strings) => { + const [firstString] = strings; + + if (!Array.isArray(firstString)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return strings.join(' '); + } + + const arguments_ = strings.slice(1); + const parts = [firstString.raw[0]]; + + for (let i = 1; i < firstString.length; i++) { + parts.push(String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), String(firstString.raw[i])); + } + + if (template === undefined) { + template = templates$1; + } + + return template(chalk, parts.join('')); +}; + +Object.defineProperties(Chalk.prototype, styles); +const chalk$1 = Chalk(); // eslint-disable-line new-cap + +chalk$1.supportsColor = stdoutColor; +chalk$1.stderr = Chalk({ + level: stderrColor ? stderrColor.level : 0 +}); // eslint-disable-line new-cap + +chalk$1.stderr.supportsColor = stderrColor; +var source = chalk$1; + +const cliDescriptor = { + key: key => key.length === 1 ? `-${key}` : `--${key}`, + value: value => lib.apiDescriptor.value(value), + pair: ({ + key, + value + }) => value === false ? `--no-${key}` : value === true ? cliDescriptor.key(key) : value === "" ? `${cliDescriptor.key(key)} without an argument` : `${cliDescriptor.key(key)}=${value}` +}; + +class FlagSchema extends lib.ChoiceSchema { + constructor({ + name, + flags + }) { + super({ + name, + choices: flags + }); + this._flags = flags.slice().sort(); + } + + preprocess(value, utils) { + if (typeof value === "string" && value.length !== 0 && !this._flags.includes(value)) { + const suggestion = this._flags.find(flag => leven_1$1(flag, value) < 3); + + if (suggestion) { + utils.logger.warn([`Unknown flag ${source.yellow(utils.descriptor.value(value))},`, `did you mean ${source.blue(utils.descriptor.value(suggestion))}?`].join(" ")); + return suggestion; + } + } + + return value; + } + + expected() { + return "a flag"; + } + +} + +let hasDeprecationWarned; + +function normalizeOptions(options, optionInfos, { + logger, + isCLI = false, + passThrough = false +} = {}) { + const unknown = !passThrough ? lib.levenUnknownHandler : Array.isArray(passThrough) ? (key, value) => !passThrough.includes(key) ? undefined : { + [key]: value + } : (key, value) => ({ + [key]: value + }); + const descriptor = isCLI ? cliDescriptor : lib.apiDescriptor; + const schemas = optionInfosToSchemas(optionInfos, { + isCLI + }); + const normalizer = new lib.Normalizer(schemas, { + logger, + unknown, + descriptor + }); + const shouldSuppressDuplicateDeprecationWarnings = logger !== false; + + if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) { + normalizer._hasDeprecationWarned = hasDeprecationWarned; + } + + const normalized = normalizer.normalize(options); + + if (shouldSuppressDuplicateDeprecationWarnings) { + hasDeprecationWarned = normalizer._hasDeprecationWarned; + } + + return normalized; +} + +function optionInfosToSchemas(optionInfos, { + isCLI +}) { + const schemas = []; + + if (isCLI) { + schemas.push(lib.AnySchema.create({ + name: "_" + })); + } + + for (const optionInfo of optionInfos) { + schemas.push(optionInfoToSchema(optionInfo, { + isCLI, + optionInfos + })); + + if (optionInfo.alias && isCLI) { + schemas.push(lib.AliasSchema.create({ + name: optionInfo.alias, + sourceName: optionInfo.name + })); + } + } + + return schemas; +} + +function optionInfoToSchema(optionInfo, { + isCLI, + optionInfos +}) { + let SchemaConstructor; + const parameters = { + name: optionInfo.name + }; + const handlers = {}; + + switch (optionInfo.type) { + case "int": + SchemaConstructor = lib.IntegerSchema; + + if (isCLI) { + parameters.preprocess = value => Number(value); + } + + break; + + case "string": + SchemaConstructor = lib.StringSchema; + break; + + case "choice": + SchemaConstructor = lib.ChoiceSchema; + parameters.choices = optionInfo.choices.map(choiceInfo => typeof choiceInfo === "object" && choiceInfo.redirect ? Object.assign({}, choiceInfo, { + redirect: { + to: { + key: optionInfo.name, + value: choiceInfo.redirect + } + } + }) : choiceInfo); + break; + + case "boolean": + SchemaConstructor = lib.BooleanSchema; + break; + + case "flag": + SchemaConstructor = FlagSchema; + parameters.flags = optionInfos.map(optionInfo => [].concat(optionInfo.alias || [], optionInfo.description ? optionInfo.name : [], optionInfo.oppositeDescription ? `no-${optionInfo.name}` : [])).reduce((a, b) => a.concat(b), []); + break; + + case "path": + SchemaConstructor = lib.StringSchema; + break; + + default: + throw new Error(`Unexpected type ${optionInfo.type}`); + } + + if (optionInfo.exception) { + parameters.validate = (value, schema, utils) => { + return optionInfo.exception(value) || schema.validate(value, utils); + }; + } else { + parameters.validate = (value, schema, utils) => { + return value === undefined || schema.validate(value, utils); + }; + } + + if (optionInfo.redirect) { + handlers.redirect = value => !value ? undefined : { + to: { + key: optionInfo.redirect.option, + value: optionInfo.redirect.value + } + }; + } + + if (optionInfo.deprecated) { + handlers.deprecated = true; + } // allow CLI overriding, e.g., prettier package.json --tab-width 1 --tab-width 2 + + + if (isCLI && !optionInfo.array) { + const originalPreprocess = parameters.preprocess || (x => x); + + parameters.preprocess = (value, schema, utils) => schema.preprocess(originalPreprocess(Array.isArray(value) ? value[value.length - 1] : value), utils); + } + + return optionInfo.array ? lib.ArraySchema.create(Object.assign({}, isCLI ? { + preprocess: v => [].concat(v) + } : {}, {}, handlers, { + valueSchema: SchemaConstructor.create(parameters) + })) : SchemaConstructor.create(Object.assign({}, parameters, {}, handlers)); +} + +function normalizeApiOptions(options, optionInfos, opts) { + return normalizeOptions(options, optionInfos, opts); +} + +function normalizeCliOptions(options, optionInfos, opts) { + return normalizeOptions(options, optionInfos, Object.assign({ + isCLI: true + }, opts)); +} + +var optionsNormalizer = { + normalizeApiOptions, + normalizeCliOptions +}; + +var getLast = arr => arr[arr.length - 1]; + +function locStart(node, opts) { + opts = opts || {}; // Handle nodes with decorators. They should start at the first decorator + + if (!opts.ignoreDecorators && node.declaration && node.declaration.decorators && node.declaration.decorators.length > 0) { + return locStart(node.declaration.decorators[0]); + } + + if (!opts.ignoreDecorators && node.decorators && node.decorators.length > 0) { + return locStart(node.decorators[0]); + } + + if (node.__location) { + return node.__location.startOffset; + } + + if (node.range) { + return node.range[0]; + } + + if (typeof node.start === "number") { + return node.start; + } + + if (node.loc) { + return node.loc.start; + } + + return null; +} + +function locEnd(node) { + const endNode = node.nodes && getLast(node.nodes); + + if (endNode && node.source && !node.source.end) { + node = endNode; + } + + if (node.__location) { + return node.__location.endOffset; + } + + const loc = node.range ? node.range[1] : typeof node.end === "number" ? node.end : null; + + if (node.typeAnnotation) { + return Math.max(loc, locEnd(node.typeAnnotation)); + } + + if (node.loc && !loc) { + return node.loc.end; + } + + return loc; +} + +function composeLoc(startNode, endNodeOrLength = startNode) { + const length = typeof endNodeOrLength === "number" ? endNodeOrLength : -1; + const start = locStart(startNode); + const end = length !== -1 ? start + length : locEnd(endNodeOrLength); + const startLoc = startNode.loc.start; + return { + start, + end, + range: [start, end], + loc: { + start: startLoc, + end: length !== -1 ? { + line: startLoc.line, + column: startLoc.column + length + } : endNodeOrLength.loc.end + } + }; +} + +var loc = { + locStart, + locEnd, + composeLoc +}; + +var jsTokens = createCommonjsModule(function (module, exports) { + // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell + // License: MIT. (See LICENSE.) + Object.defineProperty(exports, "__esModule", { + value: true + }); // This regex comes from regex.coffee, and is inserted here by generate-index.js + // (run `npm run build`). + + exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g; + + exports.matchToToken = function (match) { + var token = { + type: "invalid", + value: match[0], + closed: undefined + }; + if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace"; + return token; + }; +}); +unwrapExports(jsTokens); +var jsTokens_1 = jsTokens.matchToToken; + +var ast = createCommonjsModule(function (module) { + /* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 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. + */ + (function () { + + function isExpression(node) { + if (node == null) { + return false; + } + + switch (node.type) { + case 'ArrayExpression': + case 'AssignmentExpression': + case 'BinaryExpression': + case 'CallExpression': + case 'ConditionalExpression': + case 'FunctionExpression': + case 'Identifier': + case 'Literal': + case 'LogicalExpression': + case 'MemberExpression': + case 'NewExpression': + case 'ObjectExpression': + case 'SequenceExpression': + case 'ThisExpression': + case 'UnaryExpression': + case 'UpdateExpression': + return true; + } + + return false; + } + + function isIterationStatement(node) { + if (node == null) { + return false; + } + + switch (node.type) { + case 'DoWhileStatement': + case 'ForInStatement': + case 'ForStatement': + case 'WhileStatement': + return true; + } + + return false; + } + + function isStatement(node) { + if (node == null) { + return false; + } + + switch (node.type) { + case 'BlockStatement': + case 'BreakStatement': + case 'ContinueStatement': + case 'DebuggerStatement': + case 'DoWhileStatement': + case 'EmptyStatement': + case 'ExpressionStatement': + case 'ForInStatement': + case 'ForStatement': + case 'IfStatement': + case 'LabeledStatement': + case 'ReturnStatement': + case 'SwitchStatement': + case 'ThrowStatement': + case 'TryStatement': + case 'VariableDeclaration': + case 'WhileStatement': + case 'WithStatement': + return true; + } + + return false; + } + + function isSourceElement(node) { + return isStatement(node) || node != null && node.type === 'FunctionDeclaration'; + } + + function trailingStatement(node) { + switch (node.type) { + case 'IfStatement': + if (node.alternate != null) { + return node.alternate; + } + + return node.consequent; + + case 'LabeledStatement': + case 'ForStatement': + case 'ForInStatement': + case 'WhileStatement': + case 'WithStatement': + return node.body; + } + + return null; + } + + function isProblematicIfStatement(node) { + var current; + + if (node.type !== 'IfStatement') { + return false; + } + + if (node.alternate == null) { + return false; + } + + current = node.consequent; + + do { + if (current.type === 'IfStatement') { + if (current.alternate == null) { + return true; + } + } + + current = trailingStatement(current); + } while (current); + + return false; + } + + module.exports = { + isExpression: isExpression, + isStatement: isStatement, + isIterationStatement: isIterationStatement, + isSourceElement: isSourceElement, + isProblematicIfStatement: isProblematicIfStatement, + trailingStatement: trailingStatement + }; + })(); + /* vim: set sw=4 ts=4 et tw=80 : */ + +}); +var ast_1 = ast.isExpression; +var ast_2 = ast.isStatement; +var ast_3 = ast.isIterationStatement; +var ast_4 = ast.isSourceElement; +var ast_5 = ast.isProblematicIfStatement; +var ast_6 = ast.trailingStatement; + +var code = createCommonjsModule(function (module) { + /* + Copyright (C) 2013-2014 Yusuke Suzuki + Copyright (C) 2014 Ivan Nikulin + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 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. + */ + (function () { + + var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; // See `tools/generate-identifier-regex.js`. + + ES5Regex = { + // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierStart: + NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/, + // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierPart: + NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/ + }; + ES6Regex = { + // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierStart: + NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/, + // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierPart: + NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ + }; + + function isDecimalDigit(ch) { + return 0x30 <= ch && ch <= 0x39; // 0..9 + } + + function isHexDigit(ch) { + return 0x30 <= ch && ch <= 0x39 || // 0..9 + 0x61 <= ch && ch <= 0x66 || // a..f + 0x41 <= ch && ch <= 0x46; // A..F + } + + function isOctalDigit(ch) { + return ch >= 0x30 && ch <= 0x37; // 0..7 + } // 7.2 White Space + + + NON_ASCII_WHITESPACES = [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF]; + + function isWhiteSpace(ch) { + return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0; + } // 7.3 Line Terminators + + + function isLineTerminator(ch) { + return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; + } // 7.6 Identifier Names and Identifiers + + + function fromCodePoint(cp) { + if (cp <= 0xFFFF) { + return String.fromCharCode(cp); + } + + var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800); + var cu2 = String.fromCharCode((cp - 0x10000) % 0x400 + 0xDC00); + return cu1 + cu2; + } + + IDENTIFIER_START = new Array(0x80); + + for (ch = 0; ch < 0x80; ++ch) { + IDENTIFIER_START[ch] = ch >= 0x61 && ch <= 0x7A || // a..z + ch >= 0x41 && ch <= 0x5A || // A..Z + ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) + } + + IDENTIFIER_PART = new Array(0x80); + + for (ch = 0; ch < 0x80; ++ch) { + IDENTIFIER_PART[ch] = ch >= 0x61 && ch <= 0x7A || // a..z + ch >= 0x41 && ch <= 0x5A || // A..Z + ch >= 0x30 && ch <= 0x39 || // 0..9 + ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) + } + + function isIdentifierStartES5(ch) { + return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); + } + + function isIdentifierPartES5(ch) { + return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); + } + + function isIdentifierStartES6(ch) { + return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); + } + + function isIdentifierPartES6(ch) { + return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); + } + + module.exports = { + isDecimalDigit: isDecimalDigit, + isHexDigit: isHexDigit, + isOctalDigit: isOctalDigit, + isWhiteSpace: isWhiteSpace, + isLineTerminator: isLineTerminator, + isIdentifierStartES5: isIdentifierStartES5, + isIdentifierPartES5: isIdentifierPartES5, + isIdentifierStartES6: isIdentifierStartES6, + isIdentifierPartES6: isIdentifierPartES6 + }; + })(); + /* vim: set sw=4 ts=4 et tw=80 : */ + +}); +var code_1 = code.isDecimalDigit; +var code_2 = code.isHexDigit; +var code_3 = code.isOctalDigit; +var code_4 = code.isWhiteSpace; +var code_5 = code.isLineTerminator; +var code_6 = code.isIdentifierStartES5; +var code_7 = code.isIdentifierPartES5; +var code_8 = code.isIdentifierStartES6; +var code_9 = code.isIdentifierPartES6; + +var keyword = createCommonjsModule(function (module) { + /* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 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. + */ + (function () { + + var code$1 = code; + + function isStrictModeReservedWordES6(id) { + switch (id) { + case 'implements': + case 'interface': + case 'package': + case 'private': + case 'protected': + case 'public': + case 'static': + case 'let': + return true; + + default: + return false; + } + } + + function isKeywordES5(id, strict) { + // yield should not be treated as keyword under non-strict mode. + if (!strict && id === 'yield') { + return false; + } + + return isKeywordES6(id, strict); + } + + function isKeywordES6(id, strict) { + if (strict && isStrictModeReservedWordES6(id)) { + return true; + } + + switch (id.length) { + case 2: + return id === 'if' || id === 'in' || id === 'do'; + + case 3: + return id === 'var' || id === 'for' || id === 'new' || id === 'try'; + + case 4: + return id === 'this' || id === 'else' || id === 'case' || id === 'void' || id === 'with' || id === 'enum'; + + case 5: + return id === 'while' || id === 'break' || id === 'catch' || id === 'throw' || id === 'const' || id === 'yield' || id === 'class' || id === 'super'; + + case 6: + return id === 'return' || id === 'typeof' || id === 'delete' || id === 'switch' || id === 'export' || id === 'import'; + + case 7: + return id === 'default' || id === 'finally' || id === 'extends'; + + case 8: + return id === 'function' || id === 'continue' || id === 'debugger'; + + case 10: + return id === 'instanceof'; + + default: + return false; + } + } + + function isReservedWordES5(id, strict) { + return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict); + } + + function isReservedWordES6(id, strict) { + return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict); + } + + function isRestrictedWord(id) { + return id === 'eval' || id === 'arguments'; + } + + function isIdentifierNameES5(id) { + var i, iz, ch; + + if (id.length === 0) { + return false; + } + + ch = id.charCodeAt(0); + + if (!code$1.isIdentifierStartES5(ch)) { + return false; + } + + for (i = 1, iz = id.length; i < iz; ++i) { + ch = id.charCodeAt(i); + + if (!code$1.isIdentifierPartES5(ch)) { + return false; + } + } + + return true; + } + + function decodeUtf16(lead, trail) { + return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; + } + + function isIdentifierNameES6(id) { + var i, iz, ch, lowCh, check; + + if (id.length === 0) { + return false; + } + + check = code$1.isIdentifierStartES6; + + for (i = 0, iz = id.length; i < iz; ++i) { + ch = id.charCodeAt(i); + + if (0xD800 <= ch && ch <= 0xDBFF) { + ++i; + + if (i >= iz) { + return false; + } + + lowCh = id.charCodeAt(i); + + if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) { + return false; + } + + ch = decodeUtf16(ch, lowCh); + } + + if (!check(ch)) { + return false; + } + + check = code$1.isIdentifierPartES6; + } + + return true; + } + + function isIdentifierES5(id, strict) { + return isIdentifierNameES5(id) && !isReservedWordES5(id, strict); + } + + function isIdentifierES6(id, strict) { + return isIdentifierNameES6(id) && !isReservedWordES6(id, strict); + } + + module.exports = { + isKeywordES5: isKeywordES5, + isKeywordES6: isKeywordES6, + isReservedWordES5: isReservedWordES5, + isReservedWordES6: isReservedWordES6, + isRestrictedWord: isRestrictedWord, + isIdentifierNameES5: isIdentifierNameES5, + isIdentifierNameES6: isIdentifierNameES6, + isIdentifierES5: isIdentifierES5, + isIdentifierES6: isIdentifierES6 + }; + })(); + /* vim: set sw=4 ts=4 et tw=80 : */ + +}); +var keyword_1 = keyword.isKeywordES5; +var keyword_2 = keyword.isKeywordES6; +var keyword_3 = keyword.isReservedWordES5; +var keyword_4 = keyword.isReservedWordES6; +var keyword_5 = keyword.isRestrictedWord; +var keyword_6 = keyword.isIdentifierNameES5; +var keyword_7 = keyword.isIdentifierNameES6; +var keyword_8 = keyword.isIdentifierES5; +var keyword_9 = keyword.isIdentifierES6; + +var utils$1 = createCommonjsModule(function (module, exports) { + /* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 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. + */ + (function () { + + exports.ast = ast; + exports.code = code; + exports.keyword = keyword; + })(); + /* vim: set sw=4 ts=4 et tw=80 : */ + +}); +var utils_1$1 = utils$1.ast; +var utils_2$1 = utils$1.code; +var utils_3$1 = utils$1.keyword; + +var matchOperatorsRe$1 = /[|\\{}()[\]^$+*?.]/g; + +var escapeStringRegexp$1 = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + + return str.replace(matchOperatorsRe$1, '\\$&'); +}; + +var colorName$2 = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; + +var conversions$2 = createCommonjsModule(function (module) { + /* MIT license */ + // NOTE: conversions should only return primitive values (i.e. arrays, or + // values that give correct `typeof` results). + // do not use box values types (i.e. Number(), String(), etc.) + var reverseKeywords = {}; + + for (var key in colorName$2) { + if (colorName$2.hasOwnProperty(key)) { + reverseKeywords[colorName$2[key]] = key; + } + } + + var convert = module.exports = { + rgb: { + channels: 3, + labels: 'rgb' + }, + hsl: { + channels: 3, + labels: 'hsl' + }, + hsv: { + channels: 3, + labels: 'hsv' + }, + hwb: { + channels: 3, + labels: 'hwb' + }, + cmyk: { + channels: 4, + labels: 'cmyk' + }, + xyz: { + channels: 3, + labels: 'xyz' + }, + lab: { + channels: 3, + labels: 'lab' + }, + lch: { + channels: 3, + labels: 'lch' + }, + hex: { + channels: 1, + labels: ['hex'] + }, + keyword: { + channels: 1, + labels: ['keyword'] + }, + ansi16: { + channels: 1, + labels: ['ansi16'] + }, + ansi256: { + channels: 1, + labels: ['ansi256'] + }, + hcg: { + channels: 3, + labels: ['h', 'c', 'g'] + }, + apple: { + channels: 3, + labels: ['r16', 'g16', 'b16'] + }, + gray: { + channels: 1, + labels: ['gray'] + } + }; // hide .channels and .labels properties + + for (var model in convert) { + if (convert.hasOwnProperty(model)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); + } + + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); + } + + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); + } + + var channels = convert[model].channels; + var labels = convert[model].labels; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', { + value: channels + }); + Object.defineProperty(convert[model], 'labels', { + value: labels + }); + } + } + + convert.rgb.hsl = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var delta = max - min; + var h; + var s; + var l; + + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } + + h = Math.min(h * 60, 360); + + if (h < 0) { + h += 360; + } + + l = (min + max) / 2; + + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } + + return [h, s * 100, l * 100]; + }; + + convert.rgb.hsv = function (rgb) { + var rdif; + var gdif; + var bdif; + var h; + var s; + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var v = Math.max(r, g, b); + var diff = v - Math.min(r, g, b); + + var diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; + + if (diff === 0) { + h = s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); + + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = 1 / 3 + rdif - bdif; + } else if (b === v) { + h = 2 / 3 + gdif - rdif; + } + + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + } + + return [h * 360, s * 100, v * 100]; + }; + + convert.rgb.hwb = function (rgb) { + var r = rgb[0]; + var g = rgb[1]; + var b = rgb[2]; + var h = convert.rgb.hsl(rgb)[0]; + var w = 1 / 255 * Math.min(r, Math.min(g, b)); + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); + return [h, w * 100, b * 100]; + }; + + convert.rgb.cmyk = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var c; + var m; + var y; + var k; + k = Math.min(1 - r, 1 - g, 1 - b); + c = (1 - r - k) / (1 - k) || 0; + m = (1 - g - k) / (1 - k) || 0; + y = (1 - b - k) / (1 - k) || 0; + return [c * 100, m * 100, y * 100, k * 100]; + }; + /** + * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + * */ + + + function comparativeDistance(x, y) { + return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2); + } + + convert.rgb.keyword = function (rgb) { + var reversed = reverseKeywords[rgb]; + + if (reversed) { + return reversed; + } + + var currentClosestDistance = Infinity; + var currentClosestKeyword; + + for (var keyword in colorName$2) { + if (colorName$2.hasOwnProperty(keyword)) { + var value = colorName$2[keyword]; // Compute comparative distance + + var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest + + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } + } + + return currentClosestKeyword; + }; + + convert.keyword.rgb = function (keyword) { + return colorName$2[keyword]; + }; + + convert.rgb.xyz = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; // assume sRGB + + r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92; + g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92; + b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92; + var x = r * 0.4124 + g * 0.3576 + b * 0.1805; + var y = r * 0.2126 + g * 0.7152 + b * 0.0722; + var z = r * 0.0193 + g * 0.1192 + b * 0.9505; + return [x * 100, y * 100, z * 100]; + }; + + convert.rgb.lab = function (rgb) { + var xyz = convert.rgb.xyz(rgb); + var x = xyz[0]; + var y = xyz[1]; + var z = xyz[2]; + var l; + var a; + var b; + x /= 95.047; + y /= 100; + z /= 108.883; + x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116; + y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116; + z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116; + l = 116 * y - 16; + a = 500 * (x - y); + b = 200 * (y - z); + return [l, a, b]; + }; + + convert.hsl.rgb = function (hsl) { + var h = hsl[0] / 360; + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var t1; + var t2; + var t3; + var rgb; + var val; + + if (s === 0) { + val = l * 255; + return [val, val, val]; + } + + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } + + t1 = 2 * l - t2; + rgb = [0, 0, 0]; + + for (var i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + + if (t3 < 0) { + t3++; + } + + if (t3 > 1) { + t3--; + } + + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } + + rgb[i] = val * 255; + } + + return rgb; + }; + + convert.hsl.hsv = function (hsl) { + var h = hsl[0]; + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var smin = s; + var lmin = Math.max(l, 0.01); + var sv; + var v; + l *= 2; + s *= l <= 1 ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + v = (l + s) / 2; + sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s); + return [h, sv * 100, v * 100]; + }; + + convert.hsv.rgb = function (hsv) { + var h = hsv[0] / 60; + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var hi = Math.floor(h) % 6; + var f = h - Math.floor(h); + var p = 255 * v * (1 - s); + var q = 255 * v * (1 - s * f); + var t = 255 * v * (1 - s * (1 - f)); + v *= 255; + + switch (hi) { + case 0: + return [v, t, p]; + + case 1: + return [q, v, p]; + + case 2: + return [p, v, t]; + + case 3: + return [p, q, v]; + + case 4: + return [t, p, v]; + + case 5: + return [v, p, q]; + } + }; + + convert.hsv.hsl = function (hsv) { + var h = hsv[0]; + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var vmin = Math.max(v, 0.01); + var lmin; + var sl; + var l; + l = (2 - s) * v; + lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= lmin <= 1 ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; + return [h, sl * 100, l * 100]; + }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb + + + convert.hwb.rgb = function (hwb) { + var h = hwb[0] / 360; + var wh = hwb[1] / 100; + var bl = hwb[2] / 100; + var ratio = wh + bl; + var i; + var v; + var f; + var n; // wh + bl cant be > 1 + + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } + + i = Math.floor(6 * h); + v = 1 - bl; + f = 6 * h - i; + + if ((i & 0x01) !== 0) { + f = 1 - f; + } + + n = wh + f * (v - wh); // linear interpolation + + var r; + var g; + var b; + + switch (i) { + default: + case 6: + case 0: + r = v; + g = n; + b = wh; + break; + + case 1: + r = n; + g = v; + b = wh; + break; + + case 2: + r = wh; + g = v; + b = n; + break; + + case 3: + r = wh; + g = n; + b = v; + break; + + case 4: + r = n; + g = wh; + b = v; + break; + + case 5: + r = v; + g = wh; + b = n; + break; + } + + return [r * 255, g * 255, b * 255]; + }; + + convert.cmyk.rgb = function (cmyk) { + var c = cmyk[0] / 100; + var m = cmyk[1] / 100; + var y = cmyk[2] / 100; + var k = cmyk[3] / 100; + var r; + var g; + var b; + r = 1 - Math.min(1, c * (1 - k) + k); + g = 1 - Math.min(1, m * (1 - k) + k); + b = 1 - Math.min(1, y * (1 - k) + k); + return [r * 255, g * 255, b * 255]; + }; + + convert.xyz.rgb = function (xyz) { + var x = xyz[0] / 100; + var y = xyz[1] / 100; + var z = xyz[2] / 100; + var r; + var g; + var b; + r = x * 3.2406 + y * -1.5372 + z * -0.4986; + g = x * -0.9689 + y * 1.8758 + z * 0.0415; + b = x * 0.0557 + y * -0.2040 + z * 1.0570; // assume sRGB + + r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92; + g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92; + b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92; + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); + return [r * 255, g * 255, b * 255]; + }; + + convert.xyz.lab = function (xyz) { + var x = xyz[0]; + var y = xyz[1]; + var z = xyz[2]; + var l; + var a; + var b; + x /= 95.047; + y /= 100; + z /= 108.883; + x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116; + y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116; + z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116; + l = 116 * y - 16; + a = 500 * (x - y); + b = 200 * (y - z); + return [l, a, b]; + }; + + convert.lab.xyz = function (lab) { + var l = lab[0]; + var a = lab[1]; + var b = lab[2]; + var x; + var y; + var z; + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; + var y2 = Math.pow(y, 3); + var x2 = Math.pow(x, 3); + var z2 = Math.pow(z, 3); + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; + x *= 95.047; + y *= 100; + z *= 108.883; + return [x, y, z]; + }; + + convert.lab.lch = function (lab) { + var l = lab[0]; + var a = lab[1]; + var b = lab[2]; + var hr; + var h; + var c; + hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; + + if (h < 0) { + h += 360; + } + + c = Math.sqrt(a * a + b * b); + return [l, c, h]; + }; + + convert.lch.lab = function (lch) { + var l = lch[0]; + var c = lch[1]; + var h = lch[2]; + var a; + var b; + var hr; + hr = h / 360 * 2 * Math.PI; + a = c * Math.cos(hr); + b = c * Math.sin(hr); + return [l, a, b]; + }; + + convert.rgb.ansi16 = function (args) { + var r = args[0]; + var g = args[1]; + var b = args[2]; + var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization + + value = Math.round(value / 50); + + if (value === 0) { + return 30; + } + + var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255)); + + if (value === 2) { + ansi += 60; + } + + return ansi; + }; + + convert.hsv.ansi16 = function (args) { + // optimization here; we already know the value and don't need to get + // it converted for us. + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); + }; + + convert.rgb.ansi256 = function (args) { + var r = args[0]; + var g = args[1]; + var b = args[2]; // we use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + + if (r === g && g === b) { + if (r < 8) { + return 16; + } + + if (r > 248) { + return 231; + } + + return Math.round((r - 8) / 247 * 24) + 232; + } + + var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5); + return ansi; + }; + + convert.ansi16.rgb = function (args) { + var color = args % 10; // handle greyscale + + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } + + color = color / 10.5 * 255; + return [color, color, color]; + } + + var mult = (~~(args > 50) + 1) * 0.5; + var r = (color & 1) * mult * 255; + var g = (color >> 1 & 1) * mult * 255; + var b = (color >> 2 & 1) * mult * 255; + return [r, g, b]; + }; + + convert.ansi256.rgb = function (args) { + // handle greyscale + if (args >= 232) { + var c = (args - 232) * 10 + 8; + return [c, c, c]; + } + + args -= 16; + var rem; + var r = Math.floor(args / 36) / 5 * 255; + var g = Math.floor((rem = args % 36) / 6) / 5 * 255; + var b = rem % 6 / 5 * 255; + return [r, g, b]; + }; + + convert.rgb.hex = function (args) { + var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF); + var string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; + }; + + convert.hex.rgb = function (args) { + var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + + if (!match) { + return [0, 0, 0]; + } + + var colorString = match[0]; + + if (match[0].length === 3) { + colorString = colorString.split('').map(function (char) { + return char + char; + }).join(''); + } + + var integer = parseInt(colorString, 16); + var r = integer >> 16 & 0xFF; + var g = integer >> 8 & 0xFF; + var b = integer & 0xFF; + return [r, g, b]; + }; + + convert.rgb.hcg = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var max = Math.max(Math.max(r, g), b); + var min = Math.min(Math.min(r, g), b); + var chroma = max - min; + var grayscale; + var hue; + + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } + + if (chroma <= 0) { + hue = 0; + } else if (max === r) { + hue = (g - b) / chroma % 6; + } else if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma + 4; + } + + hue /= 6; + hue %= 1; + return [hue * 360, chroma * 100, grayscale * 100]; + }; + + convert.hsl.hcg = function (hsl) { + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var c = 1; + var f = 0; + + if (l < 0.5) { + c = 2.0 * s * l; + } else { + c = 2.0 * s * (1.0 - l); + } + + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } + + return [hsl[0], c * 100, f * 100]; + }; + + convert.hsv.hcg = function (hsv) { + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var c = s * v; + var f = 0; + + if (c < 1.0) { + f = (v - c) / (1 - c); + } + + return [hsv[0], c * 100, f * 100]; + }; + + convert.hcg.rgb = function (hcg) { + var h = hcg[0] / 360; + var c = hcg[1] / 100; + var g = hcg[2] / 100; + + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } + + var pure = [0, 0, 0]; + var hi = h % 1 * 6; + var v = hi % 1; + var w = 1 - v; + var mg = 0; + + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; + pure[1] = v; + pure[2] = 0; + break; + + case 1: + pure[0] = w; + pure[1] = 1; + pure[2] = 0; + break; + + case 2: + pure[0] = 0; + pure[1] = 1; + pure[2] = v; + break; + + case 3: + pure[0] = 0; + pure[1] = w; + pure[2] = 1; + break; + + case 4: + pure[0] = v; + pure[1] = 0; + pure[2] = 1; + break; + + default: + pure[0] = 1; + pure[1] = 0; + pure[2] = w; + } + + mg = (1.0 - c) * g; + return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255]; + }; + + convert.hcg.hsv = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + var v = c + g * (1.0 - c); + var f = 0; + + if (v > 0.0) { + f = c / v; + } + + return [hcg[0], f * 100, v * 100]; + }; + + convert.hcg.hsl = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + var l = g * (1.0 - c) + 0.5 * c; + var s = 0; + + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } + + return [hcg[0], s * 100, l * 100]; + }; + + convert.hcg.hwb = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + var v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; + }; + + convert.hwb.hcg = function (hwb) { + var w = hwb[1] / 100; + var b = hwb[2] / 100; + var v = 1 - b; + var c = v - w; + var g = 0; + + if (c < 1) { + g = (v - c) / (1 - c); + } + + return [hwb[0], c * 100, g * 100]; + }; + + convert.apple.rgb = function (apple) { + return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255]; + }; + + convert.rgb.apple = function (rgb) { + return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535]; + }; + + convert.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; + }; + + convert.gray.hsl = convert.gray.hsv = function (args) { + return [0, 0, args[0]]; + }; + + convert.gray.hwb = function (gray) { + return [0, 100, gray[0]]; + }; + + convert.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; + }; + + convert.gray.lab = function (gray) { + return [gray[0], 0, 0]; + }; + + convert.gray.hex = function (gray) { + var val = Math.round(gray[0] / 100 * 255) & 0xFF; + var integer = (val << 16) + (val << 8) + val; + var string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; + }; + + convert.rgb.gray = function (rgb) { + var val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; + }; +}); +var conversions_1$1 = conversions$2.rgb; +var conversions_2$1 = conversions$2.hsl; +var conversions_3$1 = conversions$2.hsv; +var conversions_4$1 = conversions$2.hwb; +var conversions_5$1 = conversions$2.cmyk; +var conversions_6$1 = conversions$2.xyz; +var conversions_7$1 = conversions$2.lab; +var conversions_8$1 = conversions$2.lch; +var conversions_9$1 = conversions$2.hex; +var conversions_10$1 = conversions$2.keyword; +var conversions_11$1 = conversions$2.ansi16; +var conversions_12$1 = conversions$2.ansi256; +var conversions_13$1 = conversions$2.hcg; +var conversions_14$1 = conversions$2.apple; +var conversions_15$1 = conversions$2.gray; + +/* + this function routes a model to all other models. + + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). + + conversions that are not possible simply are not included. +*/ + +function buildGraph$2() { + var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + + var models = Object.keys(conversions$2); + + for (var len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } + + return graph; +} // https://en.wikipedia.org/wiki/Breadth-first_search + + +function deriveBFS$2(fromModel) { + var graph = buildGraph$2(); + var queue = [fromModel]; // unshift -> queue -> pop + + graph[fromModel].distance = 0; + + while (queue.length) { + var current = queue.pop(); + var adjacents = Object.keys(conversions$2[current]); + + for (var len = adjacents.length, i = 0; i < len; i++) { + var adjacent = adjacents[i]; + var node = graph[adjacent]; + + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } + } + + return graph; +} + +function link$2(from, to) { + return function (args) { + return to(from(args)); + }; +} + +function wrapConversion$2(toModel, graph) { + var path = [graph[toModel].parent, toModel]; + var fn = conversions$2[graph[toModel].parent][toModel]; + var cur = graph[toModel].parent; + + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link$2(conversions$2[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } + + fn.conversion = path; + return fn; +} + +var route$2 = function (fromModel) { + var graph = deriveBFS$2(fromModel); + var conversion = {}; + var models = Object.keys(graph); + + for (var len = models.length, i = 0; i < len; i++) { + var toModel = models[i]; + var node = graph[toModel]; + + if (node.parent === null) { + // no possible conversion, or this node is the source model. + continue; + } + + conversion[toModel] = wrapConversion$2(toModel, graph); + } + + return conversion; +}; + +var convert$3 = {}; +var models$2 = Object.keys(conversions$2); + +function wrapRaw$2(fn) { + var wrappedFn = function (args) { + if (args === undefined || args === null) { + return args; + } + + if (arguments.length > 1) { + args = Array.prototype.slice.call(arguments); + } + + return fn(args); + }; // preserve .conversion property if there is one + + + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +function wrapRounded$2(fn) { + var wrappedFn = function (args) { + if (args === undefined || args === null) { + return args; + } + + if (arguments.length > 1) { + args = Array.prototype.slice.call(arguments); + } + + var result = fn(args); // we're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + + if (typeof result === 'object') { + for (var len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } + } + + return result; + }; // preserve .conversion property if there is one + + + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +models$2.forEach(function (fromModel) { + convert$3[fromModel] = {}; + Object.defineProperty(convert$3[fromModel], 'channels', { + value: conversions$2[fromModel].channels + }); + Object.defineProperty(convert$3[fromModel], 'labels', { + value: conversions$2[fromModel].labels + }); + var routes = route$2(fromModel); + var routeModels = Object.keys(routes); + routeModels.forEach(function (toModel) { + var fn = routes[toModel]; + convert$3[fromModel][toModel] = wrapRounded$2(fn); + convert$3[fromModel][toModel].raw = wrapRaw$2(fn); + }); +}); +var colorConvert$2 = convert$3; + +var ansiStyles$2 = createCommonjsModule(function (module) { + + const wrapAnsi16 = (fn, offset) => function () { + const code = fn.apply(colorConvert$2, arguments); + return `\u001B[${code + offset}m`; + }; + + const wrapAnsi256 = (fn, offset) => function () { + const code = fn.apply(colorConvert$2, arguments); + return `\u001B[${38 + offset};5;${code}m`; + }; + + const wrapAnsi16m = (fn, offset) => function () { + const rgb = fn.apply(colorConvert$2, arguments); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; + }; + + function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + // Bright color + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; // Fix humans + + styles.color.grey = styles.color.gray; + + for (const groupName of Object.keys(styles)) { + const group = styles[groupName]; + + for (const styleName of Object.keys(group)) { + const style = group[styleName]; + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + group[styleName] = styles[styleName]; + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + } + + const ansi2ansi = n => n; + + const rgb2rgb = (r, g, b) => [r, g, b]; + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + styles.color.ansi = { + ansi: wrapAnsi16(ansi2ansi, 0) + }; + styles.color.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 0) + }; + styles.color.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 0) + }; + styles.bgColor.ansi = { + ansi: wrapAnsi16(ansi2ansi, 10) + }; + styles.bgColor.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 10) + }; + styles.bgColor.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 10) + }; + + for (let key of Object.keys(colorConvert$2)) { + if (typeof colorConvert$2[key] !== 'object') { + continue; + } + + const suite = colorConvert$2[key]; + + if (key === 'ansi16') { + key = 'ansi'; + } + + if ('ansi16' in suite) { + styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); + styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); + } + + if ('ansi256' in suite) { + styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); + styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); + } + + if ('rgb' in suite) { + styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); + styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); + } + } + + return styles; + } // Make the export immutable + + + Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles + }); +}); + +const env$2 = process.env; +let forceColor$2; + +if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { + forceColor$2 = false; +} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) { + forceColor$2 = true; +} + +if ('FORCE_COLOR' in env$2) { + forceColor$2 = env$2.FORCE_COLOR.length === 0 || parseInt(env$2.FORCE_COLOR, 10) !== 0; +} + +function translateLevel$2(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} + +function supportsColor$2(stream) { + if (forceColor$2 === false) { + return 0; + } + + if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (stream && !stream.isTTY && forceColor$2 !== true) { + return 0; + } + + const min = forceColor$2 ? 1 : 0; + + if (process.platform === 'win32') { + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows + // release that supports 256 colors. Windows 10 build 14931 is the first release + // that supports 16m/TrueColor. + const osRelease = os$1.release().split('.'); + + if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env$2) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$2) || env$2.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env$2) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$2.TEAMCITY_VERSION) ? 1 : 0; + } + + if (env$2.COLORTERM === 'truecolor') { + return 3; + } + + if ('TERM_PROGRAM' in env$2) { + const version = parseInt((env$2.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env$2.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env$2.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$2.TERM)) { + return 1; + } + + if ('COLORTERM' in env$2) { + return 1; + } + + if (env$2.TERM === 'dumb') { + return min; + } + + return min; +} + +function getSupportLevel$2(stream) { + const level = supportsColor$2(stream); + return translateLevel$2(level); +} + +var supportsColor_1$2 = { + supportsColor: getSupportLevel$2, + stdout: getSupportLevel$2(process.stdout), + stderr: getSupportLevel$2(process.stderr) +}; + +const TEMPLATE_REGEX$2 = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX$2 = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX$2 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX$2 = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi; +const ESCAPES$2 = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]); + +function unescape$2(c) { + if (c[0] === 'u' && c.length === 5 || c[0] === 'x' && c.length === 3) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } + + return ESCAPES$2.get(c) || c; +} + +function parseArguments$2(name, args) { + const results = []; + const chunks = args.trim().split(/\s*,\s*/g); + let matches; + + for (const chunk of chunks) { + if (!isNaN(chunk)) { + results.push(Number(chunk)); + } else if (matches = chunk.match(STRING_REGEX$2)) { + results.push(matches[2].replace(ESCAPE_REGEX$2, (m, escape, chr) => escape ? unescape$2(escape) : chr)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } + + return results; +} + +function parseStyle$2(style) { + STYLE_REGEX$2.lastIndex = 0; + const results = []; + let matches; + + while ((matches = STYLE_REGEX$2.exec(style)) !== null) { + const name = matches[1]; + + if (matches[2]) { + const args = parseArguments$2(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } + } + + return results; +} + +function buildStyle$2(chalk, styles) { + const enabled = {}; + + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } + + let current = chalk; + + for (const styleName of Object.keys(enabled)) { + if (Array.isArray(enabled[styleName])) { + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } + + if (enabled[styleName].length > 0) { + current = current[styleName].apply(current, enabled[styleName]); + } else { + current = current[styleName]; + } + } + } + + return current; +} + +var templates$2 = (chalk, tmp) => { + const styles = []; + const chunks = []; + let chunk = []; // eslint-disable-next-line max-params + + tmp.replace(TEMPLATE_REGEX$2, (m, escapeChar, inverse, style, close, chr) => { + if (escapeChar) { + chunk.push(unescape$2(escapeChar)); + } else if (style) { + const str = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? str : buildStyle$2(chalk, styles)(str)); + styles.push({ + inverse, + styles: parseStyle$2(style) + }); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } + + chunks.push(buildStyle$2(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); + } else { + chunk.push(chr); + } + }); + chunks.push(chunk.join('')); + + if (styles.length > 0) { + const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMsg); + } + + return chunks.join(''); +}; + +var chalk$2 = createCommonjsModule(function (module) { + + const stdoutColor = supportsColor_1$2.stdout; + const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` → `ansiStyles.color[name]` mapping + + const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such + + const skipModels = new Set(['gray']); + const styles = Object.create(null); + + function applyOptions(obj, options) { + options = options || {}; // Detect level if not set manually + + const scLevel = stdoutColor ? stdoutColor.level : 0; + obj.level = options.level === undefined ? scLevel : options.level; + obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; + } + + function Chalk(options) { + // We check for this.template here since calling `chalk.constructor()` + // by itself will have a `this` of a previously constructed chalk object + if (!this || !(this instanceof Chalk) || this.template) { + const chalk = {}; + applyOptions(chalk, options); + + chalk.template = function () { + const args = [].slice.call(arguments); + return chalkTag.apply(null, [chalk.template].concat(args)); + }; + + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); + chalk.template.constructor = Chalk; + return chalk.template; + } + + applyOptions(this, options); + } // Use bright blue on Windows as the normal blue color is illegible + + + if (isSimpleWindowsTerm) { + ansiStyles$2.blue.open = '\u001B[94m'; + } + + for (const key of Object.keys(ansiStyles$2)) { + ansiStyles$2[key].closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$2[key].close), 'g'); + styles[key] = { + get() { + const codes = ansiStyles$2[key]; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); + } + + }; + } + + styles.visible = { + get() { + return build.call(this, this._styles || [], true, 'visible'); + } + + }; + ansiStyles$2.color.closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$2.color.close), 'g'); + + for (const model of Object.keys(ansiStyles$2.color.ansi)) { + if (skipModels.has(model)) { + continue; + } + + styles[model] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles$2.color[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles$2.color.close, + closeRe: ansiStyles$2.color.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + }; + } + + }; + } + + ansiStyles$2.bgColor.closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$2.bgColor.close), 'g'); + + for (const model of Object.keys(ansiStyles$2.bgColor.ansi)) { + if (skipModels.has(model)) { + continue; + } + + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles$2.bgColor[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles$2.bgColor.close, + closeRe: ansiStyles$2.bgColor.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + }; + } + + }; + } + + const proto = Object.defineProperties(() => {}, styles); + + function build(_styles, _empty, key) { + const builder = function () { + return applyStyle.apply(builder, arguments); + }; + + builder._styles = _styles; + builder._empty = _empty; + const self = this; + Object.defineProperty(builder, 'level', { + enumerable: true, + + get() { + return self.level; + }, + + set(level) { + self.level = level; + } + + }); + Object.defineProperty(builder, 'enabled', { + enumerable: true, + + get() { + return self.enabled; + }, + + set(enabled) { + self.enabled = enabled; + } + + }); // See below for fix regarding invisible grey/dim combination on Windows + + builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; // `__proto__` is used because we must return a function, but there is + // no way to create a function with a different prototype + + builder.__proto__ = proto; // eslint-disable-line no-proto + + return builder; + } + + function applyStyle() { + // Support varags, but simply cast to string in case there's only one arg + const args = arguments; + const argsLen = args.length; + let str = String(arguments[0]); + + if (argsLen === 0) { + return ''; + } + + if (argsLen > 1) { + // Don't slice `arguments`, it prevents V8 optimizations + for (let a = 1; a < argsLen; a++) { + str += ' ' + args[a]; + } + } + + if (!this.enabled || this.level <= 0 || !str) { + return this._empty ? '' : str; + } // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, + // see https://github.com/chalk/chalk/issues/58 + // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. + + + const originalDim = ansiStyles$2.dim.open; + + if (isSimpleWindowsTerm && this.hasGrey) { + ansiStyles$2.dim.open = ''; + } + + for (const code of this._styles.slice().reverse()) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + str = code.open + str.replace(code.closeRe, code.open) + code.close; // Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS + // https://github.com/chalk/chalk/pull/92 + + str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); + } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue + + + ansiStyles$2.dim.open = originalDim; + return str; + } + + function chalkTag(chalk, strings) { + if (!Array.isArray(strings)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return [].slice.call(arguments, 1).join(' '); + } + + const args = [].slice.call(arguments, 2); + const parts = [strings.raw[0]]; + + for (let i = 1; i < strings.length; i++) { + parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); + parts.push(String(strings.raw[i])); + } + + return templates$2(chalk, parts.join('')); + } + + Object.defineProperties(Chalk.prototype, styles); + module.exports = Chalk(); // eslint-disable-line new-cap + + module.exports.supportsColor = stdoutColor; + module.exports.default = module.exports; // For TypeScript +}); +var chalk_1$1 = chalk$2.supportsColor; + +var lib$1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.shouldHighlight = shouldHighlight; + exports.getChalk = getChalk; + exports.default = highlight; + + var _jsTokens = _interopRequireWildcard(jsTokens); + + var _esutils = _interopRequireDefault(utils$1); + + var _chalk = _interopRequireDefault(chalk$2); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + + function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + var cache = new WeakMap(); + + _getRequireWildcardCache = function () { + return cache; + }; + + return cache; + } + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + + var cache = _getRequireWildcardCache(); + + if (cache && cache.has(obj)) { + return cache.get(obj); + } + + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + + newObj.default = obj; + + if (cache) { + cache.set(obj, newObj); + } + + return newObj; + } + + function getDefs(chalk) { + return { + keyword: chalk.cyan, + capitalized: chalk.yellow, + jsx_tag: chalk.yellow, + punctuator: chalk.yellow, + number: chalk.magenta, + string: chalk.green, + regex: chalk.magenta, + comment: chalk.grey, + invalid: chalk.white.bgRed.bold + }; + } + + const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; + const JSX_TAG = /^[a-z][\w-]*$/i; + const BRACKET = /^[()[\]{}]$/; + + function getTokenType(match) { + const [offset, text] = match.slice(-2); + const token = (0, _jsTokens.matchToToken)(match); + + if (token.type === "name") { + if (_esutils.default.keyword.isReservedWordES6(token.value)) { + return "keyword"; + } + + if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == " colorize(str)).join("\n"); + } else { + return args[0]; + } + }); + } + + function shouldHighlight(options) { + return _chalk.default.supportsColor || options.forceColor; + } + + function getChalk(options) { + let chalk = _chalk.default; + + if (options.forceColor) { + chalk = new _chalk.default.constructor({ + enabled: true, + level: 1 + }); + } + + return chalk; + } + + function highlight(code, options = {}) { + if (shouldHighlight(options)) { + const chalk = getChalk(options); + const defs = getDefs(chalk); + return highlightTokens(defs, code); + } else { + return code; + } + } +}); +unwrapExports(lib$1); +var lib_1 = lib$1.shouldHighlight; +var lib_2 = lib$1.getChalk; + +var lib$2 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.codeFrameColumns = codeFrameColumns; + exports.default = _default; + + var _highlight = _interopRequireWildcard(lib$1); + + function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + var cache = new WeakMap(); + + _getRequireWildcardCache = function () { + return cache; + }; + + return cache; + } + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + + var cache = _getRequireWildcardCache(); + + if (cache && cache.has(obj)) { + return cache.get(obj); + } + + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + + newObj.default = obj; + + if (cache) { + cache.set(obj, newObj); + } + + return newObj; + } + + let deprecationWarningShown = false; + + function getDefs(chalk) { + return { + gutter: chalk.grey, + marker: chalk.red.bold, + message: chalk.red.bold + }; + } + + const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; + + function getMarkerLines(loc, source, opts) { + const startLoc = Object.assign({ + column: 0, + line: -1 + }, loc.start); + const endLoc = Object.assign({}, startLoc, {}, loc.end); + const { + linesAbove = 2, + linesBelow = 3 + } = opts || {}; + const startLine = startLoc.line; + const startColumn = startLoc.column; + const endLine = endLoc.line; + const endColumn = endLoc.column; + let start = Math.max(startLine - (linesAbove + 1), 0); + let end = Math.min(source.length, endLine + linesBelow); + + if (startLine === -1) { + start = 0; + } + + if (endLine === -1) { + end = source.length; + } + + const lineDiff = endLine - startLine; + const markerLines = {}; + + if (lineDiff) { + for (let i = 0; i <= lineDiff; i++) { + const lineNumber = i + startLine; + + if (!startColumn) { + markerLines[lineNumber] = true; + } else if (i === 0) { + const sourceLength = source[lineNumber - 1].length; + markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1]; + } else if (i === lineDiff) { + markerLines[lineNumber] = [0, endColumn]; + } else { + const sourceLength = source[lineNumber - i].length; + markerLines[lineNumber] = [0, sourceLength]; + } + } + } else { + if (startColumn === endColumn) { + if (startColumn) { + markerLines[startLine] = [startColumn, 0]; + } else { + markerLines[startLine] = true; + } + } else { + markerLines[startLine] = [startColumn, endColumn - startColumn]; + } + } + + return { + start, + end, + markerLines + }; + } + + function codeFrameColumns(rawLines, loc, opts = {}) { + const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts); + const chalk = (0, _highlight.getChalk)(opts); + const defs = getDefs(chalk); + + const maybeHighlight = (chalkFn, string) => { + return highlighted ? chalkFn(string) : string; + }; + + const lines = rawLines.split(NEWLINE); + const { + start, + end, + markerLines + } = getMarkerLines(loc, lines, opts); + const hasColumns = loc.start && typeof loc.start.column === "number"; + const numberMaxWidth = String(end).length; + const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines; + let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => { + const number = start + 1 + index; + const paddedNumber = ` ${number}`.slice(-numberMaxWidth); + const gutter = ` ${paddedNumber} | `; + const hasMarker = markerLines[number]; + const lastMarkerLine = !markerLines[number + 1]; + + if (hasMarker) { + let markerLine = ""; + + if (Array.isArray(hasMarker)) { + const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " "); + const numberOfMarkers = hasMarker[1] || 1; + markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join(""); + + if (lastMarkerLine && opts.message) { + markerLine += " " + maybeHighlight(defs.message, opts.message); + } + } + + return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join(""); + } else { + return ` ${maybeHighlight(defs.gutter, gutter)}${line}`; + } + }).join("\n"); + + if (opts.message && !hasColumns) { + frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`; + } + + if (highlighted) { + return chalk.reset(frame); + } else { + return frame; + } + } + + function _default(rawLines, lineNumber, colNumber, opts = {}) { + if (!deprecationWarningShown) { + deprecationWarningShown = true; + const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`."; + + if (process.emitWarning) { + process.emitWarning(message, "DeprecationWarning"); + } else { + const deprecationError = new Error(message); + deprecationError.name = "DeprecationWarning"; + console.warn(new Error(message)); + } + } + + colNumber = Math.max(colNumber, 0); + const location = { + start: { + column: colNumber, + line: lineNumber + } + }; + return codeFrameColumns(rawLines, location, opts); + } +}); +unwrapExports(lib$2); +var lib_1$1 = lib$2.codeFrameColumns; + +const { + ConfigError: ConfigError$1 +} = errors; +const { + locStart: locStart$1, + locEnd: locEnd$1 +} = loc; // Use defineProperties()/getOwnPropertyDescriptor() to prevent +// triggering the parsers getters. + +const ownNames = Object.getOwnPropertyNames; +const ownDescriptor = Object.getOwnPropertyDescriptor; + +function getParsers(options) { + const parsers = {}; + + for (const plugin of options.plugins) { + if (!plugin.parsers) { + continue; + } + + for (const name of ownNames(plugin.parsers)) { + Object.defineProperty(parsers, name, ownDescriptor(plugin.parsers, name)); + } + } + + return parsers; +} + +function resolveParser(opts, parsers) { + parsers = parsers || getParsers(opts); + + if (typeof opts.parser === "function") { + // Custom parser API always works with JavaScript. + return { + parse: opts.parser, + astFormat: "estree", + locStart: locStart$1, + locEnd: locEnd$1 + }; + } + + if (typeof opts.parser === "string") { + if (Object.prototype.hasOwnProperty.call(parsers, opts.parser)) { + return parsers[opts.parser]; + } + /* istanbul ignore next */ + + + { + try { + return { + parse: require(path$2.resolve(process.cwd(), opts.parser)), + astFormat: "estree", + locStart: locStart$1, + locEnd: locEnd$1 + }; + } catch (err) { + /* istanbul ignore next */ + throw new ConfigError$1(`Couldn't resolve parser "${opts.parser}"`); + } + } + } +} + +function parse(text, opts) { + const parsers = getParsers(opts); // Create a new object {parserName: parseFn}. Uses defineProperty() to only call + // the parsers getters when actually calling the parser `parse` function. + + const parsersForCustomParserApi = Object.keys(parsers).reduce((object, parserName) => Object.defineProperty(object, parserName, { + enumerable: true, + + get() { + return parsers[parserName].parse; + } + + }), {}); + const parser = resolveParser(opts, parsers); + + try { + if (parser.preprocess) { + text = parser.preprocess(text, opts); + } + + return { + text, + ast: parser.parse(text, parsersForCustomParserApi, opts) + }; + } catch (error) { + const { + loc + } = error; + + if (loc) { + const codeFrame = lib$2; + error.codeFrame = codeFrame.codeFrameColumns(text, loc, { + highlightCode: true + }); + error.message += "\n" + error.codeFrame; + throw error; + } + /* istanbul ignore next */ + + + throw error.stack; + } +} + +var parser = { + parse, + resolveParser +}; + +const { + UndefinedParserError: UndefinedParserError$1 +} = errors; +const { + getSupportInfo: getSupportInfo$1 +} = support; +const { + resolveParser: resolveParser$1 +} = parser; +const hiddenDefaults = { + astFormat: "estree", + printer: {}, + originalText: undefined, + locStart: null, + locEnd: null +}; // Copy options and fill in default values. + +function normalize$1(options, opts) { + opts = opts || {}; + const rawOptions = Object.assign({}, options); + const supportOptions = getSupportInfo$1({ + plugins: options.plugins, + showUnreleased: true, + showDeprecated: true + }).options; + const defaults = Object.assign({}, hiddenDefaults, {}, fromPairs_1(supportOptions.filter(optionInfo => optionInfo.default !== undefined).map(option => [option.name, option.default]))); + + if (!rawOptions.parser) { + if (!rawOptions.filepath) { + const logger = opts.logger || console; + logger.warn("No parser and no filepath given, using 'babel' the parser now " + "but this will throw an error in the future. " + "Please specify a parser or a filepath so one can be inferred."); + rawOptions.parser = "babel"; + } else { + rawOptions.parser = inferParser(rawOptions.filepath, rawOptions.plugins); + + if (!rawOptions.parser) { + throw new UndefinedParserError$1(`No parser could be inferred for file: ${rawOptions.filepath}`); + } + } + } + + const parser = resolveParser$1(optionsNormalizer.normalizeApiOptions(rawOptions, [supportOptions.find(x => x.name === "parser")], { + passThrough: true, + logger: false + })); + rawOptions.astFormat = parser.astFormat; + rawOptions.locEnd = parser.locEnd; + rawOptions.locStart = parser.locStart; + const plugin = getPlugin(rawOptions); + rawOptions.printer = plugin.printers[rawOptions.astFormat]; + const pluginDefaults = supportOptions.filter(optionInfo => optionInfo.pluginDefaults && optionInfo.pluginDefaults[plugin.name] !== undefined).reduce((reduced, optionInfo) => Object.assign(reduced, { + [optionInfo.name]: optionInfo.pluginDefaults[plugin.name] + }), {}); + const mixedDefaults = Object.assign({}, defaults, {}, pluginDefaults); + Object.keys(mixedDefaults).forEach(k => { + if (rawOptions[k] == null) { + rawOptions[k] = mixedDefaults[k]; + } + }); + + if (rawOptions.parser === "json") { + rawOptions.trailingComma = "none"; + } + + return optionsNormalizer.normalizeApiOptions(rawOptions, supportOptions, Object.assign({ + passThrough: Object.keys(hiddenDefaults) + }, opts)); +} + +function getPlugin(options) { + const { + astFormat + } = options; + + if (!astFormat) { + throw new Error("getPlugin() requires astFormat to be set"); + } + + const printerPlugin = options.plugins.find(plugin => plugin.printers && plugin.printers[astFormat]); + + if (!printerPlugin) { + throw new Error(`Couldn't find plugin for AST format "${astFormat}"`); + } + + return printerPlugin; +} + +function getInterpreter(filepath) { + if (typeof filepath !== "string") { + return ""; + } + + let fd; + + try { + fd = fs$3.openSync(filepath, "r"); + } catch (err) { + // istanbul ignore next + return ""; + } + + try { + const liner = new readlines(fd); + const firstLine = liner.next().toString("utf8"); // #!/bin/env node, #!/usr/bin/env node + + const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/); + + if (m1) { + return m1[1]; + } // #!/bin/node, #!/usr/bin/node, #!/usr/local/bin/node + + + const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/); + + if (m2) { + return m2[1]; + } + + return ""; + } catch (err) { + // There are some weird cases where paths are missing, causing Jest + // failures. It's unclear what these correspond to in the real world. + return ""; + } finally { + try { + // There are some weird cases where paths are missing, causing Jest + // failures. It's unclear what these correspond to in the real world. + fs$3.closeSync(fd); + } catch (err) {// nop + } + } +} + +function inferParser(filepath, plugins) { + const filename = path$2.basename(filepath).toLowerCase(); + const languages = getSupportInfo$1({ + plugins + }).languages.filter(language => language.since !== null); // If the file has no extension, we can try to infer the language from the + // interpreter in the shebang line, if any; but since this requires FS access, + // do it last. + + let language = languages.find(language => language.extensions && language.extensions.some(extension => filename.endsWith(extension)) || language.filenames && language.filenames.find(name => name.toLowerCase() === filename)); + + if (!language && !filename.includes(".")) { + const interpreter = getInterpreter(filepath); + language = languages.find(language => language.interpreters && language.interpreters.includes(interpreter)); + } + + return language && language.parsers[0]; +} + +var options$1 = { + normalize: normalize$1, + hiddenDefaults, + inferParser +}; + +function massageAST(ast, options, parent) { + if (Array.isArray(ast)) { + return ast.map(e => massageAST(e, options, parent)).filter(Boolean); + } + + if (!ast || typeof ast !== "object") { + return ast; + } + + const newObj = {}; + + for (const key of Object.keys(ast)) { + if (typeof ast[key] !== "function") { + newObj[key] = massageAST(ast[key], options, ast); + } + } + + if (options.printer.massageAstNode) { + const result = options.printer.massageAstNode(ast, newObj, parent); + + if (result === null) { + return undefined; + } + + if (result) { + return result; + } + } + + return newObj; +} + +var massageAst = massageAST; + +/** + * @param {Doc[]} parts + * @returns Doc + */ + + +function concat(parts) { + // access the internals of a document directly. + // if(parts.length === 1) { + // // If it's a single document, no need to concat it. + // return parts[0]; + // } + + + return { + type: "concat", + parts + }; +} +/** + * @param {Doc} contents + * @returns Doc + */ + + +function indent(contents) { + + return { + type: "indent", + contents + }; +} +/** + * @param {number} n + * @param {Doc} contents + * @returns Doc + */ + + +function align(n, contents) { + + return { + type: "align", + contents, + n + }; +} +/** + * @param {Doc} contents + * @param {object} [opts] - TBD ??? + * @returns Doc + */ + + +function group(contents, opts) { + opts = opts || {}; + + return { + type: "group", + id: opts.id, + contents, + break: !!opts.shouldBreak, + expandedStates: opts.expandedStates + }; +} +/** + * @param {Doc} contents + * @returns Doc + */ + + +function dedentToRoot(contents) { + return align(-Infinity, contents); +} +/** + * @param {Doc} contents + * @returns Doc + */ + + +function markAsRoot(contents) { + // @ts-ignore - TBD ???: + return align({ + type: "root" + }, contents); +} +/** + * @param {Doc} contents + * @returns Doc + */ + + +function dedent(contents) { + return align(-1, contents); +} +/** + * @param {Doc[]} states + * @param {object} [opts] - TBD ??? + * @returns Doc + */ + + +function conditionalGroup(states, opts) { + return group(states[0], Object.assign({}, opts, { + expandedStates: states + })); +} +/** + * @param {Doc[]} parts + * @returns Doc + */ + + +function fill(parts) { + + return { + type: "fill", + parts + }; +} +/** + * @param {Doc} [breakContents] + * @param {Doc} [flatContents] + * @param {object} [opts] - TBD ??? + * @returns Doc + */ + + +function ifBreak(breakContents, flatContents, opts) { + opts = opts || {}; + + return { + type: "if-break", + breakContents, + flatContents, + groupId: opts.groupId + }; +} +/** + * @param {Doc} contents + * @returns Doc + */ + + +function lineSuffix(contents) { + + return { + type: "line-suffix", + contents + }; +} + +const lineSuffixBoundary = { + type: "line-suffix-boundary" +}; +const breakParent = { + type: "break-parent" +}; +const trim = { + type: "trim" +}; +const line = { + type: "line" +}; +const softline = { + type: "line", + soft: true +}; +const hardline = concat([{ + type: "line", + hard: true +}, breakParent]); +const literalline = concat([{ + type: "line", + hard: true, + literal: true +}, breakParent]); +const cursor = { + type: "cursor", + placeholder: Symbol("cursor") +}; +/** + * @param {Doc} sep + * @param {Doc[]} arr + * @returns Doc + */ + +function join(sep, arr) { + const res = []; + + for (let i = 0; i < arr.length; i++) { + if (i !== 0) { + res.push(sep); + } + + res.push(arr[i]); + } + + return concat(res); +} +/** + * @param {Doc} doc + * @param {number} size + * @param {number} tabWidth + */ + + +function addAlignmentToDoc(doc, size, tabWidth) { + let aligned = doc; + + if (size > 0) { + // Use indent to add tabs for all the levels of tabs we need + for (let i = 0; i < Math.floor(size / tabWidth); ++i) { + aligned = indent(aligned); + } // Use align for all the spaces that are needed + + + aligned = align(size % tabWidth, aligned); // size is absolute from 0 and not relative to the current + // indentation, so we use -Infinity to reset the indentation to 0 + + aligned = align(-Infinity, aligned); + } + + return aligned; +} + +var docBuilders = { + concat, + join, + line, + softline, + hardline, + literalline, + group, + conditionalGroup, + fill, + lineSuffix, + lineSuffixBoundary, + cursor, + breakParent, + ifBreak, + trim, + indent, + align, + addAlignmentToDoc, + markAsRoot, + dedentToRoot, + dedent +}; + +var ansiRegex = ({ + onlyFirst = false +} = {}) => { + const pattern = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|'); + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +}; + +var stripAnsi = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; + +/* eslint-disable yoda */ + +const isFullwidthCodePoint = codePoint => { + if (Number.isNaN(codePoint)) { + return false; + } // Code points are derived from: + // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt + + + if (codePoint >= 0x1100 && (codePoint <= 0x115F || // Hangul Jamo + codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET + codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET + // CJK Radicals Supplement .. Enclosed CJK Letters and Months + 0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A + 0x3250 <= codePoint && codePoint <= 0x4DBF || // CJK Unified Ideographs .. Yi Radicals + 0x4E00 <= codePoint && codePoint <= 0xA4C6 || // Hangul Jamo Extended-A + 0xA960 <= codePoint && codePoint <= 0xA97C || // Hangul Syllables + 0xAC00 <= codePoint && codePoint <= 0xD7A3 || // CJK Compatibility Ideographs + 0xF900 <= codePoint && codePoint <= 0xFAFF || // Vertical Forms + 0xFE10 <= codePoint && codePoint <= 0xFE19 || // CJK Compatibility Forms .. Small Form Variants + 0xFE30 <= codePoint && codePoint <= 0xFE6B || // Halfwidth and Fullwidth Forms + 0xFF01 <= codePoint && codePoint <= 0xFF60 || 0xFFE0 <= codePoint && codePoint <= 0xFFE6 || // Kana Supplement + 0x1B000 <= codePoint && codePoint <= 0x1B001 || // Enclosed Ideographic Supplement + 0x1F200 <= codePoint && codePoint <= 0x1F251 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane + 0x20000 <= codePoint && codePoint <= 0x3FFFD)) { + return true; + } + + return false; +}; + +var isFullwidthCodePoint_1 = isFullwidthCodePoint; +var default_1$1 = isFullwidthCodePoint; +isFullwidthCodePoint_1.default = default_1$1; + +var emojiRegex = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; +}; + +const stringWidth = string => { + string = string.replace(emojiRegex(), ' '); + + if (typeof string !== 'string' || string.length === 0) { + return 0; + } + + string = stripAnsi(string); + let width = 0; + + for (let i = 0; i < string.length; i++) { + const code = string.codePointAt(i); // Ignore control characters + + if (code <= 0x1F || code >= 0x7F && code <= 0x9F) { + continue; + } // Ignore combining characters + + + if (code >= 0x300 && code <= 0x36F) { + continue; + } // Surrogates + + + if (code > 0xFFFF) { + i++; + } + + width += isFullwidthCodePoint_1(code) ? 2 : 1; + } + + return width; +}; + +var stringWidth_1 = stringWidth; // TODO: remove this in the next major version + +var default_1$2 = stringWidth; +stringWidth_1.default = default_1$2; + +const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g; + +var escapeStringRegexp$2 = string => { + if (typeof string !== 'string') { + throw new TypeError('Expected a string'); + } + + return string.replace(matchOperatorsRegex, '\\$&'); +}; + +const notAsciiRegex = /[^\x20-\x7F]/; + +function getPenultimate(arr) { + if (arr.length > 1) { + return arr[arr.length - 2]; + } + + return null; +} +/** + * @typedef {{backwards?: boolean}} SkipOptions + */ + +/** + * @param {string | RegExp} chars + * @returns {(text: string, index: number | false, opts?: SkipOptions) => number | false} + */ + + +function skip(chars) { + return (text, index, opts) => { + const backwards = opts && opts.backwards; // Allow `skip` functions to be threaded together without having + // to check for failures (did someone say monads?). + + if (index === false) { + return false; + } + + const { + length + } = text; + let cursor = index; + + while (cursor >= 0 && cursor < length) { + const c = text.charAt(cursor); + + if (chars instanceof RegExp) { + if (!chars.test(c)) { + return cursor; + } + } else if (!chars.includes(c)) { + return cursor; + } + + backwards ? cursor-- : cursor++; + } + + if (cursor === -1 || cursor === length) { + // If we reached the beginning or end of the file, return the + // out-of-bounds cursor. It's up to the caller to handle this + // correctly. We don't want to indicate `false` though if it + // actually skipped valid characters. + return cursor; + } + + return false; + }; +} +/** + * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false} + */ + + +const skipWhitespace = skip(/\s/); +/** + * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false} + */ + +const skipSpaces = skip(" \t"); +/** + * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false} + */ + +const skipToLineEnd = skip(",; \t"); +/** + * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false} + */ + +const skipEverythingButNewLine = skip(/[^\r\n]/); +/** + * @param {string} text + * @param {number | false} index + * @returns {number | false} + */ + +function skipInlineComment(text, index) { + if (index === false) { + return false; + } + + if (text.charAt(index) === "/" && text.charAt(index + 1) === "*") { + for (let i = index + 2; i < text.length; ++i) { + if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") { + return i + 2; + } + } + } + + return index; +} +/** + * @param {string} text + * @param {number | false} index + * @returns {number | false} + */ + + +function skipTrailingComment(text, index) { + if (index === false) { + return false; + } + + if (text.charAt(index) === "/" && text.charAt(index + 1) === "/") { + return skipEverythingButNewLine(text, index); + } + + return index; +} // This one doesn't use the above helper function because it wants to +// test \r\n in order and `skip` doesn't support ordering and we only +// want to skip one newline. It's simple to implement. + +/** + * @param {string} text + * @param {number | false} index + * @param {SkipOptions=} opts + * @returns {number | false} + */ + + +function skipNewline(text, index, opts) { + const backwards = opts && opts.backwards; + + if (index === false) { + return false; + } + + const atIndex = text.charAt(index); + + if (backwards) { + if (text.charAt(index - 1) === "\r" && atIndex === "\n") { + return index - 2; + } + + if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") { + return index - 1; + } + } else { + if (atIndex === "\r" && text.charAt(index + 1) === "\n") { + return index + 2; + } + + if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") { + return index + 1; + } + } + + return index; +} +/** + * @param {string} text + * @param {number} index + * @param {SkipOptions=} opts + * @returns {boolean} + */ + + +function hasNewline(text, index, opts) { + opts = opts || {}; + const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts); + const idx2 = skipNewline(text, idx, opts); + return idx !== idx2; +} +/** + * @param {string} text + * @param {number} start + * @param {number} end + * @returns {boolean} + */ + + +function hasNewlineInRange(text, start, end) { + for (let i = start; i < end; ++i) { + if (text.charAt(i) === "\n") { + return true; + } + } + + return false; +} // Note: this function doesn't ignore leading comments unlike isNextLineEmpty + +/** + * @template N + * @param {string} text + * @param {N} node + * @param {(node: N) => number} locStart + */ + + +function isPreviousLineEmpty(text, node, locStart) { + /** @type {number | false} */ + let idx = locStart(node) - 1; + idx = skipSpaces(text, idx, { + backwards: true + }); + idx = skipNewline(text, idx, { + backwards: true + }); + idx = skipSpaces(text, idx, { + backwards: true + }); + const idx2 = skipNewline(text, idx, { + backwards: true + }); + return idx !== idx2; +} +/** + * @param {string} text + * @param {number} index + * @returns {boolean} + */ + + +function isNextLineEmptyAfterIndex(text, index) { + /** @type {number | false} */ + let oldIdx = null; + /** @type {number | false} */ + + let idx = index; + + while (idx !== oldIdx) { + // We need to skip all the potential trailing inline comments + oldIdx = idx; + idx = skipToLineEnd(text, idx); + idx = skipInlineComment(text, idx); + idx = skipSpaces(text, idx); + } + + idx = skipTrailingComment(text, idx); + idx = skipNewline(text, idx); + return idx !== false && hasNewline(text, idx); +} +/** + * @template N + * @param {string} text + * @param {N} node + * @param {(node: N) => number} locEnd + * @returns {boolean} + */ + + +function isNextLineEmpty(text, node, locEnd) { + return isNextLineEmptyAfterIndex(text, locEnd(node)); +} +/** + * @param {string} text + * @param {number} idx + * @returns {number | false} + */ + + +function getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, idx) { + /** @type {number | false} */ + let oldIdx = null; + /** @type {number | false} */ + + let nextIdx = idx; + + while (nextIdx !== oldIdx) { + oldIdx = nextIdx; + nextIdx = skipSpaces(text, nextIdx); + nextIdx = skipInlineComment(text, nextIdx); + nextIdx = skipTrailingComment(text, nextIdx); + nextIdx = skipNewline(text, nextIdx); + } + + return nextIdx; +} +/** + * @template N + * @param {string} text + * @param {N} node + * @param {(node: N) => number} locEnd + * @returns {number | false} + */ + + +function getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) { + return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(node)); +} +/** + * @template N + * @param {string} text + * @param {N} node + * @param {(node: N) => number} locEnd + * @returns {string} + */ + + +function getNextNonSpaceNonCommentCharacter(text, node, locEnd) { + return text.charAt( // @ts-ignore => TBD: can return false, should we define a fallback? + getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd)); +} +/** + * @param {string} text + * @param {number} index + * @param {SkipOptions=} opts + * @returns {boolean} + */ + + +function hasSpaces(text, index, opts) { + opts = opts || {}; + const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts); + return idx !== index; +} +/** + * @param {{range?: [number, number], start?: number}} node + * @param {number} index + */ + + +function setLocStart(node, index) { + if (node.range) { + node.range[0] = index; + } else { + node.start = index; + } +} +/** + * @param {{range?: [number, number], end?: number}} node + * @param {number} index + */ + + +function setLocEnd(node, index) { + if (node.range) { + node.range[1] = index; + } else { + node.end = index; + } +} + +const PRECEDENCE = {}; +[["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].forEach((tier, i) => { + tier.forEach(op => { + PRECEDENCE[op] = i; + }); +}); + +function getPrecedence(op) { + return PRECEDENCE[op]; +} + +const equalityOperators = { + "==": true, + "!=": true, + "===": true, + "!==": true +}; +const multiplicativeOperators = { + "*": true, + "/": true, + "%": true +}; +const bitshiftOperators = { + ">>": true, + ">>>": true, + "<<": true +}; + +function shouldFlatten(parentOp, nodeOp) { + if (getPrecedence(nodeOp) !== getPrecedence(parentOp)) { + return false; + } // ** is right-associative + // x ** y ** z --> x ** (y ** z) + + + if (parentOp === "**") { + return false; + } // x == y == z --> (x == y) == z + + + if (equalityOperators[parentOp] && equalityOperators[nodeOp]) { + return false; + } // x * y % z --> (x * y) % z + + + if (nodeOp === "%" && multiplicativeOperators[parentOp] || parentOp === "%" && multiplicativeOperators[nodeOp]) { + return false; + } // x * y / z --> (x * y) / z + // x / y * z --> (x / y) * z + + + if (nodeOp !== parentOp && multiplicativeOperators[nodeOp] && multiplicativeOperators[parentOp]) { + return false; + } // x << y << z --> (x << y) << z + + + if (bitshiftOperators[parentOp] && bitshiftOperators[nodeOp]) { + return false; + } + + return true; +} + +function isBitwiseOperator(operator) { + return !!bitshiftOperators[operator] || operator === "|" || operator === "^" || operator === "&"; +} // Tests if an expression starts with `{`, or (if forbidFunctionClassAndDoExpr +// holds) `function`, `class`, or `do {}`. Will be overzealous if there's +// already necessary grouping parentheses. + + +function startsWithNoLookaheadToken(node, forbidFunctionClassAndDoExpr) { + node = getLeftMost(node); + + switch (node.type) { + case "FunctionExpression": + case "ClassExpression": + case "DoExpression": + return forbidFunctionClassAndDoExpr; + + case "ObjectExpression": + return true; + + case "MemberExpression": + case "OptionalMemberExpression": + return startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr); + + case "TaggedTemplateExpression": + if (node.tag.type === "FunctionExpression") { + // IIFEs are always already parenthesized + return false; + } + + return startsWithNoLookaheadToken(node.tag, forbidFunctionClassAndDoExpr); + + case "CallExpression": + case "OptionalCallExpression": + if (node.callee.type === "FunctionExpression") { + // IIFEs are always already parenthesized + return false; + } + + return startsWithNoLookaheadToken(node.callee, forbidFunctionClassAndDoExpr); + + case "ConditionalExpression": + return startsWithNoLookaheadToken(node.test, forbidFunctionClassAndDoExpr); + + case "UpdateExpression": + return !node.prefix && startsWithNoLookaheadToken(node.argument, forbidFunctionClassAndDoExpr); + + case "BindExpression": + return node.object && startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr); + + case "SequenceExpression": + return startsWithNoLookaheadToken(node.expressions[0], forbidFunctionClassAndDoExpr); + + case "TSAsExpression": + return startsWithNoLookaheadToken(node.expression, forbidFunctionClassAndDoExpr); + + default: + return false; + } +} + +function getLeftMost(node) { + if (node.left) { + return getLeftMost(node.left); + } + + return node; +} +/** + * @param {string} value + * @param {number} tabWidth + * @param {number=} startIndex + * @returns {number} + */ + + +function getAlignmentSize(value, tabWidth, startIndex) { + startIndex = startIndex || 0; + let size = 0; + + for (let i = startIndex; i < value.length; ++i) { + if (value[i] === "\t") { + // Tabs behave in a way that they are aligned to the nearest + // multiple of tabWidth: + // 0 -> 4, 1 -> 4, 2 -> 4, 3 -> 4 + // 4 -> 8, 5 -> 8, 6 -> 8, 7 -> 8 ... + size = size + tabWidth - size % tabWidth; + } else { + size++; + } + } + + return size; +} +/** + * @param {string} value + * @param {number} tabWidth + * @returns {number} + */ + + +function getIndentSize(value, tabWidth) { + const lastNewlineIndex = value.lastIndexOf("\n"); + + if (lastNewlineIndex === -1) { + return 0; + } + + return getAlignmentSize( // All the leading whitespaces + value.slice(lastNewlineIndex + 1).match(/^[ \t]*/)[0], tabWidth); +} +/** + * @typedef {'"' | "'"} Quote + */ + +/** + * + * @param {string} raw + * @param {Quote} preferredQuote + * @returns {Quote} + */ + + +function getPreferredQuote(raw, preferredQuote) { + // `rawContent` is the string exactly like it appeared in the input source + // code, without its enclosing quotes. + const rawContent = raw.slice(1, -1); + /** @type {{ quote: '"', regex: RegExp }} */ + + const double = { + quote: '"', + regex: /"/g + }; + /** @type {{ quote: "'", regex: RegExp }} */ + + const single = { + quote: "'", + regex: /'/g + }; + const preferred = preferredQuote === "'" ? single : double; + const alternate = preferred === single ? double : single; + let result = preferred.quote; // If `rawContent` contains at least one of the quote preferred for enclosing + // the string, we might want to enclose with the alternate quote instead, to + // minimize the number of escaped quotes. + + if (rawContent.includes(preferred.quote) || rawContent.includes(alternate.quote)) { + const numPreferredQuotes = (rawContent.match(preferred.regex) || []).length; + const numAlternateQuotes = (rawContent.match(alternate.regex) || []).length; + result = numPreferredQuotes > numAlternateQuotes ? alternate.quote : preferred.quote; + } + + return result; +} + +function printString(raw, options, isDirectiveLiteral) { + // `rawContent` is the string exactly like it appeared in the input source + // code, without its enclosing quotes. + const rawContent = raw.slice(1, -1); // Check for the alternate quote, to determine if we're allowed to swap + // the quotes on a DirectiveLiteral. + + const canChangeDirectiveQuotes = !rawContent.includes('"') && !rawContent.includes("'"); + /** @type {Quote} */ + + const enclosingQuote = options.parser === "json" ? '"' : options.__isInHtmlAttribute ? "'" : getPreferredQuote(raw, options.singleQuote ? "'" : '"'); // Directives are exact code unit sequences, which means that you can't + // change the escape sequences they use. + // See https://github.com/prettier/prettier/issues/1555 + // and https://tc39.github.io/ecma262/#directive-prologue + + if (isDirectiveLiteral) { + if (canChangeDirectiveQuotes) { + return enclosingQuote + rawContent + enclosingQuote; + } + + return raw; + } // It might sound unnecessary to use `makeString` even if the string already + // is enclosed with `enclosingQuote`, but it isn't. The string could contain + // unnecessary escapes (such as in `"\'"`). Always using `makeString` makes + // sure that we consistently output the minimum amount of escaped quotes. + + + return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.embeddedInHtml)); +} +/** + * @param {string} rawContent + * @param {Quote} enclosingQuote + * @param {boolean=} unescapeUnnecessaryEscapes + * @returns {string} + */ + + +function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) { + const otherQuote = enclosingQuote === '"' ? "'" : '"'; // Matches _any_ escape and unescaped quotes (both single and double). + + const regex = /\\([\s\S])|(['"])/g; // Escape and unescape single and double quotes as needed to be able to + // enclose `rawContent` with `enclosingQuote`. + + const newContent = rawContent.replace(regex, (match, escaped, quote) => { + // If we matched an escape, and the escaped character is a quote of the + // other type than we intend to enclose the string with, there's no need for + // it to be escaped, so return it _without_ the backslash. + if (escaped === otherQuote) { + return escaped; + } // If we matched an unescaped quote and it is of the _same_ type as we + // intend to enclose the string with, it must be escaped, so return it with + // a backslash. + + + if (quote === enclosingQuote) { + return "\\" + quote; + } + + if (quote) { + return quote; + } // Unescape any unnecessarily escaped character. + // Adapted from https://github.com/eslint/eslint/blob/de0b4ad7bd820ade41b1f606008bea68683dc11a/lib/rules/no-useless-escape.js#L27 + + + return unescapeUnnecessaryEscapes && /^[^\\nrvtbfux\r\n\u2028\u2029"'0-7]$/.test(escaped) ? escaped : "\\" + escaped; + }); + return enclosingQuote + newContent + enclosingQuote; +} + +function printNumber(rawNumber) { + return rawNumber.toLowerCase() // Remove unnecessary plus and zeroes from scientific notation. + .replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/, "$1$2$3") // Remove unnecessary scientific notation (1e0). + .replace(/^([+-]?[\d.]+)e[+-]?0+$/, "$1") // Make sure numbers always start with a digit. + .replace(/^([+-])?\./, "$10.") // Remove extraneous trailing decimal zeroes. + .replace(/(\.\d+?)0+(?=e|$)/, "$1") // Remove trailing dot. + .replace(/\.(?=e|$)/, ""); +} +/** + * @param {string} str + * @param {string} target + * @returns {number} + */ + + +function getMaxContinuousCount(str, target) { + const results = str.match(new RegExp(`(${escapeStringRegexp$2(target)})+`, "g")); + + if (results === null) { + return 0; + } + + return results.reduce((maxCount, result) => Math.max(maxCount, result.length / target.length), 0); +} + +function getMinNotPresentContinuousCount(str, target) { + const matches = str.match(new RegExp(`(${escapeStringRegexp$2(target)})+`, "g")); + + if (matches === null) { + return 0; + } + + const countPresent = new Map(); + let max = 0; + + for (const match of matches) { + const count = match.length / target.length; + countPresent.set(count, true); + + if (count > max) { + max = count; + } + } + + for (let i = 1; i < max; i++) { + if (!countPresent.get(i)) { + return i; + } + } + + return max + 1; +} +/** + * @param {string} text + * @returns {number} + */ + + +function getStringWidth(text) { + if (!text) { + return 0; + } // shortcut to avoid needless string `RegExp`s, replacements, and allocations within `string-width` + + + if (!notAsciiRegex.test(text)) { + return text.length; + } + + return stringWidth_1(text); +} + +function hasIgnoreComment(path) { + const node = path.getValue(); + return hasNodeIgnoreComment(node); +} + +function hasNodeIgnoreComment(node) { + return node && (node.comments && node.comments.length > 0 && node.comments.some(comment => isNodeIgnoreComment(comment) && !comment.unignore) || node.prettierIgnore); +} + +function isNodeIgnoreComment(comment) { + return comment.value.trim() === "prettier-ignore"; +} + +function addCommentHelper(node, comment) { + const comments = node.comments || (node.comments = []); + comments.push(comment); + comment.printed = false; // For some reason, TypeScript parses `// x` inside of JSXText as a comment + // We already "print" it via the raw text, we don't need to re-print it as a + // comment + + if (node.type === "JSXText") { + comment.printed = true; + } +} + +function addLeadingComment(node, comment) { + comment.leading = true; + comment.trailing = false; + addCommentHelper(node, comment); +} + +function addDanglingComment(node, comment) { + comment.leading = false; + comment.trailing = false; + addCommentHelper(node, comment); +} + +function addTrailingComment(node, comment) { + comment.leading = false; + comment.trailing = true; + addCommentHelper(node, comment); +} + +function isWithinParentArrayProperty(path, propertyName) { + const node = path.getValue(); + const parent = path.getParentNode(); + + if (parent == null) { + return false; + } + + if (!Array.isArray(parent[propertyName])) { + return false; + } + + const key = path.getName(); + return parent[propertyName][key] === node; +} + +function replaceEndOfLineWith(text, replacement) { + const parts = []; + + for (const part of text.split("\n")) { + if (parts.length !== 0) { + parts.push(replacement); + } + + parts.push(part); + } + + return parts; +} + +var util$1 = { + replaceEndOfLineWith, + getStringWidth, + getMaxContinuousCount, + getMinNotPresentContinuousCount, + getPrecedence, + shouldFlatten, + isBitwiseOperator, + getPenultimate, + getLast, + getNextNonSpaceNonCommentCharacterIndexWithStartIndex, + getNextNonSpaceNonCommentCharacterIndex, + getNextNonSpaceNonCommentCharacter, + skip, + skipWhitespace, + skipSpaces, + skipToLineEnd, + skipEverythingButNewLine, + skipInlineComment, + skipTrailingComment, + skipNewline, + isNextLineEmptyAfterIndex, + isNextLineEmpty, + isPreviousLineEmpty, + hasNewline, + hasNewlineInRange, + hasSpaces, + setLocStart, + setLocEnd, + startsWithNoLookaheadToken, + getAlignmentSize, + getIndentSize, + getPreferredQuote, + printString, + printNumber, + hasIgnoreComment, + hasNodeIgnoreComment, + isNodeIgnoreComment, + makeString, + addLeadingComment, + addDanglingComment, + addTrailingComment, + isWithinParentArrayProperty +}; + +function guessEndOfLine(text) { + const index = text.indexOf("\r"); + + if (index >= 0) { + return text.charAt(index + 1) === "\n" ? "crlf" : "cr"; + } + + return "lf"; +} + +function convertEndOfLineToChars(value) { + switch (value) { + case "cr": + return "\r"; + + case "crlf": + return "\r\n"; + + default: + return "\n"; + } +} + +var endOfLine = { + guessEndOfLine, + convertEndOfLineToChars +}; + +const { + getStringWidth: getStringWidth$1 +} = util$1; +const { + convertEndOfLineToChars: convertEndOfLineToChars$1 +} = endOfLine; +const { + concat: concat$1, + fill: fill$1, + cursor: cursor$1 +} = docBuilders; +/** @type {Record} */ + +let groupModeMap; +const MODE_BREAK = 1; +const MODE_FLAT = 2; + +function rootIndent() { + return { + value: "", + length: 0, + queue: [] + }; +} + +function makeIndent(ind, options) { + return generateInd(ind, { + type: "indent" + }, options); +} + +function makeAlign(ind, n, options) { + return n === -Infinity ? ind.root || rootIndent() : n < 0 ? generateInd(ind, { + type: "dedent" + }, options) : !n ? ind : n.type === "root" ? Object.assign({}, ind, { + root: ind + }) : typeof n === "string" ? generateInd(ind, { + type: "stringAlign", + n + }, options) : generateInd(ind, { + type: "numberAlign", + n + }, options); +} + +function generateInd(ind, newPart, options) { + const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : ind.queue.concat(newPart); + let value = ""; + let length = 0; + let lastTabs = 0; + let lastSpaces = 0; + + for (const part of queue) { + switch (part.type) { + case "indent": + flush(); + + if (options.useTabs) { + addTabs(1); + } else { + addSpaces(options.tabWidth); + } + + break; + + case "stringAlign": + flush(); + value += part.n; + length += part.n.length; + break; + + case "numberAlign": + lastTabs += 1; + lastSpaces += part.n; + break; + + /* istanbul ignore next */ + + default: + throw new Error(`Unexpected type '${part.type}'`); + } + } + + flushSpaces(); + return Object.assign({}, ind, { + value, + length, + queue + }); + + function addTabs(count) { + value += "\t".repeat(count); + length += options.tabWidth * count; + } + + function addSpaces(count) { + value += " ".repeat(count); + length += count; + } + + function flush() { + if (options.useTabs) { + flushTabs(); + } else { + flushSpaces(); + } + } + + function flushTabs() { + if (lastTabs > 0) { + addTabs(lastTabs); + } + + resetLast(); + } + + function flushSpaces() { + if (lastSpaces > 0) { + addSpaces(lastSpaces); + } + + resetLast(); + } + + function resetLast() { + lastTabs = 0; + lastSpaces = 0; + } +} + +function trim$1(out) { + if (out.length === 0) { + return 0; + } + + let trimCount = 0; // Trim whitespace at the end of line + + while (out.length > 0 && typeof out[out.length - 1] === "string" && out[out.length - 1].match(/^[ \t]*$/)) { + trimCount += out.pop().length; + } + + if (out.length && typeof out[out.length - 1] === "string") { + const trimmed = out[out.length - 1].replace(/[ \t]*$/, ""); + trimCount += out[out.length - 1].length - trimmed.length; + out[out.length - 1] = trimmed; + } + + return trimCount; +} + +function fits(next, restCommands, width, options, mustBeFlat) { + let restIdx = restCommands.length; + const cmds = [next]; // `out` is only used for width counting because `trim` requires to look + // backwards for space characters. + + const out = []; + + while (width >= 0) { + if (cmds.length === 0) { + if (restIdx === 0) { + return true; + } + + cmds.push(restCommands[restIdx - 1]); + restIdx--; + continue; + } + + const [ind, mode, doc] = cmds.pop(); + + if (typeof doc === "string") { + out.push(doc); + width -= getStringWidth$1(doc); + } else { + switch (doc.type) { + case "concat": + for (let i = doc.parts.length - 1; i >= 0; i--) { + cmds.push([ind, mode, doc.parts[i]]); + } + + break; + + case "indent": + cmds.push([makeIndent(ind, options), mode, doc.contents]); + break; + + case "align": + cmds.push([makeAlign(ind, doc.n, options), mode, doc.contents]); + break; + + case "trim": + width += trim$1(out); + break; + + case "group": + if (mustBeFlat && doc.break) { + return false; + } + + cmds.push([ind, doc.break ? MODE_BREAK : mode, doc.contents]); + + if (doc.id) { + groupModeMap[doc.id] = cmds[cmds.length - 1][1]; + } + + break; + + case "fill": + for (let i = doc.parts.length - 1; i >= 0; i--) { + cmds.push([ind, mode, doc.parts[i]]); + } + + break; + + case "if-break": + { + const groupMode = doc.groupId ? groupModeMap[doc.groupId] : mode; + + if (groupMode === MODE_BREAK) { + if (doc.breakContents) { + cmds.push([ind, mode, doc.breakContents]); + } + } + + if (groupMode === MODE_FLAT) { + if (doc.flatContents) { + cmds.push([ind, mode, doc.flatContents]); + } + } + + break; + } + + case "line": + switch (mode) { + // fallthrough + case MODE_FLAT: + if (!doc.hard) { + if (!doc.soft) { + out.push(" "); + width -= 1; + } + + break; + } + + return true; + + case MODE_BREAK: + return true; + } + + break; + } + } + } + + return false; +} + +function printDocToString(doc, options) { + groupModeMap = {}; + const width = options.printWidth; + const newLine = convertEndOfLineToChars$1(options.endOfLine); + let pos = 0; // cmds is basically a stack. We've turned a recursive call into a + // while loop which is much faster. The while loop below adds new + // cmds to the array instead of recursively calling `print`. + + const cmds = [[rootIndent(), MODE_BREAK, doc]]; + const out = []; + let shouldRemeasure = false; + let lineSuffix = []; + + while (cmds.length !== 0) { + const [ind, mode, doc] = cmds.pop(); + + if (typeof doc === "string") { + const formatted = newLine !== "\n" && doc.includes("\n") ? doc.replace(/\n/g, newLine) : doc; + out.push(formatted); + pos += getStringWidth$1(formatted); + } else { + switch (doc.type) { + case "cursor": + out.push(cursor$1.placeholder); + break; + + case "concat": + for (let i = doc.parts.length - 1; i >= 0; i--) { + cmds.push([ind, mode, doc.parts[i]]); + } + + break; + + case "indent": + cmds.push([makeIndent(ind, options), mode, doc.contents]); + break; + + case "align": + cmds.push([makeAlign(ind, doc.n, options), mode, doc.contents]); + break; + + case "trim": + pos -= trim$1(out); + break; + + case "group": + switch (mode) { + case MODE_FLAT: + if (!shouldRemeasure) { + cmds.push([ind, doc.break ? MODE_BREAK : MODE_FLAT, doc.contents]); + break; + } + + // fallthrough + + case MODE_BREAK: + { + shouldRemeasure = false; + const next = [ind, MODE_FLAT, doc.contents]; + const rem = width - pos; + + if (!doc.break && fits(next, cmds, rem, options)) { + cmds.push(next); + } else { + // Expanded states are a rare case where a document + // can manually provide multiple representations of + // itself. It provides an array of documents + // going from the least expanded (most flattened) + // representation first to the most expanded. If a + // group has these, we need to manually go through + // these states and find the first one that fits. + if (doc.expandedStates) { + const mostExpanded = doc.expandedStates[doc.expandedStates.length - 1]; + + if (doc.break) { + cmds.push([ind, MODE_BREAK, mostExpanded]); + break; + } else { + for (let i = 1; i < doc.expandedStates.length + 1; i++) { + if (i >= doc.expandedStates.length) { + cmds.push([ind, MODE_BREAK, mostExpanded]); + break; + } else { + const state = doc.expandedStates[i]; + const cmd = [ind, MODE_FLAT, state]; + + if (fits(cmd, cmds, rem, options)) { + cmds.push(cmd); + break; + } + } + } + } + } else { + cmds.push([ind, MODE_BREAK, doc.contents]); + } + } + + break; + } + } + + if (doc.id) { + groupModeMap[doc.id] = cmds[cmds.length - 1][1]; + } + + break; + // Fills each line with as much code as possible before moving to a new + // line with the same indentation. + // + // Expects doc.parts to be an array of alternating content and + // whitespace. The whitespace contains the linebreaks. + // + // For example: + // ["I", line, "love", line, "monkeys"] + // or + // [{ type: group, ... }, softline, { type: group, ... }] + // + // It uses this parts structure to handle three main layout cases: + // * The first two content items fit on the same line without + // breaking + // -> output the first content item and the whitespace "flat". + // * Only the first content item fits on the line without breaking + // -> output the first content item "flat" and the whitespace with + // "break". + // * Neither content item fits on the line without breaking + // -> output the first content item and the whitespace with "break". + + case "fill": + { + const rem = width - pos; + const { + parts + } = doc; + + if (parts.length === 0) { + break; + } + + const [content, whitespace] = parts; + const contentFlatCmd = [ind, MODE_FLAT, content]; + const contentBreakCmd = [ind, MODE_BREAK, content]; + const contentFits = fits(contentFlatCmd, [], rem, options, true); + + if (parts.length === 1) { + if (contentFits) { + cmds.push(contentFlatCmd); + } else { + cmds.push(contentBreakCmd); + } + + break; + } + + const whitespaceFlatCmd = [ind, MODE_FLAT, whitespace]; + const whitespaceBreakCmd = [ind, MODE_BREAK, whitespace]; + + if (parts.length === 2) { + if (contentFits) { + cmds.push(whitespaceFlatCmd); + cmds.push(contentFlatCmd); + } else { + cmds.push(whitespaceBreakCmd); + cmds.push(contentBreakCmd); + } + + break; + } // At this point we've handled the first pair (context, separator) + // and will create a new fill doc for the rest of the content. + // Ideally we wouldn't mutate the array here but copying all the + // elements to a new array would make this algorithm quadratic, + // which is unusable for large arrays (e.g. large texts in JSX). + + + parts.splice(0, 2); + const remainingCmd = [ind, mode, fill$1(parts)]; + const secondContent = parts[0]; + const firstAndSecondContentFlatCmd = [ind, MODE_FLAT, concat$1([content, whitespace, secondContent])]; + const firstAndSecondContentFits = fits(firstAndSecondContentFlatCmd, [], rem, options, true); + + if (firstAndSecondContentFits) { + cmds.push(remainingCmd); + cmds.push(whitespaceFlatCmd); + cmds.push(contentFlatCmd); + } else if (contentFits) { + cmds.push(remainingCmd); + cmds.push(whitespaceBreakCmd); + cmds.push(contentFlatCmd); + } else { + cmds.push(remainingCmd); + cmds.push(whitespaceBreakCmd); + cmds.push(contentBreakCmd); + } + + break; + } + + case "if-break": + { + const groupMode = doc.groupId ? groupModeMap[doc.groupId] : mode; + + if (groupMode === MODE_BREAK) { + if (doc.breakContents) { + cmds.push([ind, mode, doc.breakContents]); + } + } + + if (groupMode === MODE_FLAT) { + if (doc.flatContents) { + cmds.push([ind, mode, doc.flatContents]); + } + } + + break; + } + + case "line-suffix": + lineSuffix.push([ind, mode, doc.contents]); + break; + + case "line-suffix-boundary": + if (lineSuffix.length > 0) { + cmds.push([ind, mode, { + type: "line", + hard: true + }]); + } + + break; + + case "line": + switch (mode) { + case MODE_FLAT: + if (!doc.hard) { + if (!doc.soft) { + out.push(" "); + pos += 1; + } + + break; + } else { + // This line was forced into the output even if we + // were in flattened mode, so we need to tell the next + // group that no matter what, it needs to remeasure + // because the previous measurement didn't accurately + // capture the entire expression (this is necessary + // for nested groups) + shouldRemeasure = true; + } + + // fallthrough + + case MODE_BREAK: + if (lineSuffix.length) { + cmds.push([ind, mode, doc]); + cmds.push(...lineSuffix.reverse()); + lineSuffix = []; + break; + } + + if (doc.literal) { + if (ind.root) { + out.push(newLine, ind.root.value); + pos = ind.root.length; + } else { + out.push(newLine); + pos = 0; + } + } else { + pos -= trim$1(out); + out.push(newLine + ind.value); + pos = ind.length; + } + + break; + } + + break; + } + } + } + + const cursorPlaceholderIndex = out.indexOf(cursor$1.placeholder); + + if (cursorPlaceholderIndex !== -1) { + const otherCursorPlaceholderIndex = out.indexOf(cursor$1.placeholder, cursorPlaceholderIndex + 1); + const beforeCursor = out.slice(0, cursorPlaceholderIndex).join(""); + const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join(""); + const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join(""); + return { + formatted: beforeCursor + aroundCursor + afterCursor, + cursorNodeStart: beforeCursor.length, + cursorNodeText: aroundCursor + }; + } + + return { + formatted: out.join("") + }; +} + +var docPrinter = { + printDocToString +}; + +const traverseDocOnExitStackMarker = {}; + +function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) { + const docsStack = [doc]; + + while (docsStack.length !== 0) { + const doc = docsStack.pop(); + + if (doc === traverseDocOnExitStackMarker) { + onExit(docsStack.pop()); + continue; + } + + let shouldRecurse = true; + + if (onEnter) { + if (onEnter(doc) === false) { + shouldRecurse = false; + } + } + + if (onExit) { + docsStack.push(doc); + docsStack.push(traverseDocOnExitStackMarker); + } + + if (shouldRecurse) { + // When there are multiple parts to process, + // the parts need to be pushed onto the stack in reverse order, + // so that they are processed in the original order + // when the stack is popped. + if (doc.type === "concat" || doc.type === "fill") { + for (let ic = doc.parts.length, i = ic - 1; i >= 0; --i) { + docsStack.push(doc.parts[i]); + } + } else if (doc.type === "if-break") { + if (doc.flatContents) { + docsStack.push(doc.flatContents); + } + + if (doc.breakContents) { + docsStack.push(doc.breakContents); + } + } else if (doc.type === "group" && doc.expandedStates) { + if (shouldTraverseConditionalGroups) { + for (let ic = doc.expandedStates.length, i = ic - 1; i >= 0; --i) { + docsStack.push(doc.expandedStates[i]); + } + } else { + docsStack.push(doc.contents); + } + } else if (doc.contents) { + docsStack.push(doc.contents); + } + } + } +} + +function mapDoc(doc, cb) { + if (doc.type === "concat" || doc.type === "fill") { + const parts = doc.parts.map(part => mapDoc(part, cb)); + return cb(Object.assign({}, doc, { + parts + })); + } else if (doc.type === "if-break") { + const breakContents = doc.breakContents && mapDoc(doc.breakContents, cb); + const flatContents = doc.flatContents && mapDoc(doc.flatContents, cb); + return cb(Object.assign({}, doc, { + breakContents, + flatContents + })); + } else if (doc.contents) { + const contents = mapDoc(doc.contents, cb); + return cb(Object.assign({}, doc, { + contents + })); + } + + return cb(doc); +} + +function findInDoc(doc, fn, defaultValue) { + let result = defaultValue; + let hasStopped = false; + + function findInDocOnEnterFn(doc) { + const maybeResult = fn(doc); + + if (maybeResult !== undefined) { + hasStopped = true; + result = maybeResult; + } + + if (hasStopped) { + return false; + } + } + + traverseDoc(doc, findInDocOnEnterFn); + return result; +} + +function isEmpty(n) { + return typeof n === "string" && n.length === 0; +} + +function isLineNextFn(doc) { + if (typeof doc === "string") { + return false; + } + + if (doc.type === "line") { + return true; + } +} + +function isLineNext(doc) { + return findInDoc(doc, isLineNextFn, false); +} + +function willBreakFn(doc) { + if (doc.type === "group" && doc.break) { + return true; + } + + if (doc.type === "line" && doc.hard) { + return true; + } + + if (doc.type === "break-parent") { + return true; + } +} + +function willBreak(doc) { + return findInDoc(doc, willBreakFn, false); +} + +function breakParentGroup(groupStack) { + if (groupStack.length > 0) { + const parentGroup = groupStack[groupStack.length - 1]; // Breaks are not propagated through conditional groups because + // the user is expected to manually handle what breaks. + + if (!parentGroup.expandedStates) { + parentGroup.break = true; + } + } + + return null; +} + +function propagateBreaks(doc) { + const alreadyVisitedSet = new Set(); + const groupStack = []; + + function propagateBreaksOnEnterFn(doc) { + if (doc.type === "break-parent") { + breakParentGroup(groupStack); + } + + if (doc.type === "group") { + groupStack.push(doc); + + if (alreadyVisitedSet.has(doc)) { + return false; + } + + alreadyVisitedSet.add(doc); + } + } + + function propagateBreaksOnExitFn(doc) { + if (doc.type === "group") { + const group = groupStack.pop(); + + if (group.break) { + breakParentGroup(groupStack); + } + } + } + + traverseDoc(doc, propagateBreaksOnEnterFn, propagateBreaksOnExitFn, + /* shouldTraverseConditionalGroups */ + true); +} + +function removeLinesFn(doc) { + // Force this doc into flat mode by statically converting all + // lines into spaces (or soft lines into nothing). Hard lines + // should still output because there's too great of a chance + // of breaking existing assumptions otherwise. + if (doc.type === "line" && !doc.hard) { + return doc.soft ? "" : " "; + } else if (doc.type === "if-break") { + return doc.flatContents || ""; + } + + return doc; +} + +function removeLines(doc) { + return mapDoc(doc, removeLinesFn); +} + +function stripTrailingHardline(doc) { + // HACK remove ending hardline, original PR: #1984 + if (doc.type === "concat" && doc.parts.length !== 0) { + const lastPart = doc.parts[doc.parts.length - 1]; + + if (lastPart.type === "concat") { + if (lastPart.parts.length === 2 && lastPart.parts[0].hard && lastPart.parts[1].type === "break-parent") { + return { + type: "concat", + parts: doc.parts.slice(0, -1) + }; + } + + return { + type: "concat", + parts: doc.parts.slice(0, -1).concat(stripTrailingHardline(lastPart)) + }; + } + } + + return doc; +} + +var docUtils = { + isEmpty, + willBreak, + isLineNext, + traverseDoc, + findInDoc, + mapDoc, + propagateBreaks, + removeLines, + stripTrailingHardline +}; + +function flattenDoc(doc) { + if (doc.type === "concat") { + const res = []; + + for (let i = 0; i < doc.parts.length; ++i) { + const doc2 = doc.parts[i]; + + if (typeof doc2 !== "string" && doc2.type === "concat") { + res.push(...flattenDoc(doc2).parts); + } else { + const flattened = flattenDoc(doc2); + + if (flattened !== "") { + res.push(flattened); + } + } + } + + return Object.assign({}, doc, { + parts: res + }); + } else if (doc.type === "if-break") { + return Object.assign({}, doc, { + breakContents: doc.breakContents != null ? flattenDoc(doc.breakContents) : null, + flatContents: doc.flatContents != null ? flattenDoc(doc.flatContents) : null + }); + } else if (doc.type === "group") { + return Object.assign({}, doc, { + contents: flattenDoc(doc.contents), + expandedStates: doc.expandedStates ? doc.expandedStates.map(flattenDoc) : doc.expandedStates + }); + } else if (doc.contents) { + return Object.assign({}, doc, { + contents: flattenDoc(doc.contents) + }); + } + + return doc; +} + +function printDoc(doc) { + if (typeof doc === "string") { + return JSON.stringify(doc); + } + + if (doc.type === "line") { + if (doc.literal) { + return "literalline"; + } + + if (doc.hard) { + return "hardline"; + } + + if (doc.soft) { + return "softline"; + } + + return "line"; + } + + if (doc.type === "break-parent") { + return "breakParent"; + } + + if (doc.type === "trim") { + return "trim"; + } + + if (doc.type === "concat") { + return "[" + doc.parts.map(printDoc).join(", ") + "]"; + } + + if (doc.type === "indent") { + return "indent(" + printDoc(doc.contents) + ")"; + } + + if (doc.type === "align") { + return doc.n === -Infinity ? "dedentToRoot(" + printDoc(doc.contents) + ")" : doc.n < 0 ? "dedent(" + printDoc(doc.contents) + ")" : doc.n.type === "root" ? "markAsRoot(" + printDoc(doc.contents) + ")" : "align(" + JSON.stringify(doc.n) + ", " + printDoc(doc.contents) + ")"; + } + + if (doc.type === "if-break") { + return "ifBreak(" + printDoc(doc.breakContents) + (doc.flatContents ? ", " + printDoc(doc.flatContents) : "") + ")"; + } + + if (doc.type === "group") { + if (doc.expandedStates) { + return "conditionalGroup(" + "[" + doc.expandedStates.map(printDoc).join(",") + "])"; + } + + return (doc.break ? "wrappedGroup" : "group") + "(" + printDoc(doc.contents) + ")"; + } + + if (doc.type === "fill") { + return "fill" + "(" + doc.parts.map(printDoc).join(", ") + ")"; + } + + if (doc.type === "line-suffix") { + return "lineSuffix(" + printDoc(doc.contents) + ")"; + } + + if (doc.type === "line-suffix-boundary") { + return "lineSuffixBoundary"; + } + + throw new Error("Unknown doc type " + doc.type); +} + +var docDebug = { + printDocToDebug(doc) { + return printDoc(flattenDoc(doc)); + } + +}; + +var document = { + builders: docBuilders, + printer: docPrinter, + utils: docUtils, + debug: docDebug +}; + +const { + getMaxContinuousCount: getMaxContinuousCount$1, + getStringWidth: getStringWidth$2, + getAlignmentSize: getAlignmentSize$1, + getIndentSize: getIndentSize$1, + skip: skip$1, + skipWhitespace: skipWhitespace$1, + skipSpaces: skipSpaces$1, + skipNewline: skipNewline$1, + skipToLineEnd: skipToLineEnd$1, + skipEverythingButNewLine: skipEverythingButNewLine$1, + skipInlineComment: skipInlineComment$1, + skipTrailingComment: skipTrailingComment$1, + hasNewline: hasNewline$1, + hasNewlineInRange: hasNewlineInRange$1, + hasSpaces: hasSpaces$1, + isNextLineEmpty: isNextLineEmpty$1, + isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$1, + isPreviousLineEmpty: isPreviousLineEmpty$1, + getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$1, + makeString: makeString$1, + addLeadingComment: addLeadingComment$1, + addDanglingComment: addDanglingComment$1, + addTrailingComment: addTrailingComment$1 +} = util$1; +var utilShared = { + getMaxContinuousCount: getMaxContinuousCount$1, + getStringWidth: getStringWidth$2, + getAlignmentSize: getAlignmentSize$1, + getIndentSize: getIndentSize$1, + skip: skip$1, + skipWhitespace: skipWhitespace$1, + skipSpaces: skipSpaces$1, + skipNewline: skipNewline$1, + skipToLineEnd: skipToLineEnd$1, + skipEverythingButNewLine: skipEverythingButNewLine$1, + skipInlineComment: skipInlineComment$1, + skipTrailingComment: skipTrailingComment$1, + hasNewline: hasNewline$1, + hasNewlineInRange: hasNewlineInRange$1, + hasSpaces: hasSpaces$1, + isNextLineEmpty: isNextLineEmpty$1, + isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$1, + isPreviousLineEmpty: isPreviousLineEmpty$1, + getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$1, + makeString: makeString$1, + addLeadingComment: addLeadingComment$1, + addDanglingComment: addDanglingComment$1, + addTrailingComment: addTrailingComment$1 +}; + +const { + concat: concat$2, + line: line$1, + hardline: hardline$1, + breakParent: breakParent$1, + indent: indent$1, + lineSuffix: lineSuffix$1, + join: join$1, + cursor: cursor$2 +} = document.builders; +const { + hasNewline: hasNewline$2, + skipNewline: skipNewline$2, + isPreviousLineEmpty: isPreviousLineEmpty$2 +} = util$1; +const { + addLeadingComment: addLeadingComment$2, + addDanglingComment: addDanglingComment$2, + addTrailingComment: addTrailingComment$2 +} = utilShared; +const childNodesCacheKey = Symbol("child-nodes"); + +function getSortedChildNodes(node, options, resultArray) { + if (!node) { + return; + } + + const { + printer, + locStart, + locEnd + } = options; + + if (resultArray) { + if (printer.canAttachComment && printer.canAttachComment(node)) { + // This reverse insertion sort almost always takes constant + // time because we almost always (maybe always?) append the + // nodes in order anyway. + let i; + + for (i = resultArray.length - 1; i >= 0; --i) { + if (locStart(resultArray[i]) <= locStart(node) && locEnd(resultArray[i]) <= locEnd(node)) { + break; + } + } + + resultArray.splice(i + 1, 0, node); + return; + } + } else if (node[childNodesCacheKey]) { + return node[childNodesCacheKey]; + } + + const childNodes = printer.getCommentChildNodes && printer.getCommentChildNodes(node, options) || typeof node === "object" && Object.keys(node).filter(n => n !== "enclosingNode" && n !== "precedingNode" && n !== "followingNode").map(n => node[n]); + + if (!childNodes) { + return; + } + + if (!resultArray) { + Object.defineProperty(node, childNodesCacheKey, { + value: resultArray = [], + enumerable: false + }); + } + + childNodes.forEach(childNode => { + getSortedChildNodes(childNode, options, resultArray); + }); + return resultArray; +} // As efficiently as possible, decorate the comment object with +// .precedingNode, .enclosingNode, and/or .followingNode properties, at +// least one of which is guaranteed to be defined. + + +function decorateComment(node, comment, options) { + const { + locStart, + locEnd + } = options; + const childNodes = getSortedChildNodes(node, options); + let precedingNode; + let followingNode; // Time to dust off the old binary search robes and wizard hat. + + let left = 0; + let right = childNodes.length; + + while (left < right) { + const middle = left + right >> 1; + const child = childNodes[middle]; + + if (locStart(child) - locStart(comment) <= 0 && locEnd(comment) - locEnd(child) <= 0) { + // The comment is completely contained by this child node. + comment.enclosingNode = child; + decorateComment(child, comment, options); + return; // Abandon the binary search at this level. + } + + if (locEnd(child) - locStart(comment) <= 0) { + // This child node falls completely before the comment. + // Because we will never consider this node or any nodes + // before it again, this node must be the closest preceding + // node we have encountered so far. + precedingNode = child; + left = middle + 1; + continue; + } + + if (locEnd(comment) - locStart(child) <= 0) { + // This child node falls completely after the comment. + // Because we will never consider this node or any nodes after + // it again, this node must be the closest following node we + // have encountered so far. + followingNode = child; + right = middle; + continue; + } + /* istanbul ignore next */ + + + throw new Error("Comment location overlaps with node location"); + } // We don't want comments inside of different expressions inside of the same + // template literal to move to another expression. + + + if (comment.enclosingNode && comment.enclosingNode.type === "TemplateLiteral") { + const { + quasis + } = comment.enclosingNode; + const commentIndex = findExpressionIndexForComment(quasis, comment, options); + + if (precedingNode && findExpressionIndexForComment(quasis, precedingNode, options) !== commentIndex) { + precedingNode = null; + } + + if (followingNode && findExpressionIndexForComment(quasis, followingNode, options) !== commentIndex) { + followingNode = null; + } + } + + if (precedingNode) { + comment.precedingNode = precedingNode; + } + + if (followingNode) { + comment.followingNode = followingNode; + } +} + +function attach(comments, ast, text, options) { + if (!Array.isArray(comments)) { + return; + } + + const tiesToBreak = []; + const { + locStart, + locEnd + } = options; + comments.forEach((comment, i) => { + if (options.parser === "json" || options.parser === "json5" || options.parser === "__js_expression" || options.parser === "__vue_expression") { + if (locStart(comment) - locStart(ast) <= 0) { + addLeadingComment$2(ast, comment); + return; + } + + if (locEnd(comment) - locEnd(ast) >= 0) { + addTrailingComment$2(ast, comment); + return; + } + } + + decorateComment(ast, comment, options); + const { + precedingNode, + enclosingNode, + followingNode + } = comment; + const pluginHandleOwnLineComment = options.printer.handleComments && options.printer.handleComments.ownLine ? options.printer.handleComments.ownLine : () => false; + const pluginHandleEndOfLineComment = options.printer.handleComments && options.printer.handleComments.endOfLine ? options.printer.handleComments.endOfLine : () => false; + const pluginHandleRemainingComment = options.printer.handleComments && options.printer.handleComments.remaining ? options.printer.handleComments.remaining : () => false; + const isLastComment = comments.length - 1 === i; + + if (hasNewline$2(text, locStart(comment), { + backwards: true + })) { + // If a comment exists on its own line, prefer a leading comment. + // We also need to check if it's the first line of the file. + if (pluginHandleOwnLineComment(comment, text, options, ast, isLastComment)) ; else if (followingNode) { + // Always a leading comment. + addLeadingComment$2(followingNode, comment); + } else if (precedingNode) { + addTrailingComment$2(precedingNode, comment); + } else if (enclosingNode) { + addDanglingComment$2(enclosingNode, comment); + } else { + // There are no nodes, let's attach it to the root of the ast + + /* istanbul ignore next */ + addDanglingComment$2(ast, comment); + } + } else if (hasNewline$2(text, locEnd(comment))) { + if (pluginHandleEndOfLineComment(comment, text, options, ast, isLastComment)) ; else if (precedingNode) { + // There is content before this comment on the same line, but + // none after it, so prefer a trailing comment of the previous node. + addTrailingComment$2(precedingNode, comment); + } else if (followingNode) { + addLeadingComment$2(followingNode, comment); + } else if (enclosingNode) { + addDanglingComment$2(enclosingNode, comment); + } else { + // There are no nodes, let's attach it to the root of the ast + + /* istanbul ignore next */ + addDanglingComment$2(ast, comment); + } + } else { + if (pluginHandleRemainingComment(comment, text, options, ast, isLastComment)) ; else if (precedingNode && followingNode) { + // Otherwise, text exists both before and after the comment on + // the same line. If there is both a preceding and following + // node, use a tie-breaking algorithm to determine if it should + // be attached to the next or previous node. In the last case, + // simply attach the right node; + const tieCount = tiesToBreak.length; + + if (tieCount > 0) { + const lastTie = tiesToBreak[tieCount - 1]; + + if (lastTie.followingNode !== comment.followingNode) { + breakTies(tiesToBreak, text, options); + } + } + + tiesToBreak.push(comment); + } else if (precedingNode) { + addTrailingComment$2(precedingNode, comment); + } else if (followingNode) { + addLeadingComment$2(followingNode, comment); + } else if (enclosingNode) { + addDanglingComment$2(enclosingNode, comment); + } else { + // There are no nodes, let's attach it to the root of the ast + + /* istanbul ignore next */ + addDanglingComment$2(ast, comment); + } + } + }); + breakTies(tiesToBreak, text, options); + comments.forEach(comment => { + // These node references were useful for breaking ties, but we + // don't need them anymore, and they create cycles in the AST that + // may lead to infinite recursion if we don't delete them here. + delete comment.precedingNode; + delete comment.enclosingNode; + delete comment.followingNode; + }); +} + +function breakTies(tiesToBreak, text, options) { + const tieCount = tiesToBreak.length; + + if (tieCount === 0) { + return; + } + + const { + precedingNode, + followingNode, + enclosingNode + } = tiesToBreak[0]; + const gapRegExp = options.printer.getGapRegex && options.printer.getGapRegex(enclosingNode) || /^[\s(]*$/; + let gapEndPos = options.locStart(followingNode); // Iterate backwards through tiesToBreak, examining the gaps + // between the tied comments. In order to qualify as leading, a + // comment must be separated from followingNode by an unbroken series of + // gaps (or other comments). Gaps should only contain whitespace or open + // parentheses. + + let indexOfFirstLeadingComment; + + for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) { + const comment = tiesToBreak[indexOfFirstLeadingComment - 1]; + assert$1.strictEqual(comment.precedingNode, precedingNode); + assert$1.strictEqual(comment.followingNode, followingNode); + const gap = text.slice(options.locEnd(comment), gapEndPos); + + if (gapRegExp.test(gap)) { + gapEndPos = options.locStart(comment); + } else { + // The gap string contained something other than whitespace or open + // parentheses. + break; + } + } + + tiesToBreak.forEach((comment, i) => { + if (i < indexOfFirstLeadingComment) { + addTrailingComment$2(precedingNode, comment); + } else { + addLeadingComment$2(followingNode, comment); + } + }); + tiesToBreak.length = 0; +} + +function printComment(commentPath, options) { + const comment = commentPath.getValue(); + comment.printed = true; + return options.printer.printComment(commentPath, options); +} + +function findExpressionIndexForComment(quasis, comment, options) { + const startPos = options.locStart(comment) - 1; + + for (let i = 1; i < quasis.length; ++i) { + if (startPos < getQuasiRange(quasis[i]).start) { + return i - 1; + } + } // We haven't found it, it probably means that some of the locations are off. + // Let's just return the first one. + + /* istanbul ignore next */ + + + return 0; +} + +function getQuasiRange(expr) { + if (expr.start !== undefined) { + // Babel + return { + start: expr.start, + end: expr.end + }; + } // Flow + + + return { + start: expr.range[0], + end: expr.range[1] + }; +} + +function printLeadingComment(commentPath, print, options) { + const comment = commentPath.getValue(); + const contents = printComment(commentPath, options); + + if (!contents) { + return ""; + } + + const isBlock = options.printer.isBlockComment && options.printer.isBlockComment(comment); // Leading block comments should see if they need to stay on the + // same line or not. + + if (isBlock) { + const lineBreak = hasNewline$2(options.originalText, options.locEnd(comment)) ? hasNewline$2(options.originalText, options.locStart(comment), { + backwards: true + }) ? hardline$1 : line$1 : " "; + return concat$2([contents, lineBreak]); + } + + return concat$2([contents, hardline$1]); +} + +function printTrailingComment(commentPath, print, options) { + const comment = commentPath.getValue(); + const contents = printComment(commentPath, options); + + if (!contents) { + return ""; + } + + const isBlock = options.printer.isBlockComment && options.printer.isBlockComment(comment); // We don't want the line to break + // when the parentParentNode is a ClassDeclaration/-Expression + // And the parentNode is in the superClass property + + const parentNode = commentPath.getNode(1); + const parentParentNode = commentPath.getNode(2); + const isParentSuperClass = parentParentNode && (parentParentNode.type === "ClassDeclaration" || parentParentNode.type === "ClassExpression") && parentParentNode.superClass === parentNode; + + if (hasNewline$2(options.originalText, options.locStart(comment), { + backwards: true + })) { + // This allows comments at the end of nested structures: + // { + // x: 1, + // y: 2 + // // A comment + // } + // Those kinds of comments are almost always leading comments, but + // here it doesn't go "outside" the block and turns it into a + // trailing comment for `2`. We can simulate the above by checking + // if this a comment on its own line; normal trailing comments are + // always at the end of another expression. + const isLineBeforeEmpty = isPreviousLineEmpty$2(options.originalText, comment, options.locStart); + return lineSuffix$1(concat$2([hardline$1, isLineBeforeEmpty ? hardline$1 : "", contents])); + } else if (isBlock || isParentSuperClass) { + // Trailing block comments never need a newline + return concat$2([" ", contents]); + } + + return concat$2([lineSuffix$1(concat$2([" ", contents])), !isBlock ? breakParent$1 : ""]); +} + +function printDanglingComments(path, options, sameIndent, filter) { + const parts = []; + const node = path.getValue(); + + if (!node || !node.comments) { + return ""; + } + + path.each(commentPath => { + const comment = commentPath.getValue(); + + if (comment && !comment.leading && !comment.trailing && (!filter || filter(comment))) { + parts.push(printComment(commentPath, options)); + } + }, "comments"); + + if (parts.length === 0) { + return ""; + } + + if (sameIndent) { + return join$1(hardline$1, parts); + } + + return indent$1(concat$2([hardline$1, join$1(hardline$1, parts)])); +} + +function prependCursorPlaceholder(path, options, printed) { + if (path.getNode() === options.cursorNode && path.getValue()) { + return concat$2([cursor$2, printed, cursor$2]); + } + + return printed; +} + +function printComments(path, print, options, needsSemi) { + const value = path.getValue(); + const printed = print(path); + const comments = value && value.comments; + + if (!comments || comments.length === 0) { + return prependCursorPlaceholder(path, options, printed); + } + + const leadingParts = []; + const trailingParts = [needsSemi ? ";" : "", printed]; + path.each(commentPath => { + const comment = commentPath.getValue(); + const { + leading, + trailing + } = comment; + + if (leading) { + const contents = printLeadingComment(commentPath, print, options); + + if (!contents) { + return; + } + + leadingParts.push(contents); + const text = options.originalText; + const index = skipNewline$2(text, options.locEnd(comment)); + + if (index !== false && hasNewline$2(text, index)) { + leadingParts.push(hardline$1); + } + } else if (trailing) { + trailingParts.push(printTrailingComment(commentPath, print, options)); + } + }, "comments"); + return prependCursorPlaceholder(path, options, concat$2(leadingParts.concat(trailingParts))); +} + +var comments = { + attach, + printComments, + printDanglingComments, + getSortedChildNodes +}; + +function getNodeHelper(path, count) { + const stackIndex = getNodeStackIndexHelper(path.stack, count); + return stackIndex === -1 ? null : path.stack[stackIndex]; +} + +function getNodeStackIndexHelper(stack, count) { + for (let i = stack.length - 1; i >= 0; i -= 2) { + const value = stack[i]; + + if (value && !Array.isArray(value) && --count < 0) { + return i; + } + } + + return -1; +} + +class FastPath { + constructor(value) { + this.stack = [value]; + } // The name of the current property is always the penultimate element of + // this.stack, and always a String. + + + getName() { + const { + stack + } = this; + const { + length + } = stack; + + if (length > 1) { + return stack[length - 2]; + } // Since the name is always a string, null is a safe sentinel value to + // return if we do not know the name of the (root) value. + + /* istanbul ignore next */ + + + return null; + } // The value of the current property is always the final element of + // this.stack. + + + getValue() { + return getLast(this.stack); + } + + getNode(count = 0) { + return getNodeHelper(this, count); + } + + getParentNode(count = 0) { + return getNodeHelper(this, count + 1); + } // Temporarily push properties named by string arguments given after the + // callback function onto this.stack, then call the callback with a + // reference to this (modified) FastPath object. Note that the stack will + // be restored to its original state after the callback is finished, so it + // is probably a mistake to retain a reference to the path. + + + call(callback, ...names) { + const { + stack + } = this; + const { + length + } = stack; + let value = getLast(stack); + + for (const name of names) { + value = value[name]; + stack.push(name, value); + } + + const result = callback(this); + stack.length = length; + return result; + } + + callParent(callback, count = 0) { + const stackIndex = getNodeStackIndexHelper(this.stack, count + 1); + const parentValues = this.stack.splice(stackIndex + 1); + const result = callback(this); + this.stack.push(...parentValues); + return result; + } // Similar to FastPath.prototype.call, except that the value obtained by + // accessing this.getValue()[name1][name2]... should be array-like. The + // callback will be called with a reference to this path object for each + // element of the array. + + + each(callback, ...names) { + const { + stack + } = this; + const { + length + } = stack; + let value = getLast(stack); + + for (const name of names) { + value = value[name]; + stack.push(name, value); + } + + for (let i = 0; i < value.length; ++i) { + if (i in value) { + stack.push(i, value[i]); // If the callback needs to know the value of i, call + // path.getName(), assuming path is the parameter name. + + callback(this); + stack.length -= 2; + } + } + + stack.length = length; + } // Similar to FastPath.prototype.each, except that the results of the + // callback function invocations are stored in an array and returned at + // the end of the iteration. + + + map(callback, ...names) { + const { + stack + } = this; + const { + length + } = stack; + let value = getLast(stack); + + for (const name of names) { + value = value[name]; + stack.push(name, value); + } + + const result = new Array(value.length); + + for (let i = 0; i < value.length; ++i) { + if (i in value) { + stack.push(i, value[i]); + result[i] = callback(this, i); + stack.length -= 2; + } + } + + stack.length = length; + return result; + } + /** + * @param {...( + * | ((node: any, name: string | null, number: number | null) => boolean) + * | undefined + * )} predicates + */ + + + match(...predicates) { + let stackPointer = this.stack.length - 1; + let name = null; + let node = this.stack[stackPointer--]; + + for (const predicate of predicates) { + if (node === undefined) { + return false; + } // skip index/array + + + let number = null; + + if (typeof name === "number") { + number = name; + name = this.stack[stackPointer--]; + node = this.stack[stackPointer--]; + } + + if (predicate && !predicate(node, name, number)) { + return false; + } + + name = this.stack[stackPointer--]; + node = this.stack[stackPointer--]; + } + + return true; + } + +} + +var fastPath = FastPath; + +const { + normalize: normalize$2 +} = options$1; + +function printSubtree(path, print, options, printAstToDoc) { + if (options.printer.embed) { + return options.printer.embed(path, print, (text, partialNextOptions) => textToDoc(text, partialNextOptions, options, printAstToDoc), options); + } +} + +function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc) { + const nextOptions = normalize$2(Object.assign({}, parentOptions, {}, partialNextOptions, { + parentParser: parentOptions.parser, + embeddedInHtml: !!(parentOptions.embeddedInHtml || parentOptions.parser === "html" || parentOptions.parser === "vue" || parentOptions.parser === "angular" || parentOptions.parser === "lwc"), + originalText: text + }), { + passThrough: true + }); + const result = parser.parse(text, nextOptions); + const { + ast + } = result; + text = result.text; + const astComments = ast.comments; + delete ast.comments; + comments.attach(astComments, ast, text, nextOptions); + return printAstToDoc(ast, nextOptions); +} + +var multiparser = { + printSubtree +}; + +const doc = document; +const docBuilders$1 = doc.builders; +const { + concat: concat$3, + hardline: hardline$2, + addAlignmentToDoc: addAlignmentToDoc$1 +} = docBuilders$1; +const docUtils$1 = doc.utils; +/** + * Takes an abstract syntax tree (AST) and recursively converts it to a + * document (series of printing primitives). + * + * This is done by descending down the AST recursively. The recursion + * involves two functions that call each other: + * + * 1. printGenerically(), which is defined as an inner function here. + * It basically takes care of node caching. + * 2. callPluginPrintFunction(), which checks for some options, and + * ultimately calls the print() function provided by the plugin. + * + * The plugin function will call printGenerically() again for child nodes + * of the current node, which will do its housekeeping, then call the + * plugin function again, and so on. + * + * All the while, these functions pass a "path" variable around, which + * is a stack-like data structure (FastPath) that maintains the current + * state of the recursion. It is called "path", because it represents + * the path to the current node through the Abstract Syntax Tree. + */ + +function printAstToDoc(ast, options, alignmentSize = 0) { + const { + printer + } = options; + + if (printer.preprocess) { + ast = printer.preprocess(ast, options); + } + + const cache = new Map(); + + function printGenerically(path, args) { + const node = path.getValue(); + const shouldCache = node && typeof node === "object" && args === undefined; + + if (shouldCache && cache.has(node)) { + return cache.get(node); + } // We let JSXElement print its comments itself because it adds () around + // UnionTypeAnnotation has to align the child without the comments + + + let res; + + if (printer.willPrintOwnComments && printer.willPrintOwnComments(path, options)) { + res = callPluginPrintFunction(path, options, printGenerically, args); + } else { + // printComments will call the plugin print function and check for + // comments to print + res = comments.printComments(path, p => callPluginPrintFunction(p, options, printGenerically, args), options, args && args.needsSemi); + } + + if (shouldCache) { + cache.set(node, res); + } + + return res; + } + + let doc = printGenerically(new fastPath(ast)); + + if (alignmentSize > 0) { + // Add a hardline to make the indents take effect + // It should be removed in index.js format() + doc = addAlignmentToDoc$1(concat$3([hardline$2, doc]), alignmentSize, options.tabWidth); + } + + docUtils$1.propagateBreaks(doc); + return doc; +} + +function callPluginPrintFunction(path, options, printPath, args) { + assert$1.ok(path instanceof fastPath); + const node = path.getValue(); + const { + printer + } = options; // Escape hatch + + if (printer.hasPrettierIgnore && printer.hasPrettierIgnore(path)) { + return options.originalText.slice(options.locStart(node), options.locEnd(node)); + } + + if (node) { + try { + // Potentially switch to a different parser + const sub = multiparser.printSubtree(path, printPath, options, printAstToDoc); + + if (sub) { + return sub; + } + } catch (error) { + /* istanbul ignore if */ + if (process.env.PRETTIER_DEBUG) { + throw error; + } // Continue with current parser + + } + } + + return printer.print(path, options, printPath, args); +} + +var astToDoc = printAstToDoc; + +function findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts) { + let resultStartNode = startNodeAndParents.node; + let resultEndNode = endNodeAndParents.node; + + if (resultStartNode === resultEndNode) { + return { + startNode: resultStartNode, + endNode: resultEndNode + }; + } + + for (const endParent of endNodeAndParents.parentNodes) { + if (endParent.type !== "Program" && endParent.type !== "File" && opts.locStart(endParent) >= opts.locStart(startNodeAndParents.node)) { + resultEndNode = endParent; + } else { + break; + } + } + + for (const startParent of startNodeAndParents.parentNodes) { + if (startParent.type !== "Program" && startParent.type !== "File" && opts.locEnd(startParent) <= opts.locEnd(endNodeAndParents.node)) { + resultStartNode = startParent; + } else { + break; + } + } + + return { + startNode: resultStartNode, + endNode: resultEndNode + }; +} + +function findNodeAtOffset(node, offset, options, predicate, parentNodes) { + predicate = predicate || (() => true); + + parentNodes = parentNodes || []; + const start = options.locStart(node, options.locStart); + const end = options.locEnd(node, options.locEnd); + + if (start <= offset && offset <= end) { + for (const childNode of comments.getSortedChildNodes(node, options)) { + const childResult = findNodeAtOffset(childNode, offset, options, predicate, [node].concat(parentNodes)); + + if (childResult) { + return childResult; + } + } + + if (predicate(node)) { + return { + node, + parentNodes + }; + } + } +} // See https://www.ecma-international.org/ecma-262/5.1/#sec-A.5 + + +function isSourceElement(opts, node) { + if (node == null) { + return false; + } // JS and JS like to avoid repetitions + + + const jsSourceElements = ["FunctionDeclaration", "BlockStatement", "BreakStatement", "ContinueStatement", "DebuggerStatement", "DoWhileStatement", "EmptyStatement", "ExpressionStatement", "ForInStatement", "ForStatement", "IfStatement", "LabeledStatement", "ReturnStatement", "SwitchStatement", "ThrowStatement", "TryStatement", "VariableDeclaration", "WhileStatement", "WithStatement", "ClassDeclaration", // ES 2015 + "ImportDeclaration", // Module + "ExportDefaultDeclaration", // Module + "ExportNamedDeclaration", // Module + "ExportAllDeclaration", // Module + "TypeAlias", // Flow + "InterfaceDeclaration", // Flow, TypeScript + "TypeAliasDeclaration", // TypeScript + "ExportAssignment", // TypeScript + "ExportDeclaration" // TypeScript + ]; + const jsonSourceElements = ["ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral"]; + const graphqlSourceElements = ["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]; + + switch (opts.parser) { + case "flow": + case "babel": + case "babel-flow": + case "babel-ts": + case "typescript": + return jsSourceElements.includes(node.type); + + case "json": + return jsonSourceElements.includes(node.type); + + case "graphql": + return graphqlSourceElements.includes(node.kind); + + case "vue": + return node.tag !== "root"; + } + + return false; +} + +function calculateRange(text, opts, ast) { + // Contract the range so that it has non-whitespace characters at its endpoints. + // This ensures we can format a range that doesn't end on a node. + const rangeStringOrig = text.slice(opts.rangeStart, opts.rangeEnd); + const startNonWhitespace = Math.max(opts.rangeStart + rangeStringOrig.search(/\S/), opts.rangeStart); + let endNonWhitespace; + + for (endNonWhitespace = opts.rangeEnd; endNonWhitespace > opts.rangeStart; --endNonWhitespace) { + if (text[endNonWhitespace - 1].match(/\S/)) { + break; + } + } + + const startNodeAndParents = findNodeAtOffset(ast, startNonWhitespace, opts, node => isSourceElement(opts, node)); + const endNodeAndParents = findNodeAtOffset(ast, endNonWhitespace, opts, node => isSourceElement(opts, node)); + + if (!startNodeAndParents || !endNodeAndParents) { + return { + rangeStart: 0, + rangeEnd: 0 + }; + } + + const siblingAncestors = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts); + const { + startNode, + endNode + } = siblingAncestors; + const rangeStart = Math.min(opts.locStart(startNode, opts.locStart), opts.locStart(endNode, opts.locStart)); + const rangeEnd = Math.max(opts.locEnd(startNode, opts.locEnd), opts.locEnd(endNode, opts.locEnd)); + return { + rangeStart, + rangeEnd + }; +} + +var rangeUtil = { + calculateRange, + findNodeAtOffset +}; + +var require$$0 = getCjsExportFromNamespace(index_es6); + +const normalizeOptions$1 = options$1.normalize; +const { + guessEndOfLine: guessEndOfLine$1, + convertEndOfLineToChars: convertEndOfLineToChars$2 +} = endOfLine; +const { + printer: { + printDocToString: printDocToString$1 + }, + debug: { + printDocToDebug + } +} = document; +const BOM = "\uFEFF"; +const CURSOR = Symbol("cursor"); +const PLACEHOLDERS = { + cursorOffset: "<<>>", + rangeStart: "<<>>", + rangeEnd: "<<>>" +}; + +function ensureAllCommentsPrinted(astComments) { + if (!astComments) { + return; + } + + for (let i = 0; i < astComments.length; ++i) { + if (util$1.isNodeIgnoreComment(astComments[i])) { + // If there's a prettier-ignore, we're not printing that sub-tree so we + // don't know if the comments was printed or not. + return; + } + } + + astComments.forEach(comment => { + if (!comment.printed) { + throw new Error('Comment "' + comment.value.trim() + '" was not printed. Please report this error!'); + } + + delete comment.printed; + }); +} + +function attachComments(text, ast, opts) { + const astComments = ast.comments; + + if (astComments) { + delete ast.comments; + comments.attach(astComments, ast, text, opts); + } + + ast.tokens = []; + opts.originalText = opts.parser === "yaml" ? text : text.trimEnd(); + return astComments; +} + +function coreFormat(text, opts, addAlignmentSize) { + if (!text || !text.trim().length) { + return { + formatted: "", + cursorOffset: 0 + }; + } + + addAlignmentSize = addAlignmentSize || 0; + const parsed = parser.parse(text, opts); + const { + ast + } = parsed; + text = parsed.text; + + if (opts.cursorOffset >= 0) { + const nodeResult = rangeUtil.findNodeAtOffset(ast, opts.cursorOffset, opts); + + if (nodeResult && nodeResult.node) { + opts.cursorNode = nodeResult.node; + } + } + + const astComments = attachComments(text, ast, opts); + const doc = astToDoc(ast, opts, addAlignmentSize); + const result = printDocToString$1(doc, opts); + ensureAllCommentsPrinted(astComments); // Remove extra leading indentation as well as the added indentation after last newline + + if (addAlignmentSize > 0) { + const trimmed = result.formatted.trim(); + + if (result.cursorNodeStart !== undefined) { + result.cursorNodeStart -= result.formatted.indexOf(trimmed); + } + + result.formatted = trimmed + convertEndOfLineToChars$2(opts.endOfLine); + } + + if (opts.cursorOffset >= 0) { + let oldCursorNodeStart; + let oldCursorNodeText; + let cursorOffsetRelativeToOldCursorNode; + let newCursorNodeStart; + let newCursorNodeText; + + if (opts.cursorNode && result.cursorNodeText) { + oldCursorNodeStart = opts.locStart(opts.cursorNode); + oldCursorNodeText = text.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode)); + cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart; + newCursorNodeStart = result.cursorNodeStart; + newCursorNodeText = result.cursorNodeText; + } else { + oldCursorNodeStart = 0; + oldCursorNodeText = text; + cursorOffsetRelativeToOldCursorNode = opts.cursorOffset; + newCursorNodeStart = 0; + newCursorNodeText = result.formatted; + } + + if (oldCursorNodeText === newCursorNodeText) { + return { + formatted: result.formatted, + cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode + }; + } // diff old and new cursor node texts, with a special cursor + // symbol inserted to find out where it moves to + + + const oldCursorNodeCharArray = oldCursorNodeText.split(""); + oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR); + const newCursorNodeCharArray = newCursorNodeText.split(""); + const cursorNodeDiff = require$$0.diffArrays(oldCursorNodeCharArray, newCursorNodeCharArray); + let cursorOffset = newCursorNodeStart; + + for (const entry of cursorNodeDiff) { + if (entry.removed) { + if (entry.value.includes(CURSOR)) { + break; + } + } else { + cursorOffset += entry.count; + } + } + + return { + formatted: result.formatted, + cursorOffset + }; + } + + return { + formatted: result.formatted + }; +} + +function formatRange(text, opts) { + const parsed = parser.parse(text, opts); + const { + ast + } = parsed; + text = parsed.text; + const range = rangeUtil.calculateRange(text, opts, ast); + const { + rangeStart, + rangeEnd + } = range; + const rangeString = text.slice(rangeStart, rangeEnd); // Try to extend the range backwards to the beginning of the line. + // This is so we can detect indentation correctly and restore it. + // Use `Math.min` since `lastIndexOf` returns 0 when `rangeStart` is 0 + + const rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1); + const indentString = text.slice(rangeStart2, rangeStart); + const alignmentSize = util$1.getAlignmentSize(indentString, opts.tabWidth); + const rangeResult = coreFormat(rangeString, Object.assign({}, opts, { + rangeStart: 0, + rangeEnd: Infinity, + // track the cursor offset only if it's within our range + cursorOffset: opts.cursorOffset >= rangeStart && opts.cursorOffset < rangeEnd ? opts.cursorOffset - rangeStart : -1 + }), alignmentSize); // Since the range contracts to avoid trailing whitespace, + // we need to remove the newline that was inserted by the `format` call. + + const rangeTrimmed = rangeResult.formatted.trimEnd(); + const rangeLeft = text.slice(0, rangeStart); + const rangeRight = text.slice(rangeEnd); + let { + cursorOffset + } = opts; + + if (opts.cursorOffset >= rangeEnd) { + // handle the case where the cursor was past the end of the range + cursorOffset = opts.cursorOffset - rangeEnd + (rangeStart + rangeTrimmed.length); + } else if (rangeResult.cursorOffset !== undefined) { + // handle the case where the cursor was in the range + cursorOffset = rangeResult.cursorOffset + rangeStart; + } // keep the cursor as it was if it was before the start of the range + + + let formatted; + + if (opts.endOfLine === "lf") { + formatted = rangeLeft + rangeTrimmed + rangeRight; + } else { + const eol = convertEndOfLineToChars$2(opts.endOfLine); + + if (cursorOffset >= 0) { + const parts = [rangeLeft, rangeTrimmed, rangeRight]; + let partIndex = 0; + let partOffset = cursorOffset; + + while (partIndex < parts.length) { + const part = parts[partIndex]; + + if (partOffset < part.length) { + parts[partIndex] = parts[partIndex].slice(0, partOffset) + PLACEHOLDERS.cursorOffset + parts[partIndex].slice(partOffset); + break; + } + + partIndex++; + partOffset -= part.length; + } + + const [newRangeLeft, newRangeTrimmed, newRangeRight] = parts; + formatted = (newRangeLeft.replace(/\n/g, eol) + newRangeTrimmed + newRangeRight.replace(/\n/g, eol)).replace(PLACEHOLDERS.cursorOffset, (_, index) => { + cursorOffset = index; + return ""; + }); + } else { + formatted = rangeLeft.replace(/\n/g, eol) + rangeTrimmed + rangeRight.replace(/\n/g, eol); + } + } + + return { + formatted, + cursorOffset + }; +} + +function format(text, opts) { + const selectedParser = parser.resolveParser(opts); + const hasPragma = !selectedParser.hasPragma || selectedParser.hasPragma(text); + + if (opts.requirePragma && !hasPragma) { + return { + formatted: text + }; + } + + if (opts.endOfLine === "auto") { + opts.endOfLine = guessEndOfLine$1(text); + } + + const hasCursor = opts.cursorOffset >= 0; + const hasRangeStart = opts.rangeStart > 0; + const hasRangeEnd = opts.rangeEnd < text.length; // get rid of CR/CRLF parsing + + if (text.includes("\r")) { + const offsetKeys = [hasCursor && "cursorOffset", hasRangeStart && "rangeStart", hasRangeEnd && "rangeEnd"].filter(Boolean).sort((aKey, bKey) => opts[aKey] - opts[bKey]); + + for (let i = offsetKeys.length - 1; i >= 0; i--) { + const key = offsetKeys[i]; + text = text.slice(0, opts[key]) + PLACEHOLDERS[key] + text.slice(opts[key]); + } + + text = text.replace(/\r\n?/g, "\n"); + + for (let i = 0; i < offsetKeys.length; i++) { + const key = offsetKeys[i]; + text = text.replace(PLACEHOLDERS[key], (_, index) => { + opts[key] = index; + return ""; + }); + } + } + + const hasUnicodeBOM = text.charAt(0) === BOM; + + if (hasUnicodeBOM) { + text = text.slice(1); + + if (hasCursor) { + opts.cursorOffset++; + } + + if (hasRangeStart) { + opts.rangeStart++; + } + + if (hasRangeEnd) { + opts.rangeEnd++; + } + } + + if (!hasCursor) { + opts.cursorOffset = -1; + } + + if (opts.rangeStart < 0) { + opts.rangeStart = 0; + } + + if (opts.rangeEnd > text.length) { + opts.rangeEnd = text.length; + } + + const result = hasRangeStart || hasRangeEnd ? formatRange(text, opts) : coreFormat(opts.insertPragma && opts.printer.insertPragma && !hasPragma ? opts.printer.insertPragma(text) : text, opts); + + if (hasUnicodeBOM) { + result.formatted = BOM + result.formatted; + + if (hasCursor) { + result.cursorOffset++; + } + } + + return result; +} + +var core = { + formatWithCursor(text, opts) { + opts = normalizeOptions$1(opts); + return format(text, opts); + }, + + parse(text, opts, massage) { + opts = normalizeOptions$1(opts); + + if (text.includes("\r")) { + text = text.replace(/\r\n?/g, "\n"); + } + + const parsed = parser.parse(text, opts); + + if (massage) { + parsed.ast = massageAst(parsed.ast, opts); + } + + return parsed; + }, + + formatAST(ast, opts) { + opts = normalizeOptions$1(opts); + const doc = astToDoc(ast, opts); + return printDocToString$1(doc, opts); + }, + + // Doesn't handle shebang for now + formatDoc(doc, opts) { + const debug = printDocToDebug(doc); + opts = normalizeOptions$1(Object.assign({}, opts, { + parser: "babel" + })); + return format(debug, opts).formatted; + }, + + printToDoc(text, opts) { + opts = normalizeOptions$1(opts); + const parsed = parser.parse(text, opts); + const { + ast + } = parsed; + text = parsed.text; + attachComments(text, ast, opts); + return astToDoc(ast, opts); + }, + + printDocToString(doc, opts) { + return printDocToString$1(doc, normalizeOptions$1(opts)); + } + +}; + +// A simple implementation of make-array +function make_array(subject) { + return Array.isArray(subject) ? subject : [subject]; +} + +const REGEX_BLANK_LINE = /^\s+$/; +const REGEX_LEADING_EXCAPED_EXCLAMATION = /^\\!/; +const REGEX_LEADING_EXCAPED_HASH = /^\\#/; +const SLASH = '/'; +const KEY_IGNORE = typeof Symbol !== 'undefined' ? Symbol.for('node-ignore') +/* istanbul ignore next */ +: 'node-ignore'; + +const define = (object, key, value) => Object.defineProperty(object, key, { + value +}); + +const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g; // Sanitize the range of a regular expression +// The cases are complicated, see test cases for details + +const sanitizeRange = range => range.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match // Invalid range (out of order) which is ok for gitignore rules but +// fatal for JavaScript regular expression, so eliminate it. +: ''); // > If the pattern ends with a slash, +// > it is removed for the purpose of the following description, +// > but it would only find a match with a directory. +// > In other words, foo/ will match a directory foo and paths underneath it, +// > but will not match a regular file or a symbolic link foo +// > (this is consistent with the way how pathspec works in general in Git). +// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' +// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call +// you could use option `mark: true` with `glob` +// '`foo/`' should not continue with the '`..`' + + +const DEFAULT_REPLACER_PREFIX = [// > Trailing spaces are ignored unless they are quoted with backslash ("\") +[// (a\ ) -> (a ) +// (a ) -> (a) +// (a \ ) -> (a ) +/\\?\s+$/, match => match.indexOf('\\') === 0 ? ' ' : ''], // replace (\ ) with ' ' +[/\\\s/g, () => ' '], // Escape metacharacters +// which is written down by users but means special for regular expressions. +// > There are 12 characters with special meanings: +// > - the backslash \, +// > - the caret ^, +// > - the dollar sign $, +// > - the period or dot ., +// > - the vertical bar or pipe symbol |, +// > - the question mark ?, +// > - the asterisk or star *, +// > - the plus sign +, +// > - the opening parenthesis (, +// > - the closing parenthesis ), +// > - and the opening square bracket [, +// > - the opening curly brace {, +// > These special characters are often called "metacharacters". +[/[\\^$.|*+(){]/g, match => `\\${match}`], [// > [abc] matches any character inside the brackets +// > (in this case a, b, or c); +/\[([^\]/]*)($|\])/g, (match, p1, p2) => p2 === ']' ? `[${sanitizeRange(p1)}]` : `\\${match}`], [// > a question mark (?) matches a single character +/(?!\\)\?/g, () => '[^/]'], // leading slash +[// > A leading slash matches the beginning of the pathname. +// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". +// A leading slash matches the beginning of the pathname +/^\//, () => '^'], // replace special metacharacter slash after the leading slash +[/\//g, () => '\\/'], [// > A leading "**" followed by a slash means match in all directories. +// > For example, "**/foo" matches file or directory "foo" anywhere, +// > the same as pattern "foo". +// > "**/foo/bar" matches file or directory "bar" anywhere that is directly +// > under directory "foo". +// Notice that the '*'s have been replaced as '\\*' +/^\^*\\\*\\\*\\\//, // '**/foo' <-> 'foo' +() => '^(?:.*\\/)?']]; +const DEFAULT_REPLACER_SUFFIX = [// starting +[// there will be no leading '/' +// (which has been replaced by section "leading slash") +// If starts with '**', adding a '^' to the regular expression also works +/^(?=[^^])/, function startingReplacer() { + return !/\/(?!$)/.test(this) // > If the pattern does not contain a slash /, + // > Git treats it as a shell glob pattern + // Actually, if there is only a trailing slash, + // git also treats it as a shell glob pattern + ? '(?:^|\\/)' // > Otherwise, Git treats the pattern as a shell glob suitable for + // > consumption by fnmatch(3) + : '^'; +}], // two globstars +[// Use lookahead assertions so that we could match more than one `'/**'` +/\\\/\\\*\\\*(?=\\\/|$)/g, // Zero, one or several directories +// should not use '*', or it will be replaced by the next replacer +// Check if it is not the last `'/**'` +(match, index, str) => index + 6 < str.length // case: /**/ +// > A slash followed by two consecutive asterisks then a slash matches +// > zero or more directories. +// > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. +// '/**/' +? '(?:\\/[^\\/]+)*' // case: /** +// > A trailing `"/**"` matches everything inside. +// #21: everything inside but it should not include the current folder +: '\\/.+'], // intermediate wildcards +[// Never replace escaped '*' +// ignore rule '\*' will match the path '*' +// 'abc.*/' -> go +// 'abc.*' -> skip this rule +/(^|[^\\]+)\\\*(?=.+)/g, // '*.js' matches '.js' +// '*.js' doesn't match 'abc' +(match, p1) => `${p1}[^\\/]*`], // trailing wildcard +[/(\^|\\\/)?\\\*$/, (match, p1) => { + const prefix = p1 // '\^': + // '/*' does not match '' + // '/*' does not match everything + // '\\\/': + // 'abc/*' does not match 'abc/' + ? `${p1}[^/]+` // 'a*' matches 'a' + // 'a*' matches 'aa' + : '[^/]*'; + return `${prefix}(?=$|\\/$)`; +}], [// unescape +/\\\\\\/g, () => '\\']]; +const POSITIVE_REPLACERS = [...DEFAULT_REPLACER_PREFIX, // 'f' +// matches +// - /f(end) +// - /f/ +// - (start)f(end) +// - (start)f/ +// doesn't match +// - oof +// - foo +// pseudo: +// -> (^|/)f(/|$) +// ending +[// 'js' will not match 'js.' +// 'ab' will not match 'abc' +/(?:[^*/])$/, // 'js*' will not match 'a.js' +// 'js/' will not match 'a.js' +// 'js' will match 'a.js' and 'a.js/' +match => `${match}(?=$|\\/)`], ...DEFAULT_REPLACER_SUFFIX]; +const NEGATIVE_REPLACERS = [...DEFAULT_REPLACER_PREFIX, // #24, #38 +// The MISSING rule of [gitignore docs](https://git-scm.com/docs/gitignore) +// A negative pattern without a trailing wildcard should not +// re-include the things inside that directory. +// eg: +// ['node_modules/*', '!node_modules'] +// should ignore `node_modules/a.js` +[/(?:[^*])$/, match => `${match}(?=$|\\/$)`], ...DEFAULT_REPLACER_SUFFIX]; // A simple cache, because an ignore rule only has only one certain meaning + +const cache = Object.create(null); // @param {pattern} + +const make_regex = (pattern, negative, ignorecase) => { + const r = cache[pattern]; + + if (r) { + return r; + } + + const replacers = negative ? NEGATIVE_REPLACERS : POSITIVE_REPLACERS; + const source = replacers.reduce((prev, current) => prev.replace(current[0], current[1].bind(pattern)), pattern); + return cache[pattern] = ignorecase ? new RegExp(source, 'i') : new RegExp(source); +}; // > A blank line matches no files, so it can serve as a separator for readability. + + +const checkPattern = pattern => pattern && typeof pattern === 'string' && !REGEX_BLANK_LINE.test(pattern) // > A line starting with # serves as a comment. +&& pattern.indexOf('#') !== 0; + +const createRule = (pattern, ignorecase) => { + const origin = pattern; + let negative = false; // > An optional prefix "!" which negates the pattern; + + if (pattern.indexOf('!') === 0) { + negative = true; + pattern = pattern.substr(1); + } + + pattern = pattern // > Put a backslash ("\") in front of the first "!" for patterns that + // > begin with a literal "!", for example, `"\!important!.txt"`. + .replace(REGEX_LEADING_EXCAPED_EXCLAMATION, '!') // > Put a backslash ("\") in front of the first hash for patterns that + // > begin with a hash. + .replace(REGEX_LEADING_EXCAPED_HASH, '#'); + const regex = make_regex(pattern, negative, ignorecase); + return { + origin, + pattern, + negative, + regex + }; +}; + +class IgnoreBase { + constructor({ + ignorecase = true + } = {}) { + this._rules = []; + this._ignorecase = ignorecase; + define(this, KEY_IGNORE, true); + + this._initCache(); + } + + _initCache() { + this._cache = Object.create(null); + } // @param {Array.|string|Ignore} pattern + + + add(pattern) { + this._added = false; + + if (typeof pattern === 'string') { + pattern = pattern.split(/\r?\n/g); + } + + make_array(pattern).forEach(this._addPattern, this); // Some rules have just added to the ignore, + // making the behavior changed. + + if (this._added) { + this._initCache(); + } + + return this; + } // legacy + + + addPattern(pattern) { + return this.add(pattern); + } + + _addPattern(pattern) { + // #32 + if (pattern && pattern[KEY_IGNORE]) { + this._rules = this._rules.concat(pattern._rules); + this._added = true; + return; + } + + if (checkPattern(pattern)) { + const rule = createRule(pattern, this._ignorecase); + this._added = true; + + this._rules.push(rule); + } + } + + filter(paths) { + return make_array(paths).filter(path => this._filter(path)); + } + + createFilter() { + return path => this._filter(path); + } + + ignores(path) { + return !this._filter(path); + } // @returns `Boolean` true if the `path` is NOT ignored + + + _filter(path, slices) { + if (!path) { + return false; + } + + if (path in this._cache) { + return this._cache[path]; + } + + if (!slices) { + // path/to/a.js + // ['path', 'to', 'a.js'] + slices = path.split(SLASH); + } + + slices.pop(); + return this._cache[path] = slices.length // > It is not possible to re-include a file if a parent directory of + // > that file is excluded. + // If the path contains a parent directory, check the parent first + ? this._filter(slices.join(SLASH) + SLASH, slices) && this._test(path) // Or only test the path + : this._test(path); + } // @returns {Boolean} true if a file is NOT ignored + + + _test(path) { + // Explicitly define variable type by setting matched to `0` + let matched = 0; + + this._rules.forEach(rule => { + // if matched = true, then we only test negative rules + // if matched = false, then we test non-negative rules + if (!(matched ^ rule.negative)) { + matched = rule.negative ^ rule.regex.test(path); + } + }); + + return !matched; + } + +} // Windows +// -------------------------------------------------------------- + +/* istanbul ignore if */ + + +if ( // Detect `process` so that it can run in browsers. +typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === 'win32')) { + const filter = IgnoreBase.prototype._filter; + /* eslint no-control-regex: "off" */ + + const make_posix = str => /^\\\\\?\\/.test(str) || /[^\x00-\x80]+/.test(str) ? str : str.replace(/\\/g, '/'); + + IgnoreBase.prototype._filter = function filterWin32(path, slices) { + path = make_posix(path); + return filter.call(this, path, slices); + }; +} + +var ignore = options => new IgnoreBase(options); + +/** + * @param {string} filename + * @returns {Promise} + */ + + +function getFileContentOrNull(filename) { + return new Promise((resolve, reject) => { + fs$3.readFile(filename, "utf8", (error, data) => { + if (error && error.code !== "ENOENT") { + reject(createError(filename, error)); + } else { + resolve(error ? null : data); + } + }); + }); +} +/** + * @param {string} filename + * @returns {null | string} + */ + + +getFileContentOrNull.sync = function (filename) { + try { + return fs$3.readFileSync(filename, "utf8"); + } catch (error) { + if (error && error.code === "ENOENT") { + return null; + } + + throw createError(filename, error); + } +}; + +function createError(filename, error) { + return new Error(`Unable to read ${filename}: ${error.message}`); +} + +var getFileContentOrNull_1 = getFileContentOrNull; + +/** + * @param {undefined | string} ignorePath + * @param {undefined | boolean} withNodeModules + */ + + +async function createIgnorer(ignorePath, withNodeModules) { + const ignoreContent = ignorePath ? await getFileContentOrNull_1(path$2.resolve(ignorePath)) : null; + return _createIgnorer(ignoreContent, withNodeModules); +} +/** + * @param {undefined | string} ignorePath + * @param {undefined | boolean} withNodeModules + */ + + +createIgnorer.sync = function (ignorePath, withNodeModules) { + const ignoreContent = !ignorePath ? null : getFileContentOrNull_1.sync(path$2.resolve(ignorePath)); + return _createIgnorer(ignoreContent, withNodeModules); +}; +/** + * @param {null | string} ignoreContent + * @param {undefined | boolean} withNodeModules + */ + + +function _createIgnorer(ignoreContent, withNodeModules) { + const ignorer = ignore().add(ignoreContent || ""); + + if (!withNodeModules) { + ignorer.add("node_modules"); + } + + return ignorer; +} + +var createIgnorer_1 = createIgnorer; + +var thirdParty = require("./third-party"); + +var concatMap = function (xs, fn) { + var res = []; + + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x);else res.push(x); + } + + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +var balancedMatch = balanced; + +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + var r = range(a, b, str); + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; + +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [begs.pop(), bi]; + } else { + beg = begs.pop(); + + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [left, right]; + } + } + + return result; +} + +var braceExpansion = expandTop; +var escSlash = '\0SLASH' + Math.random() + '\0'; +var escOpen = '\0OPEN' + Math.random() + '\0'; +var escClose = '\0CLOSE' + Math.random() + '\0'; +var escComma = '\0COMMA' + Math.random() + '\0'; +var escPeriod = '\0PERIOD' + Math.random() + '\0'; + +function numeric$1(str) { + return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash).split('\\{').join(escOpen).split('\\}').join(escClose).split('\\,').join(escComma).split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\').split(escOpen).join('{').split(escClose).join('}').split(escComma).join(',').split(escPeriod).join('.'); +} // Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} + + +function parseCommaParts(str) { + if (!str) return ['']; + var parts = []; + var m = balancedMatch('{', '}', str); + if (!m) return str.split(','); + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + p[p.length - 1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + + if (post.length) { + p[p.length - 1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + return parts; +} + +function expandTop(str) { + if (!str) return []; // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function embrace(str) { + return '{' + str + '}'; +} + +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} + +function gte$1(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + var m = balancedMatch('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + + return [str]; + } + + var n; + + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + + if (n.length === 1) { + var post = m.post.length ? expand(m.post, false) : ['']; + return post.map(function (p) { + return m.pre + n[0] + p; + }); + } + } + } // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + // no need to expand pre, since it is guaranteed to be free of brace-sets + + + var pre = m.pre; + var post = m.post.length ? expand(m.post, false) : ['']; + var N; + + if (isSequence) { + var x = numeric$1(n[0]); + var y = numeric$1(n[1]); + var width = Math.max(n[0].length, n[1].length); + var incr = n.length == 3 ? Math.abs(numeric$1(n[2])) : 1; + var test = lte; + var reverse = y < x; + + if (reverse) { + incr *= -1; + test = gte$1; + } + + var pad = n.some(isPadded); + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') c = ''; + } else { + c = String(i); + + if (pad) { + var need = width - c.length; + + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) c = '-' + z + c.slice(1);else c = z + c; + } + } + } + + N.push(c); + } + } else { + N = concatMap(n, function (el) { + return expand(el, false); + }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) expansions.push(expansion); + } + } + + return expansions; +} + +var minimatch_1 = minimatch; +minimatch.Minimatch = Minimatch; +var path = { + sep: '/' +}; + +try { + path = path$2; +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}; +var plTypes = { + '!': { + open: '(?:(?!(?:', + close: '))[^/]*?)' + }, + '?': { + open: '(?:', + close: ')?' + }, + '+': { + open: '(?:', + close: ')+' + }, + '*': { + open: '(?:', + close: ')*' + }, + '@': { + open: '(?:', + close: ')' + } +}; // any single thing other than / +// don't need to escape / when using new RegExp() + +var qmark = '[^/]'; // * => any number of characters + +var star = qmark + '*?'; // ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. + +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'; // not a ^ or / followed by a dot, +// followed by anything, any number of times. + +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'; // characters that need to be escaped in RegExp. + +var reSpecials = charSet('().*{}+?[]^$\\!'); // "abc" -> { a:true, b:true, c:true } + +function charSet(s) { + return s.split('').reduce(function (set, c) { + set[c] = true; + return set; + }, {}); +} // normalizes slashes. + + +var slashSplit = /\/+/; +minimatch.filter = filter; + +function filter(pattern, options) { + options = options || {}; + return function (p, i, list) { + return minimatch(p, pattern, options); + }; +} + +function ext(a, b) { + a = a || {}; + b = b || {}; + var t = {}; + Object.keys(b).forEach(function (k) { + t[k] = b[k]; + }); + Object.keys(a).forEach(function (k) { + t[k] = a[k]; + }); + return t; +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch; + var orig = minimatch; + + var m = function minimatch(p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)); + }; + + m.Minimatch = function Minimatch(pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)); + }; + + return m; +}; + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch; + return minimatch.defaults(def).Minimatch; +}; + +function minimatch(p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required'); + } + + if (!options) options = {}; // shortcut: comments match nothing. + + if (!options.nocomment && pattern.charAt(0) === '#') { + return false; + } // "" only matches "" + + + if (pattern.trim() === '') return p === ''; + return new Minimatch(pattern, options).match(p); +} + +function Minimatch(pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options); + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required'); + } + + if (!options) options = {}; + pattern = pattern.trim(); // windows support: need to use /, not \ + + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/'); + } + + this.options = options; + this.set = []; + this.pattern = pattern; + this.regexp = null; + this.negate = false; + this.comment = false; + this.empty = false; // make the set of regexps etc. + + this.make(); +} + +Minimatch.prototype.debug = function () {}; + +Minimatch.prototype.make = make; + +function make() { + // don't do it more than once. + if (this._made) return; + var pattern = this.pattern; + var options = this.options; // empty patterns and comments match nothing. + + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true; + return; + } + + if (!pattern) { + this.empty = true; + return; + } // step 1: figure out negation, etc. + + + this.parseNegate(); // step 2: expand braces + + var set = this.globSet = this.braceExpand(); + if (options.debug) this.debug = console.error; + this.debug(this.pattern, set); // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + + set = this.globParts = set.map(function (s) { + return s.split(slashSplit); + }); + this.debug(this.pattern, set); // glob --> regexps + + set = set.map(function (s, si, set) { + return s.map(this.parse, this); + }, this); + this.debug(this.pattern, set); // filter out everything that didn't compile properly. + + set = set.filter(function (s) { + return s.indexOf(false) === -1; + }); + this.debug(this.pattern, set); + this.set = set; +} + +Minimatch.prototype.parseNegate = parseNegate; + +function parseNegate() { + var pattern = this.pattern; + var negate = false; + var options = this.options; + var negateOffset = 0; + if (options.nonegate) return; + + for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === '!'; i++) { + negate = !negate; + negateOffset++; + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset); + this.negate = negate; +} // Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c + + +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options); +}; + +Minimatch.prototype.braceExpand = braceExpand; + +function braceExpand(pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options; + } else { + options = {}; + } + } + + pattern = typeof pattern === 'undefined' ? this.pattern : pattern; + + if (typeof pattern === 'undefined') { + throw new TypeError('undefined pattern'); + } + + if (options.nobrace || !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern]; + } + + return braceExpansion(pattern); +} // parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. + + +Minimatch.prototype.parse = parse$1; +var SUBPARSE = {}; + +function parse$1(pattern, isSub) { + if (pattern.length > 1024 * 64) { + throw new TypeError('pattern is too long'); + } + + var options = this.options; // shortcuts + + if (!options.noglobstar && pattern === '**') return GLOBSTAR; + if (pattern === '') return ''; + var re = ''; + var hasMagic = !!options.nocase; + var escaping = false; // ? => one single character + + var patternListStack = []; + var negativeLists = []; + var stateChar; + var inClass = false; + var reClassStart = -1; + var classStart = -1; // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' : '(?!\\.)'; + var self = this; + + function clearStateChar() { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star; + hasMagic = true; + break; + + case '?': + re += qmark; + hasMagic = true; + break; + + default: + re += '\\' + stateChar; + break; + } + + self.debug('clearStateChar %j %j', stateChar, re); + stateChar = false; + } + } + + for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c); // skip over any that are escaped. + + if (escaping && reSpecials[c]) { + re += '\\' + c; + escaping = false; + continue; + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false; + + case '\\': + clearStateChar(); + escaping = true; + continue; + // the various stateChar values + // for the "extglob" stuff. + + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c); // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + + if (inClass) { + this.debug(' in class'); + if (c === '!' && i === classStart + 1) c = '^'; + re += c; + continue; + } // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + + + self.debug('call clearStateChar %j', stateChar); + clearStateChar(); + stateChar = c; // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + + if (options.noext) clearStateChar(); + continue; + + case '(': + if (inClass) { + re += '('; + continue; + } + + if (!stateChar) { + re += '\\('; + continue; + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }); // negation is (?:(?!js)[^/]*) + + re += stateChar === '!' ? '(?:(?!(?:' : '(?:'; + this.debug('plType %j %j', stateChar, re); + stateChar = false; + continue; + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)'; + continue; + } + + clearStateChar(); + hasMagic = true; + var pl = patternListStack.pop(); // negation is (?:(?!js)[^/]*) + // The others are (?:) + + re += pl.close; + + if (pl.type === '!') { + negativeLists.push(pl); + } + + pl.reEnd = re.length; + continue; + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|'; + escaping = false; + continue; + } + + clearStateChar(); + re += '|'; + continue; + // these are mostly the same in regexp and glob + + case '[': + // swallow any state-tracking char before the [ + clearStateChar(); + + if (inClass) { + re += '\\' + c; + continue; + } + + inClass = true; + classStart = i; + reClassStart = re.length; + re += c; + continue; + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c; + escaping = false; + continue; + } // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + + + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i); + + try { + RegExp('[' + cs + ']'); + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE); + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'; + hasMagic = hasMagic || sp[1]; + inClass = false; + continue; + } + } // finish up the class. + + + hasMagic = true; + inClass = false; + re += c; + continue; + + default: + // swallow any state char that wasn't consumed + clearStateChar(); + + if (escaping) { + // no need + escaping = false; + } else if (reSpecials[c] && !(c === '^' && inClass)) { + re += '\\'; + } + + re += c; + } // switch + + } // for + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + + + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1); + sp = this.parse(cs, SUBPARSE); + re = re.substr(0, reClassStart) + '\\[' + sp[0]; + hasMagic = hasMagic || sp[1]; + } // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + + + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length); + this.debug('setting tail', re, pl); // maybe some even number of \, then maybe 1 \, followed by a | + + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\'; + } // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + + + return $1 + $1 + $2 + '|'; + }); + this.debug('tail=%j\n %s', tail, tail, pl, re); + var t = pl.type === '*' ? star : pl.type === '?' ? qmark : '\\' + pl.type; + hasMagic = true; + re = re.slice(0, pl.reStart) + t + '\\(' + tail; + } // handle trailing things that only matter at the very end. + + + clearStateChar(); + + if (escaping) { + // trailing \\ + re += '\\\\'; + } // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + + + var addPatternStart = false; + + switch (re.charAt(0)) { + case '.': + case '[': + case '(': + addPatternStart = true; + } // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + + + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n]; + var nlBefore = re.slice(0, nl.reStart); + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8); + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd); + var nlAfter = re.slice(nl.reEnd); + nlLast += nlAfter; // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + + var openParensBefore = nlBefore.split('(').length - 1; + var cleanAfter = nlAfter; + + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, ''); + } + + nlAfter = cleanAfter; + var dollar = ''; + + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$'; + } + + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast; + re = newRe; + } // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + + + if (re !== '' && hasMagic) { + re = '(?=.)' + re; + } + + if (addPatternStart) { + re = patternStart + re; + } // parsing just a piece of a larger pattern. + + + if (isSub === SUBPARSE) { + return [re, hasMagic]; + } // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + + + if (!hasMagic) { + return globUnescape(pattern); + } + + var flags = options.nocase ? 'i' : ''; + + try { + var regExp = new RegExp('^' + re + '$', flags); + } catch (er) { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.'); + } + + regExp._glob = pattern; + regExp._src = re; + return regExp; +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe(); +}; + +Minimatch.prototype.makeRe = makeRe; + +function makeRe() { + if (this.regexp || this.regexp === false) return this.regexp; // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + + var set = this.set; + + if (!set.length) { + this.regexp = false; + return this.regexp; + } + + var options = this.options; + var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot; + var flags = options.nocase ? 'i' : ''; + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return p === GLOBSTAR ? twoStar : typeof p === 'string' ? regExpEscape(p) : p._src; + }).join('\\\/'); + }).join('|'); // must match entire pattern + // ending in a * or ** will make it less strict. + + re = '^(?:' + re + ')$'; // can match anything, as long as it's not this. + + if (this.negate) re = '^(?!' + re + ').*$'; + + try { + this.regexp = new RegExp(re, flags); + } catch (ex) { + this.regexp = false; + } + + return this.regexp; +} + +minimatch.match = function (list, pattern, options) { + options = options || {}; + var mm = new Minimatch(pattern, options); + list = list.filter(function (f) { + return mm.match(f); + }); + + if (mm.options.nonull && !list.length) { + list.push(pattern); + } + + return list; +}; + +Minimatch.prototype.match = match; + +function match(f, partial) { + this.debug('match', f, this.pattern); // short-circuit in the case of busted things. + // comments, etc. + + if (this.comment) return false; + if (this.empty) return f === ''; + if (f === '/' && partial) return true; + var options = this.options; // windows: need to use /, not \ + + if (path.sep !== '/') { + f = f.split(path.sep).join('/'); + } // treat the test path as a set of pathparts. + + + f = f.split(slashSplit); + this.debug(this.pattern, 'split', f); // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set; + this.debug(this.pattern, 'set', set); // Find the basename of the path by looking for the last non-empty segment + + var filename; + var i; + + for (i = f.length - 1; i >= 0; i--) { + filename = f[i]; + if (filename) break; + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i]; + var file = f; + + if (options.matchBase && pattern.length === 1) { + file = [filename]; + } + + var hit = this.matchOne(file, pattern, partial); + + if (hit) { + if (options.flipNegate) return true; + return !this.negate; + } + } // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + + + if (options.flipNegate) return false; + return this.negate; +} // set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. + + +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options; + this.debug('matchOne', { + 'this': this, + file: file, + pattern: pattern + }); + this.debug('matchOne', file.length, pattern.length); + + for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) { + this.debug('matchOne loop'); + var p = pattern[pi]; + var f = file[fi]; + this.debug(pattern, p, f); // should be impossible. + // some invalid regexp stuff in the set. + + if (p === false) return false; + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]); // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + + var fr = fi; + var pr = pi + 1; + + if (pr === pl) { + this.debug('** at the end'); // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || !options.dot && file[fi].charAt(0) === '.') return false; + } + + return true; + } // ok, let's see if we can swallow whatever we can. + + + while (fr < fl) { + var swallowee = file[fr]; + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee); // XXX remove this slice. Just pass the start index. + + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee); // found a match. + + return true; + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || !options.dot && swallowee.charAt(0) === '.') { + this.debug('dot detected!', file, fr, pattern, pr); + break; + } // ** swallows a segment, and continue. + + + this.debug('globstar swallow a segment, and continue'); + fr++; + } + } // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + + + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr); + if (fr === fl) return true; + } + + return false; + } // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + + + var hit; + + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase(); + } else { + hit = f === p; + } + + this.debug('string match', p, f, hit); + } else { + hit = f.match(p); + this.debug('pattern match', p, f, hit); + } + + if (!hit) return false; + } // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + // now either we fell off the end of the pattern, or we're done. + + + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true; + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial; + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = fi === fl - 1 && file[fi] === ''; + return emptyFileEnd; + } // should be unreachable. + + + throw new Error('wtf?'); +}; // replace stuff like \* with * + + +function globUnescape(s) { + return s.replace(/\\(.)/g, '$1'); +} + +function regExpEscape(s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); +} + +const copyProperty = (to, from, property, ignoreNonConfigurable) => { + // `Function#length` should reflect the parameters of `to` not `from` since we keep its body. + // `Function#prototype` is non-writable and non-configurable so can never be modified. + if (property === 'length' || property === 'prototype') { + return; + } + + const toDescriptor = Object.getOwnPropertyDescriptor(to, property); + const fromDescriptor = Object.getOwnPropertyDescriptor(from, property); + + if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) { + return; + } + + Object.defineProperty(to, property, fromDescriptor); +}; // `Object.defineProperty()` throws if the property exists, is not configurable and either: +// - one its descriptors is changed +// - it is non-writable and its value is changed + + +const canCopyProperty = function (toDescriptor, fromDescriptor) { + return toDescriptor === undefined || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value); +}; + +const changePrototype = (to, from) => { + const fromPrototype = Object.getPrototypeOf(from); + + if (fromPrototype === Object.getPrototypeOf(to)) { + return; + } + + Object.setPrototypeOf(to, fromPrototype); +}; + +const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`; + +const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString'); +const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name'); // We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected. +// We use `bind()` instead of a closure for the same reason. +// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times. + +const changeToString = (to, from, name) => { + const withName = name === '' ? '' : `with ${name.trim()}() `; + const newToString = wrappedToString.bind(null, withName, from.toString()); // Ensure `to.toString.toString` is non-enumerable and has the same `same` + + Object.defineProperty(newToString, 'name', toStringName); + Object.defineProperty(to, 'toString', Object.assign({}, toStringDescriptor, { + value: newToString + })); +}; + +const mimicFn = (to, from, { + ignoreNonConfigurable = false +} = {}) => { + const { + name + } = to; + + for (const property of Reflect.ownKeys(from)) { + copyProperty(to, from, property, ignoreNonConfigurable); + } + + changePrototype(to, from); + changeToString(to, from, name); + return to; +}; + +var mimicFn_1 = mimicFn; + +var pDefer = () => { + const ret = {}; + ret.promise = new Promise((resolve, reject) => { + ret.resolve = resolve; + ret.reject = reject; + }); + return ret; +}; + +var dist = createCommonjsModule(function (module, exports) { + + var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : new P(function (resolve) { + resolve(result.value); + }).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + var __importDefault = this && this.__importDefault || function (mod) { + return mod && mod.__esModule ? mod : { + "default": mod + }; + }; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + const p_defer_1 = __importDefault(pDefer); + + function mapAgeCleaner(map, property = 'maxAge') { + let processingKey; + let processingTimer; + let processingDeferred; + + const cleanup = () => __awaiter(this, void 0, void 0, function* () { + if (processingKey !== undefined) { + // If we are already processing an item, we can safely exit + return; + } + + const setupTimer = item => __awaiter(this, void 0, void 0, function* () { + processingDeferred = p_defer_1.default(); + const delay = item[1][property] - Date.now(); + + if (delay <= 0) { + // Remove the item immediately if the delay is equal to or below 0 + map.delete(item[0]); + processingDeferred.resolve(); + return; + } // Keep track of the current processed key + + + processingKey = item[0]; + processingTimer = setTimeout(() => { + // Remove the item when the timeout fires + map.delete(item[0]); + + if (processingDeferred) { + processingDeferred.resolve(); + } + }, delay); // tslint:disable-next-line:strict-type-predicates + + if (typeof processingTimer.unref === 'function') { + // Don't hold up the process from exiting + processingTimer.unref(); + } + + return processingDeferred.promise; + }); + + try { + for (const entry of map) { + yield setupTimer(entry); + } + } catch (_a) {// Do nothing if an error occurs, this means the timer was cleaned up and we should stop processing + } + + processingKey = undefined; + }); + + const reset = () => { + processingKey = undefined; + + if (processingTimer !== undefined) { + clearTimeout(processingTimer); + processingTimer = undefined; + } + + if (processingDeferred !== undefined) { + // tslint:disable-line:early-exit + processingDeferred.reject(undefined); + processingDeferred = undefined; + } + }; + + const originalSet = map.set.bind(map); + + map.set = (key, value) => { + if (map.has(key)) { + // If the key already exist, remove it so we can add it back at the end of the map. + map.delete(key); + } // Call the original `map.set` + + + const result = originalSet(key, value); // If we are already processing a key and the key added is the current processed key, stop processing it + + if (processingKey && processingKey === key) { + reset(); + } // Always run the cleanup method in case it wasn't started yet + + + cleanup(); // tslint:disable-line:no-floating-promises + + return result; + }; + + cleanup(); // tslint:disable-line:no-floating-promises + + return map; + } + + exports.default = mapAgeCleaner; // Add support for CJS + + module.exports = mapAgeCleaner; + module.exports.default = mapAgeCleaner; +}); +unwrapExports(dist); + +const cacheStore = new WeakMap(); + +const mem = (fn, { + cacheKey = ([firstArgument]) => firstArgument, + cache = new Map(), + maxAge +} = {}) => { + if (typeof maxAge === 'number') { + dist(cache); + } + + const memoized = function (...arguments_) { + const key = cacheKey(arguments_); + + if (cache.has(key)) { + return cache.get(key).data; + } + + const cacheItem = fn.apply(this, arguments_); + cache.set(key, { + data: cacheItem, + maxAge: maxAge ? Date.now() + maxAge : Infinity + }); + return cacheItem; + }; + + try { + // The below call will throw in some host environments + // See https://github.com/sindresorhus/mimic-fn/issues/10 + mimicFn_1(memoized, fn); + } catch (_) {} + + cacheStore.set(memoized, cache); + return memoized; +}; + +var mem_1 = mem; + +var clear = fn => { + if (!cacheStore.has(fn)) { + throw new Error('Can\'t clear a function that was not memoized!'); + } + + const cache = cacheStore.get(fn); + + if (typeof cache.clear === 'function') { + cache.clear(); + } +}; +mem_1.clear = clear; + +var semver$2 = createCommonjsModule(function (module, exports) { + exports = module.exports = SemVer; + var debug; + /* istanbul ignore next */ + + if (typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0); + args.unshift('SEMVER'); + console.log.apply(console, args); + }; + } else { + debug = function () {}; + } // Note: this is the semver.org version of the spec that it implements + // Not necessarily the package version of this code. + + + exports.SEMVER_SPEC_VERSION = '2.0.0'; + var MAX_LENGTH = 256; + var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ + 9007199254740991; // Max safe segment length for coercion. + + var MAX_SAFE_COMPONENT_LENGTH = 16; // The actual regexps go on exports.re + + var re = exports.re = []; + var src = exports.src = []; + var R = 0; // The following Regular Expressions can be used for tokenizing, + // validating, and parsing SemVer version strings. + // ## Numeric Identifier + // A single `0`, or a non-zero digit followed by zero or more digits. + + var NUMERICIDENTIFIER = R++; + src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; + var NUMERICIDENTIFIERLOOSE = R++; + src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; // ## Non-numeric Identifier + // Zero or more digits, followed by a letter or hyphen, and then zero or + // more letters, digits, or hyphens. + + var NONNUMERICIDENTIFIER = R++; + src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; // ## Main Version + // Three dot-separated numeric identifiers. + + var MAINVERSION = R++; + src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + '(' + src[NUMERICIDENTIFIER] + ')\\.' + '(' + src[NUMERICIDENTIFIER] + ')'; + var MAINVERSIONLOOSE = R++; + src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; // ## Pre-release Version Identifier + // A numeric identifier, or a non-numeric identifier. + + var PRERELEASEIDENTIFIER = R++; + src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + '|' + src[NONNUMERICIDENTIFIER] + ')'; + var PRERELEASEIDENTIFIERLOOSE = R++; + src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + '|' + src[NONNUMERICIDENTIFIER] + ')'; // ## Pre-release Version + // Hyphen, followed by one or more dot-separated pre-release version + // identifiers. + + var PRERELEASE = R++; + src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; + var PRERELEASELOOSE = R++; + src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; // ## Build Metadata Identifier + // Any combination of digits, letters, or hyphens. + + var BUILDIDENTIFIER = R++; + src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; // ## Build Metadata + // Plus sign, followed by one or more period-separated build metadata + // identifiers. + + var BUILD = R++; + src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; // ## Full Version String + // A main version, followed optionally by a pre-release version and + // build metadata. + // Note that the only major, minor, patch, and pre-release sections of + // the version string are capturing groups. The build metadata is not a + // capturing group, because it should not ever be used in version + // comparison. + + var FULL = R++; + var FULLPLAIN = 'v?' + src[MAINVERSION] + src[PRERELEASE] + '?' + src[BUILD] + '?'; + src[FULL] = '^' + FULLPLAIN + '$'; // like full, but allows v1.2.3 and =1.2.3, which people do sometimes. + // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty + // common in the npm registry. + + var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + src[PRERELEASELOOSE] + '?' + src[BUILD] + '?'; + var LOOSE = R++; + src[LOOSE] = '^' + LOOSEPLAIN + '$'; + var GTLT = R++; + src[GTLT] = '((?:<|>)?=?)'; // Something like "2.*" or "1.2.x". + // Note that "x.x" is a valid xRange identifer, meaning "any version" + // Only the first item is strictly required. + + var XRANGEIDENTIFIERLOOSE = R++; + src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; + var XRANGEIDENTIFIER = R++; + src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; + var XRANGEPLAIN = R++; + src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + '(?:' + src[PRERELEASE] + ')?' + src[BUILD] + '?' + ')?)?'; + var XRANGEPLAINLOOSE = R++; + src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:' + src[PRERELEASELOOSE] + ')?' + src[BUILD] + '?' + ')?)?'; + var XRANGE = R++; + src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; + var XRANGELOOSE = R++; + src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; // Coercion. + // Extract anything that could conceivably be a part of a valid semver + + var COERCE = R++; + src[COERCE] = '(?:^|[^\\d])' + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:$|[^\\d])'; // Tilde ranges. + // Meaning is "reasonably at or greater than" + + var LONETILDE = R++; + src[LONETILDE] = '(?:~>?)'; + var TILDETRIM = R++; + src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; + re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); + var tildeTrimReplace = '$1~'; + var TILDE = R++; + src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; + var TILDELOOSE = R++; + src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; // Caret ranges. + // Meaning is "at least and backwards compatible with" + + var LONECARET = R++; + src[LONECARET] = '(?:\\^)'; + var CARETTRIM = R++; + src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; + re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); + var caretTrimReplace = '$1^'; + var CARET = R++; + src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; + var CARETLOOSE = R++; + src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; // A simple gt/lt/eq thing, or just "" to indicate "any version" + + var COMPARATORLOOSE = R++; + src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'; + var COMPARATOR = R++; + src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; // An expression to strip any whitespace between the gtlt and the thing + // it modifies, so that `> 1.2.3` ==> `>1.2.3` + + var COMPARATORTRIM = R++; + src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; // this one has to use the /g flag + + re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); + var comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4` + // Note that these all use the loose form, because they'll be + // checked against either the strict or loose comparator form + // later. + + var HYPHENRANGE = R++; + src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + '\\s+-\\s+' + '(' + src[XRANGEPLAIN] + ')' + '\\s*$'; + var HYPHENRANGELOOSE = R++; + src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + '\\s+-\\s+' + '(' + src[XRANGEPLAINLOOSE] + ')' + '\\s*$'; // Star ranges basically just allow anything at all. + + var STAR = R++; + src[STAR] = '(<|>)?=?\\s*\\*'; // Compile to actual regexp objects. + // All are flag-free, unless they were created above with a flag. + + for (var i = 0; i < R; i++) { + debug(i, src[i]); + + if (!re[i]) { + re[i] = new RegExp(src[i]); + } + } + + exports.parse = parse; + + function parse(version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + }; + } + + if (version instanceof SemVer) { + return version; + } + + if (typeof version !== 'string') { + return null; + } + + if (version.length > MAX_LENGTH) { + return null; + } + + var r = options.loose ? re[LOOSE] : re[FULL]; + + if (!r.test(version)) { + return null; + } + + try { + return new SemVer(version, options); + } catch (er) { + return null; + } + } + + exports.valid = valid; + + function valid(version, options) { + var v = parse(version, options); + return v ? v.version : null; + } + + exports.clean = clean; + + function clean(version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options); + return s ? s.version : null; + } + + exports.SemVer = SemVer; + + function SemVer(version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + }; + } + + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version; + } else { + version = version.version; + } + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version); + } + + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters'); + } + + if (!(this instanceof SemVer)) { + return new SemVer(version, options); + } + + debug('SemVer', version, options); + this.options = options; + this.loose = !!options.loose; + var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]); + + if (!m) { + throw new TypeError('Invalid Version: ' + version); + } + + this.raw = version; // these are actually numbers + + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version'); + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version'); + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version'); + } // numberify any prerelease numeric ids + + + if (!m[4]) { + this.prerelease = []; + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id; + + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num; + } + } + + return id; + }); + } + + this.build = m[5] ? m[5].split('.') : []; + this.format(); + } + + SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch; + + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.'); + } + + return this.version; + }; + + SemVer.prototype.toString = function () { + return this.version; + }; + + SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other); + + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + + return this.compareMain(other) || this.comparePre(other); + }; + + SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + + return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch); + }; + + SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } // NOT having a prerelease is > having one + + + if (this.prerelease.length && !other.prerelease.length) { + return -1; + } else if (!this.prerelease.length && other.prerelease.length) { + return 1; + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0; + } + + var i = 0; + + do { + var a = this.prerelease[i]; + var b = other.prerelease[i]; + debug('prerelease compare', i, a, b); + + if (a === undefined && b === undefined) { + return 0; + } else if (b === undefined) { + return 1; + } else if (a === undefined) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + }; // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + + + SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc('pre', identifier); + break; + + case 'preminor': + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc('pre', identifier); + break; + + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0; + this.inc('patch', identifier); + this.inc('pre', identifier); + break; + // If the input is a non-prerelease version, this acts the same as + // prepatch. + + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier); + } + + this.inc('pre', identifier); + break; + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { + this.major++; + } + + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++; + } + + this.patch = 0; + this.prerelease = []; + break; + + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++; + } + + this.prerelease = []; + break; + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0]; + } else { + var i = this.prerelease.length; + + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++; + i = -2; + } + } + + if (i === -1) { + // didn't increment anything + this.prerelease.push(0); + } + } + + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0]; + } + } else { + this.prerelease = [identifier, 0]; + } + } + + break; + + default: + throw new Error('invalid increment argument: ' + release); + } + + this.format(); + this.raw = this.version; + return this; + }; + + exports.inc = inc; + + function inc(version, release, loose, identifier) { + if (typeof loose === 'string') { + identifier = loose; + loose = undefined; + } + + try { + return new SemVer(version, loose).inc(release, identifier).version; + } catch (er) { + return null; + } + } + + exports.diff = diff; + + function diff(version1, version2) { + if (eq(version1, version2)) { + return null; + } else { + var v1 = parse(version1); + var v2 = parse(version2); + var prefix = ''; + + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre'; + var defaultResult = 'prerelease'; + } + + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key; + } + } + } + + return defaultResult; // may be undefined + } + } + + exports.compareIdentifiers = compareIdentifiers; + var numeric = /^[0-9]+$/; + + function compareIdentifiers(a, b) { + var anum = numeric.test(a); + var bnum = numeric.test(b); + + if (anum && bnum) { + a = +a; + b = +b; + } + + return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; + } + + exports.rcompareIdentifiers = rcompareIdentifiers; + + function rcompareIdentifiers(a, b) { + return compareIdentifiers(b, a); + } + + exports.major = major; + + function major(a, loose) { + return new SemVer(a, loose).major; + } + + exports.minor = minor; + + function minor(a, loose) { + return new SemVer(a, loose).minor; + } + + exports.patch = patch; + + function patch(a, loose) { + return new SemVer(a, loose).patch; + } + + exports.compare = compare; + + function compare(a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)); + } + + exports.compareLoose = compareLoose; + + function compareLoose(a, b) { + return compare(a, b, true); + } + + exports.rcompare = rcompare; + + function rcompare(a, b, loose) { + return compare(b, a, loose); + } + + exports.sort = sort; + + function sort(list, loose) { + return list.sort(function (a, b) { + return exports.compare(a, b, loose); + }); + } + + exports.rsort = rsort; + + function rsort(list, loose) { + return list.sort(function (a, b) { + return exports.rcompare(a, b, loose); + }); + } + + exports.gt = gt; + + function gt(a, b, loose) { + return compare(a, b, loose) > 0; + } + + exports.lt = lt; + + function lt(a, b, loose) { + return compare(a, b, loose) < 0; + } + + exports.eq = eq; + + function eq(a, b, loose) { + return compare(a, b, loose) === 0; + } + + exports.neq = neq; + + function neq(a, b, loose) { + return compare(a, b, loose) !== 0; + } + + exports.gte = gte; + + function gte(a, b, loose) { + return compare(a, b, loose) >= 0; + } + + exports.lte = lte; + + function lte(a, b, loose) { + return compare(a, b, loose) <= 0; + } + + exports.cmp = cmp; + + function cmp(a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + return a === b; + + case '!==': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + return a !== b; + + case '': + case '=': + case '==': + return eq(a, b, loose); + + case '!=': + return neq(a, b, loose); + + case '>': + return gt(a, b, loose); + + case '>=': + return gte(a, b, loose); + + case '<': + return lt(a, b, loose); + + case '<=': + return lte(a, b, loose); + + default: + throw new TypeError('Invalid operator: ' + op); + } + } + + exports.Comparator = Comparator; + + function Comparator(comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + }; + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp; + } else { + comp = comp.value; + } + } + + if (!(this instanceof Comparator)) { + return new Comparator(comp, options); + } + + debug('comparator', comp, options); + this.options = options; + this.loose = !!options.loose; + this.parse(comp); + + if (this.semver === ANY) { + this.value = ''; + } else { + this.value = this.operator + this.semver.version; + } + + debug('comp', this); + } + + var ANY = {}; + + Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var m = comp.match(r); + + if (!m) { + throw new TypeError('Invalid comparator: ' + comp); + } + + this.operator = m[1]; + + if (this.operator === '=') { + this.operator = ''; + } // if it literally is just '>' or '' then allow anything. + + + if (!m[2]) { + this.semver = ANY; + } else { + this.semver = new SemVer(m[2], this.options.loose); + } + }; + + Comparator.prototype.toString = function () { + return this.value; + }; + + Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose); + + if (this.semver === ANY) { + return true; + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options); + } + + return cmp(version, this.operator, this.semver, this.options); + }; + + Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required'); + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + }; + } + + var rangeTmp; + + if (this.operator === '') { + rangeTmp = new Range(comp.value, options); + return satisfies(this.value, rangeTmp, options); + } else if (comp.operator === '') { + rangeTmp = new Range(this.value, options); + return satisfies(comp.semver, rangeTmp, options); + } + + var sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>'); + var sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<'); + var sameSemVer = this.semver.version === comp.semver.version; + var differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<='); + var oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && (this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<'); + var oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>'); + return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; + }; + + exports.Range = Range; + + function Range(range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + }; + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { + return range; + } else { + return new Range(range.raw, options); + } + } + + if (range instanceof Comparator) { + return new Range(range.value, options); + } + + if (!(this instanceof Range)) { + return new Range(range, options); + } + + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; // First, split based on boolean or || + + this.raw = range; + this.set = range.split(/\s*\|\|\s*/).map(function (range) { + return this.parseRange(range.trim()); + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length; + }); + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range); + } + + this.format(); + } + + Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim(); + }).join('||').trim(); + return this.range; + }; + + Range.prototype.toString = function () { + return this.range; + }; + + Range.prototype.parseRange = function (range) { + var loose = this.options.loose; + range = range.trim(); // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + + var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; + range = range.replace(hr, hyphenReplace); + debug('hyphen replace', range); // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + + range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); + debug('comparator trim', range, re[COMPARATORTRIM]); // `~ 1.2.3` => `~1.2.3` + + range = range.replace(re[TILDETRIM], tildeTrimReplace); // `^ 1.2.3` => `^1.2.3` + + range = range.replace(re[CARETTRIM], caretTrimReplace); // normalize spaces + + range = range.split(/\s+/).join(' '); // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options); + }, this).join(' ').split(/\s+/); + + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe); + }); + } + + set = set.map(function (comp) { + return new Comparator(comp, this.options); + }, this); + return set; + }; + + Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required'); + } + + return this.set.some(function (thisComparators) { + return thisComparators.every(function (thisComparator) { + return range.set.some(function (rangeComparators) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options); + }); + }); + }); + }); + }; // Mostly just for testing and legacy API reasons + + + exports.toComparators = toComparators; + + function toComparators(range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value; + }).join(' ').trim().split(' '); + }); + } // comprised of xranges, tildes, stars, and gtlt's at this point. + // already replaced the hyphen ranges + // turn into a set of JUST comparators. + + + function parseComparator(comp, options) { + debug('comp', comp, options); + comp = replaceCarets(comp, options); + debug('caret', comp); + comp = replaceTildes(comp, options); + debug('tildes', comp); + comp = replaceXRanges(comp, options); + debug('xrange', comp); + comp = replaceStars(comp, options); + debug('stars', comp); + return comp; + } + + function isX(id) { + return !id || id.toLowerCase() === 'x' || id === '*'; + } // ~, ~> --> * (any, kinda silly) + // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 + // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 + // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 + // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 + // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 + + + function replaceTildes(comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options); + }).join(' '); + } + + function replaceTilde(comp, options) { + var r = options.loose ? re[TILDELOOSE] : re[TILDE]; + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr); + var ret; + + if (isX(M)) { + ret = ''; + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + } else if (pr) { + debug('replaceTilde pr', pr); + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0'; + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0'; + } + + debug('tilde return', ret); + return ret; + }); + } // ^ --> * (any, kinda silly) + // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 + // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 + // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 + // ^1.2.3 --> >=1.2.3 <2.0.0 + // ^1.2.0 --> >=1.2.0 <2.0.0 + + + function replaceCarets(comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options); + }).join(' '); + } + + function replaceCaret(comp, options) { + debug('caret', comp, options); + var r = options.loose ? re[CARETLOOSE] : re[CARET]; + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr); + var ret; + + if (isX(M)) { + ret = ''; + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; + } + } else if (pr) { + debug('replaceCaret pr', pr); + + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + m + '.' + (+p + 1); + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0'; + } + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + (+M + 1) + '.0.0'; + } + } else { + debug('no pr'); + + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + m + '.' + (+p + 1); + } else { + ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0'; + } + } else { + ret = '>=' + M + '.' + m + '.' + p + ' <' + (+M + 1) + '.0.0'; + } + } + + debug('caret return', ret); + return ret; + }); + } + + function replaceXRanges(comp, options) { + debug('replaceXRanges', comp, options); + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options); + }).join(' '); + } + + function replaceXRange(comp, options) { + comp = comp.trim(); + var r = options.loose ? re[XRANGELOOSE] : re[XRANGE]; + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr); + var xM = isX(M); + var xm = xM || isX(m); + var xp = xm || isX(p); + var anyX = xp; + + if (gtlt === '=' && anyX) { + gtlt = ''; + } + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0'; + } else { + // nothing is forbidden + ret = '*'; + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0; + } + + p = 0; + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>='; + + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else { + m = +m + 1; + p = 0; + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<'; + + if (xm) { + M = +M + 1; + } else { + m = +m + 1; + } + } + + ret = gtlt + M + '.' + m + '.' + p; + } else if (xm) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + } else if (xp) { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + } + + debug('xRange return', ret); + return ret; + }); + } // Because * is AND-ed with everything else in the comparator, + // and '' means "any version", just remove the *s entirely. + + + function replaceStars(comp, options) { + debug('replaceStars', comp, options); // Looseness is ignored here. star is always as loose as it gets! + + return comp.trim().replace(re[STAR], ''); + } // This function is passed to string.replace(re[HYPHENRANGE]) + // M, m, patch, prerelease, build + // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 + // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do + // 1.2 - 3.4 => >=1.2.0 <3.5.0 + + + function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = ''; + } else if (isX(fm)) { + from = '>=' + fM + '.0.0'; + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0'; + } else { + from = '>=' + from; + } + + if (isX(tM)) { + to = ''; + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0'; + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0'; + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; + } else { + to = '<=' + to; + } + + return (from + ' ' + to).trim(); + } // if ANY of the sets match ALL of its comparators, then pass + + + Range.prototype.test = function (version) { + if (!version) { + return false; + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options); + } + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true; + } + } + + return false; + }; + + function testSet(set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false; + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver); + + if (set[i].semver === ANY) { + continue; + } + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver; + + if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { + return true; + } + } + } // Version has a -pre, but it's not one of the ones we like. + + + return false; + } + + return true; + } + + exports.satisfies = satisfies; + + function satisfies(version, range, options) { + try { + range = new Range(range, options); + } catch (er) { + return false; + } + + return range.test(version); + } + + exports.maxSatisfying = maxSatisfying; + + function maxSatisfying(versions, range, options) { + var max = null; + var maxSV = null; + + try { + var rangeObj = new Range(range, options); + } catch (er) { + return null; + } + + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v; + maxSV = new SemVer(max, options); + } + } + }); + return max; + } + + exports.minSatisfying = minSatisfying; + + function minSatisfying(versions, range, options) { + var min = null; + var minSV = null; + + try { + var rangeObj = new Range(range, options); + } catch (er) { + return null; + } + + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v; + minSV = new SemVer(min, options); + } + } + }); + return min; + } + + exports.minVersion = minVersion; + + function minVersion(range, loose) { + range = new Range(range, loose); + var minver = new SemVer('0.0.0'); + + if (range.test(minver)) { + return minver; + } + + minver = new SemVer('0.0.0-0'); + + if (range.test(minver)) { + return minver; + } + + minver = null; + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i]; + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version); + + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++; + } else { + compver.prerelease.push(0); + } + + compver.raw = compver.format(); + + /* fallthrough */ + + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver; + } + + break; + + case '<': + case '<=': + /* Ignore maximum versions */ + break; + + /* istanbul ignore next */ + + default: + throw new Error('Unexpected operation: ' + comparator.operator); + } + }); + } + + if (minver && range.test(minver)) { + return minver; + } + + return null; + } + + exports.validRange = validRange; + + function validRange(range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*'; + } catch (er) { + return null; + } + } // Determine if version is less than all the versions possible in the range + + + exports.ltr = ltr; + + function ltr(version, range, options) { + return outside(version, range, '<', options); + } // Determine if version is greater than all the versions possible in the range. + + + exports.gtr = gtr; + + function gtr(version, range, options) { + return outside(version, range, '>', options); + } + + exports.outside = outside; + + function outside(version, range, hilo, options) { + version = new SemVer(version, options); + range = new Range(range, options); + var gtfn, ltefn, ltfn, comp, ecomp; + + switch (hilo) { + case '>': + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = '>'; + ecomp = '>='; + break; + + case '<': + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = '<'; + ecomp = '<='; + break; + + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } // If it satisifes the range it is not outside + + + if (satisfies(version, range, options)) { + return false; + } // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i]; + var high = null; + var low = null; + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0'); + } + + high = high || comparator; + low = low || comparator; + + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator; + } + }); // If the edge version comparator has a operator then our version + // isn't outside it + + if (high.operator === comp || high.operator === ecomp) { + return false; + } // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + + + if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } + + return true; + } + + exports.prerelease = prerelease; + + function prerelease(version, options) { + var parsed = parse(version, options); + return parsed && parsed.prerelease.length ? parsed.prerelease : null; + } + + exports.intersects = intersects; + + function intersects(r1, r2, options) { + r1 = new Range(r1, options); + r2 = new Range(r2, options); + return r1.intersects(r2); + } + + exports.coerce = coerce; + + function coerce(version) { + if (version instanceof SemVer) { + return version; + } + + if (typeof version !== 'string') { + return null; + } + + var match = version.match(re[COERCE]); + + if (match == null) { + return null; + } + + return parse(match[1] + '.' + (match[2] || '0') + '.' + (match[3] || '0')); + } +}); +var semver_1 = semver$2.SEMVER_SPEC_VERSION; +var semver_2 = semver$2.re; +var semver_3 = semver$2.src; +var semver_4 = semver$2.parse; +var semver_5 = semver$2.valid; +var semver_6 = semver$2.clean; +var semver_7 = semver$2.SemVer; +var semver_8 = semver$2.inc; +var semver_9 = semver$2.diff; +var semver_10 = semver$2.compareIdentifiers; +var semver_11 = semver$2.rcompareIdentifiers; +var semver_12 = semver$2.major; +var semver_13 = semver$2.minor; +var semver_14 = semver$2.patch; +var semver_15 = semver$2.compare; +var semver_16 = semver$2.compareLoose; +var semver_17 = semver$2.rcompare; +var semver_18 = semver$2.sort; +var semver_19 = semver$2.rsort; +var semver_20 = semver$2.gt; +var semver_21 = semver$2.lt; +var semver_22 = semver$2.eq; +var semver_23 = semver$2.neq; +var semver_24 = semver$2.gte; +var semver_25 = semver$2.lte; +var semver_26 = semver$2.cmp; +var semver_27 = semver$2.Comparator; +var semver_28 = semver$2.Range; +var semver_29 = semver$2.toComparators; +var semver_30 = semver$2.satisfies; +var semver_31 = semver$2.maxSatisfying; +var semver_32 = semver$2.minSatisfying; +var semver_33 = semver$2.minVersion; +var semver_34 = semver$2.validRange; +var semver_35 = semver$2.ltr; +var semver_36 = semver$2.gtr; +var semver_37 = semver$2.outside; +var semver_38 = semver$2.prerelease; +var semver_39 = semver$2.intersects; +var semver_40 = semver$2.coerce; + +var hasOwnProperty = Object.prototype.hasOwnProperty; +var pseudomap = PseudoMap; + +function PseudoMap(set) { + if (!(this instanceof PseudoMap)) // whyyyyyyy + throw new TypeError("Constructor PseudoMap requires 'new'"); + this.clear(); + + if (set) { + if (set instanceof PseudoMap || typeof Map === 'function' && set instanceof Map) set.forEach(function (value, key) { + this.set(key, value); + }, this);else if (Array.isArray(set)) set.forEach(function (kv) { + this.set(kv[0], kv[1]); + }, this);else throw new TypeError('invalid argument'); + } +} + +PseudoMap.prototype.forEach = function (fn, thisp) { + thisp = thisp || this; + Object.keys(this._data).forEach(function (k) { + if (k !== 'size') fn.call(thisp, this._data[k].value, this._data[k].key); + }, this); +}; + +PseudoMap.prototype.has = function (k) { + return !!find(this._data, k); +}; + +PseudoMap.prototype.get = function (k) { + var res = find(this._data, k); + return res && res.value; +}; + +PseudoMap.prototype.set = function (k, v) { + set(this._data, k, v); +}; + +PseudoMap.prototype.delete = function (k) { + var res = find(this._data, k); + + if (res) { + delete this._data[res._index]; + this._data.size--; + } +}; + +PseudoMap.prototype.clear = function () { + var data = Object.create(null); + data.size = 0; + Object.defineProperty(this, '_data', { + value: data, + enumerable: false, + configurable: true, + writable: false + }); +}; + +Object.defineProperty(PseudoMap.prototype, 'size', { + get: function () { + return this._data.size; + }, + set: function (n) {}, + enumerable: true, + configurable: true +}); + +PseudoMap.prototype.values = PseudoMap.prototype.keys = PseudoMap.prototype.entries = function () { + throw new Error('iterators are not implemented in this version'); +}; // Either identical, or both NaN + + +function same(a, b) { + return a === b || a !== a && b !== b; +} + +function Entry(k, v, i) { + this.key = k; + this.value = v; + this._index = i; +} + +function find(data, k) { + for (var i = 0, s = '_' + k, key = s; hasOwnProperty.call(data, key); key = s + i++) { + if (same(data[key].key, k)) return data[key]; + } +} + +function set(data, k, v) { + for (var i = 0, s = '_' + k, key = s; hasOwnProperty.call(data, key); key = s + i++) { + if (same(data[key].key, k)) { + data[key].value = v; + return; + } + } + + data.size++; + data[key] = new Entry(k, v, key); +} + +var map = createCommonjsModule(function (module) { + if (process.env.npm_package_name === 'pseudomap' && process.env.npm_lifecycle_script === 'test') process.env.TEST_PSEUDOMAP = 'true'; + + if (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) { + module.exports = Map; + } else { + module.exports = pseudomap; + } +}); + +var yallist = Yallist; +Yallist.Node = Node; +Yallist.create = Yallist; + +function Yallist(list) { + var self = this; + + if (!(self instanceof Yallist)) { + self = new Yallist(); + } + + self.tail = null; + self.head = null; + self.length = 0; + + if (list && typeof list.forEach === 'function') { + list.forEach(function (item) { + self.push(item); + }); + } else if (arguments.length > 0) { + for (var i = 0, l = arguments.length; i < l; i++) { + self.push(arguments[i]); + } + } + + return self; +} + +Yallist.prototype.removeNode = function (node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list'); + } + + var next = node.next; + var prev = node.prev; + + if (next) { + next.prev = prev; + } + + if (prev) { + prev.next = next; + } + + if (node === this.head) { + this.head = next; + } + + if (node === this.tail) { + this.tail = prev; + } + + node.list.length--; + node.next = null; + node.prev = null; + node.list = null; +}; + +Yallist.prototype.unshiftNode = function (node) { + if (node === this.head) { + return; + } + + if (node.list) { + node.list.removeNode(node); + } + + var head = this.head; + node.list = this; + node.next = head; + + if (head) { + head.prev = node; + } + + this.head = node; + + if (!this.tail) { + this.tail = node; + } + + this.length++; +}; + +Yallist.prototype.pushNode = function (node) { + if (node === this.tail) { + return; + } + + if (node.list) { + node.list.removeNode(node); + } + + var tail = this.tail; + node.list = this; + node.prev = tail; + + if (tail) { + tail.next = node; + } + + this.tail = node; + + if (!this.head) { + this.head = node; + } + + this.length++; +}; + +Yallist.prototype.push = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + push(this, arguments[i]); + } + + return this.length; +}; + +Yallist.prototype.unshift = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + unshift(this, arguments[i]); + } + + return this.length; +}; + +Yallist.prototype.pop = function () { + if (!this.tail) { + return undefined; + } + + var res = this.tail.value; + this.tail = this.tail.prev; + + if (this.tail) { + this.tail.next = null; + } else { + this.head = null; + } + + this.length--; + return res; +}; + +Yallist.prototype.shift = function () { + if (!this.head) { + return undefined; + } + + var res = this.head.value; + this.head = this.head.next; + + if (this.head) { + this.head.prev = null; + } else { + this.tail = null; + } + + this.length--; + return res; +}; + +Yallist.prototype.forEach = function (fn, thisp) { + thisp = thisp || this; + + for (var walker = this.head, i = 0; walker !== null; i++) { + fn.call(thisp, walker.value, i, this); + walker = walker.next; + } +}; + +Yallist.prototype.forEachReverse = function (fn, thisp) { + thisp = thisp || this; + + for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { + fn.call(thisp, walker.value, i, this); + walker = walker.prev; + } +}; + +Yallist.prototype.get = function (n) { + for (var i = 0, walker = this.head; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.next; + } + + if (i === n && walker !== null) { + return walker.value; + } +}; + +Yallist.prototype.getReverse = function (n) { + for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.prev; + } + + if (i === n && walker !== null) { + return walker.value; + } +}; + +Yallist.prototype.map = function (fn, thisp) { + thisp = thisp || this; + var res = new Yallist(); + + for (var walker = this.head; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.next; + } + + return res; +}; + +Yallist.prototype.mapReverse = function (fn, thisp) { + thisp = thisp || this; + var res = new Yallist(); + + for (var walker = this.tail; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.prev; + } + + return res; +}; + +Yallist.prototype.reduce = function (fn, initial) { + var acc; + var walker = this.head; + + if (arguments.length > 1) { + acc = initial; + } else if (this.head) { + walker = this.head.next; + acc = this.head.value; + } else { + throw new TypeError('Reduce of empty list with no initial value'); + } + + for (var i = 0; walker !== null; i++) { + acc = fn(acc, walker.value, i); + walker = walker.next; + } + + return acc; +}; + +Yallist.prototype.reduceReverse = function (fn, initial) { + var acc; + var walker = this.tail; + + if (arguments.length > 1) { + acc = initial; + } else if (this.tail) { + walker = this.tail.prev; + acc = this.tail.value; + } else { + throw new TypeError('Reduce of empty list with no initial value'); + } + + for (var i = this.length - 1; walker !== null; i--) { + acc = fn(acc, walker.value, i); + walker = walker.prev; + } + + return acc; +}; + +Yallist.prototype.toArray = function () { + var arr = new Array(this.length); + + for (var i = 0, walker = this.head; walker !== null; i++) { + arr[i] = walker.value; + walker = walker.next; + } + + return arr; +}; + +Yallist.prototype.toArrayReverse = function () { + var arr = new Array(this.length); + + for (var i = 0, walker = this.tail; walker !== null; i++) { + arr[i] = walker.value; + walker = walker.prev; + } + + return arr; +}; + +Yallist.prototype.slice = function (from, to) { + to = to || this.length; + + if (to < 0) { + to += this.length; + } + + from = from || 0; + + if (from < 0) { + from += this.length; + } + + var ret = new Yallist(); + + if (to < from || to < 0) { + return ret; + } + + if (from < 0) { + from = 0; + } + + if (to > this.length) { + to = this.length; + } + + for (var i = 0, walker = this.head; walker !== null && i < from; i++) { + walker = walker.next; + } + + for (; walker !== null && i < to; i++, walker = walker.next) { + ret.push(walker.value); + } + + return ret; +}; + +Yallist.prototype.sliceReverse = function (from, to) { + to = to || this.length; + + if (to < 0) { + to += this.length; + } + + from = from || 0; + + if (from < 0) { + from += this.length; + } + + var ret = new Yallist(); + + if (to < from || to < 0) { + return ret; + } + + if (from < 0) { + from = 0; + } + + if (to > this.length) { + to = this.length; + } + + for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { + walker = walker.prev; + } + + for (; walker !== null && i > from; i--, walker = walker.prev) { + ret.push(walker.value); + } + + return ret; +}; + +Yallist.prototype.reverse = function () { + var head = this.head; + var tail = this.tail; + + for (var walker = head; walker !== null; walker = walker.prev) { + var p = walker.prev; + walker.prev = walker.next; + walker.next = p; + } + + this.head = tail; + this.tail = head; + return this; +}; + +function push(self, item) { + self.tail = new Node(item, self.tail, null, self); + + if (!self.head) { + self.head = self.tail; + } + + self.length++; +} + +function unshift(self, item) { + self.head = new Node(item, null, self.head, self); + + if (!self.tail) { + self.tail = self.head; + } + + self.length++; +} + +function Node(value, prev, next, list) { + if (!(this instanceof Node)) { + return new Node(value, prev, next, list); + } + + this.list = list; + this.value = value; + + if (prev) { + prev.next = this; + this.prev = prev; + } else { + this.prev = null; + } + + if (next) { + next.prev = this; + this.next = next; + } else { + this.next = null; + } +} + +var lruCache = LRUCache; // This will be a proper iterable 'Map' in engines that support it, +// or a fakey-fake PseudoMap in older versions. +// A linked list to keep track of recently-used-ness +// use symbols if possible, otherwise just _props + +var hasSymbol = typeof Symbol === 'function' && process.env._nodeLRUCacheForceNoSymbol !== '1'; +var makeSymbol; + +if (hasSymbol) { + makeSymbol = function (key) { + return Symbol(key); + }; +} else { + makeSymbol = function (key) { + return '_' + key; + }; +} + +var MAX = makeSymbol('max'); +var LENGTH = makeSymbol('length'); +var LENGTH_CALCULATOR = makeSymbol('lengthCalculator'); +var ALLOW_STALE = makeSymbol('allowStale'); +var MAX_AGE = makeSymbol('maxAge'); +var DISPOSE = makeSymbol('dispose'); +var NO_DISPOSE_ON_SET = makeSymbol('noDisposeOnSet'); +var LRU_LIST = makeSymbol('lruList'); +var CACHE = makeSymbol('cache'); + +function naiveLength() { + return 1; +} // lruList is a yallist where the head is the youngest +// item, and the tail is the oldest. the list contains the Hit +// objects as the entries. +// Each Hit object has a reference to its Yallist.Node. This +// never changes. +// +// cache is a Map (or PseudoMap) that matches the keys to +// the Yallist.Node object. + + +function LRUCache(options) { + if (!(this instanceof LRUCache)) { + return new LRUCache(options); + } + + if (typeof options === 'number') { + options = { + max: options + }; + } + + if (!options) { + options = {}; + } + + var max = this[MAX] = options.max; // Kind of weird to have a default max of Infinity, but oh well. + + if (!max || !(typeof max === 'number') || max <= 0) { + this[MAX] = Infinity; + } + + var lc = options.length || naiveLength; + + if (typeof lc !== 'function') { + lc = naiveLength; + } + + this[LENGTH_CALCULATOR] = lc; + this[ALLOW_STALE] = options.stale || false; + this[MAX_AGE] = options.maxAge || 0; + this[DISPOSE] = options.dispose; + this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false; + this.reset(); +} // resize the cache when the max changes. + + +Object.defineProperty(LRUCache.prototype, 'max', { + set: function (mL) { + if (!mL || !(typeof mL === 'number') || mL <= 0) { + mL = Infinity; + } + + this[MAX] = mL; + trim$2(this); + }, + get: function () { + return this[MAX]; + }, + enumerable: true +}); +Object.defineProperty(LRUCache.prototype, 'allowStale', { + set: function (allowStale) { + this[ALLOW_STALE] = !!allowStale; + }, + get: function () { + return this[ALLOW_STALE]; + }, + enumerable: true +}); +Object.defineProperty(LRUCache.prototype, 'maxAge', { + set: function (mA) { + if (!mA || !(typeof mA === 'number') || mA < 0) { + mA = 0; + } + + this[MAX_AGE] = mA; + trim$2(this); + }, + get: function () { + return this[MAX_AGE]; + }, + enumerable: true +}); // resize the cache when the lengthCalculator changes. + +Object.defineProperty(LRUCache.prototype, 'lengthCalculator', { + set: function (lC) { + if (typeof lC !== 'function') { + lC = naiveLength; + } + + if (lC !== this[LENGTH_CALCULATOR]) { + this[LENGTH_CALCULATOR] = lC; + this[LENGTH] = 0; + this[LRU_LIST].forEach(function (hit) { + hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key); + this[LENGTH] += hit.length; + }, this); + } + + trim$2(this); + }, + get: function () { + return this[LENGTH_CALCULATOR]; + }, + enumerable: true +}); +Object.defineProperty(LRUCache.prototype, 'length', { + get: function () { + return this[LENGTH]; + }, + enumerable: true +}); +Object.defineProperty(LRUCache.prototype, 'itemCount', { + get: function () { + return this[LRU_LIST].length; + }, + enumerable: true +}); + +LRUCache.prototype.rforEach = function (fn, thisp) { + thisp = thisp || this; + + for (var walker = this[LRU_LIST].tail; walker !== null;) { + var prev = walker.prev; + forEachStep(this, fn, walker, thisp); + walker = prev; + } +}; + +function forEachStep(self, fn, node, thisp) { + var hit = node.value; + + if (isStale(self, hit)) { + del(self, node); + + if (!self[ALLOW_STALE]) { + hit = undefined; + } + } + + if (hit) { + fn.call(thisp, hit.value, hit.key, self); + } +} + +LRUCache.prototype.forEach = function (fn, thisp) { + thisp = thisp || this; + + for (var walker = this[LRU_LIST].head; walker !== null;) { + var next = walker.next; + forEachStep(this, fn, walker, thisp); + walker = next; + } +}; + +LRUCache.prototype.keys = function () { + return this[LRU_LIST].toArray().map(function (k) { + return k.key; + }, this); +}; + +LRUCache.prototype.values = function () { + return this[LRU_LIST].toArray().map(function (k) { + return k.value; + }, this); +}; + +LRUCache.prototype.reset = function () { + if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) { + this[LRU_LIST].forEach(function (hit) { + this[DISPOSE](hit.key, hit.value); + }, this); + } + + this[CACHE] = new map(); // hash of items by key + + this[LRU_LIST] = new yallist(); // list of items in order of use recency + + this[LENGTH] = 0; // length of items in the list +}; + +LRUCache.prototype.dump = function () { + return this[LRU_LIST].map(function (hit) { + if (!isStale(this, hit)) { + return { + k: hit.key, + v: hit.value, + e: hit.now + (hit.maxAge || 0) + }; + } + }, this).toArray().filter(function (h) { + return h; + }); +}; + +LRUCache.prototype.dumpLru = function () { + return this[LRU_LIST]; +}; +/* istanbul ignore next */ + + +LRUCache.prototype.inspect = function (n, opts) { + var str = 'LRUCache {'; + var extras = false; + var as = this[ALLOW_STALE]; + + if (as) { + str += '\n allowStale: true'; + extras = true; + } + + var max = this[MAX]; + + if (max && max !== Infinity) { + if (extras) { + str += ','; + } + + str += '\n max: ' + util$4.inspect(max, opts); + extras = true; + } + + var maxAge = this[MAX_AGE]; + + if (maxAge) { + if (extras) { + str += ','; + } + + str += '\n maxAge: ' + util$4.inspect(maxAge, opts); + extras = true; + } + + var lc = this[LENGTH_CALCULATOR]; + + if (lc && lc !== naiveLength) { + if (extras) { + str += ','; + } + + str += '\n length: ' + util$4.inspect(this[LENGTH], opts); + extras = true; + } + + var didFirst = false; + this[LRU_LIST].forEach(function (item) { + if (didFirst) { + str += ',\n '; + } else { + if (extras) { + str += ',\n'; + } + + didFirst = true; + str += '\n '; + } + + var key = util$4.inspect(item.key).split('\n').join('\n '); + var val = { + value: item.value + }; + + if (item.maxAge !== maxAge) { + val.maxAge = item.maxAge; + } + + if (lc !== naiveLength) { + val.length = item.length; + } + + if (isStale(this, item)) { + val.stale = true; + } + + val = util$4.inspect(val, opts).split('\n').join('\n '); + str += key + ' => ' + val; + }); + + if (didFirst || extras) { + str += '\n'; + } + + str += '}'; + return str; +}; + +LRUCache.prototype.set = function (key, value, maxAge) { + maxAge = maxAge || this[MAX_AGE]; + var now = maxAge ? Date.now() : 0; + var len = this[LENGTH_CALCULATOR](value, key); + + if (this[CACHE].has(key)) { + if (len > this[MAX]) { + del(this, this[CACHE].get(key)); + return false; + } + + var node = this[CACHE].get(key); + var item = node.value; // dispose of the old one before overwriting + // split out into 2 ifs for better coverage tracking + + if (this[DISPOSE]) { + if (!this[NO_DISPOSE_ON_SET]) { + this[DISPOSE](key, item.value); + } + } + + item.now = now; + item.maxAge = maxAge; + item.value = value; + this[LENGTH] += len - item.length; + item.length = len; + this.get(key); + trim$2(this); + return true; + } + + var hit = new Entry$1(key, value, len, now, maxAge); // oversized objects fall out of cache automatically. + + if (hit.length > this[MAX]) { + if (this[DISPOSE]) { + this[DISPOSE](key, value); + } + + return false; + } + + this[LENGTH] += hit.length; + this[LRU_LIST].unshift(hit); + this[CACHE].set(key, this[LRU_LIST].head); + trim$2(this); + return true; +}; + +LRUCache.prototype.has = function (key) { + if (!this[CACHE].has(key)) return false; + var hit = this[CACHE].get(key).value; + + if (isStale(this, hit)) { + return false; + } + + return true; +}; + +LRUCache.prototype.get = function (key) { + return get(this, key, true); +}; + +LRUCache.prototype.peek = function (key) { + return get(this, key, false); +}; + +LRUCache.prototype.pop = function () { + var node = this[LRU_LIST].tail; + if (!node) return null; + del(this, node); + return node.value; +}; + +LRUCache.prototype.del = function (key) { + del(this, this[CACHE].get(key)); +}; + +LRUCache.prototype.load = function (arr) { + // reset the cache + this.reset(); + var now = Date.now(); // A previous serialized cache has the most recent items first + + for (var l = arr.length - 1; l >= 0; l--) { + var hit = arr[l]; + var expiresAt = hit.e || 0; + + if (expiresAt === 0) { + // the item was created without expiration in a non aged cache + this.set(hit.k, hit.v); + } else { + var maxAge = expiresAt - now; // dont add already expired items + + if (maxAge > 0) { + this.set(hit.k, hit.v, maxAge); + } + } + } +}; + +LRUCache.prototype.prune = function () { + var self = this; + this[CACHE].forEach(function (value, key) { + get(self, key, false); + }); +}; + +function get(self, key, doUse) { + var node = self[CACHE].get(key); + + if (node) { + var hit = node.value; + + if (isStale(self, hit)) { + del(self, node); + if (!self[ALLOW_STALE]) hit = undefined; + } else { + if (doUse) { + self[LRU_LIST].unshiftNode(node); + } + } + + if (hit) hit = hit.value; + } + + return hit; +} + +function isStale(self, hit) { + if (!hit || !hit.maxAge && !self[MAX_AGE]) { + return false; + } + + var stale = false; + var diff = Date.now() - hit.now; + + if (hit.maxAge) { + stale = diff > hit.maxAge; + } else { + stale = self[MAX_AGE] && diff > self[MAX_AGE]; + } + + return stale; +} + +function trim$2(self) { + if (self[LENGTH] > self[MAX]) { + for (var walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) { + // We know that we're about to delete this one, and also + // what the next least recently used key will be, so just + // go ahead and set it now. + var prev = walker.prev; + del(self, walker); + walker = prev; + } + } +} + +function del(self, node) { + if (node) { + var hit = node.value; + + if (self[DISPOSE]) { + self[DISPOSE](hit.key, hit.value); + } + + self[LENGTH] -= hit.length; + self[CACHE].delete(hit.key); + self[LRU_LIST].removeNode(node); + } +} // classy, since V8 prefers predictable objects. + + +function Entry$1(key, value, length, now, maxAge) { + this.key = key; + this.value = value; + this.length = length; + this.now = now; + this.maxAge = maxAge || 0; +} + +var sigmund_1 = sigmund; + +function sigmund(subject, maxSessions) { + maxSessions = maxSessions || 10; + var notes = []; + var analysis = ''; + var RE = RegExp; + + function psychoAnalyze(subject, session) { + if (session > maxSessions) return; + + if (typeof subject === 'function' || typeof subject === 'undefined') { + return; + } + + if (typeof subject !== 'object' || !subject || subject instanceof RE) { + analysis += subject; + return; + } + + if (notes.indexOf(subject) !== -1 || session === maxSessions) return; + notes.push(subject); + analysis += '{'; + Object.keys(subject).forEach(function (issue, _, __) { + // pseudo-private values. skip those. + if (issue.charAt(0) === '_') return; + var to = typeof subject[issue]; + if (to === 'function' || to === 'undefined') return; + analysis += issue; + psychoAnalyze(subject[issue], session + 1); + }); + } + + psychoAnalyze(subject, 0); + return analysis; +} // vim: set softtabstop=4 shiftwidth=4: + +var fnmatch = createCommonjsModule(function (module, exports) { + // Based on minimatch.js by isaacs + var platform = typeof process === "object" ? process.platform : "win32"; + if (module) module.exports = minimatch;else exports.minimatch = minimatch; + minimatch.Minimatch = Minimatch; + var cache = minimatch.cache = new lruCache({ + max: 100 + }), + GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}; + var qmark = "[^/]" // * => any number of characters + , + star = qmark + "*?" // ** when dots are allowed. Anything goes, except .. and . + // not (^ or / followed by one or two dots followed by $ or /), + // followed by anything, any number of times. + , + twoStarDot = "(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?" // not a ^ or / followed by a dot, + // followed by anything, any number of times. + , + twoStarNoDot = "(?:(?!(?:\\\/|^)\\.).)*?" // characters that need to be escaped in RegExp. + , + reSpecials = charSet("().*{}+?[]^$\\!"); // "abc" -> { a:true, b:true, c:true } + + function charSet(s) { + return s.split("").reduce(function (set, c) { + set[c] = true; + return set; + }, {}); + } // normalizes slashes. + + + var slashSplit = /\/+/; + minimatch.monkeyPatch = monkeyPatch; + + function monkeyPatch() { + var desc = Object.getOwnPropertyDescriptor(String.prototype, "match"); + var orig = desc.value; + + desc.value = function (p) { + if (p instanceof Minimatch) return p.match(this); + return orig.call(this, p); + }; + + Object.defineProperty(String.prototype, desc); + } + + minimatch.filter = filter; + + function filter(pattern, options) { + options = options || {}; + return function (p, i, list) { + return minimatch(p, pattern, options); + }; + } + + function ext(a, b) { + a = a || {}; + b = b || {}; + var t = {}; + Object.keys(b).forEach(function (k) { + t[k] = b[k]; + }); + Object.keys(a).forEach(function (k) { + t[k] = a[k]; + }); + return t; + } + + minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch; + var orig = minimatch; + + var m = function minimatch(p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)); + }; + + m.Minimatch = function Minimatch(pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)); + }; + + return m; + }; + + Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch; + return minimatch.defaults(def).Minimatch; + }; + + function minimatch(p, pattern, options) { + if (typeof pattern !== "string") { + throw new TypeError("glob pattern string required"); + } + + if (!options) options = {}; // shortcut: comments match nothing. + + if (!options.nocomment && pattern.charAt(0) === "#") { + return false; + } // "" only matches "" + + + if (pattern.trim() === "") return p === ""; + return new Minimatch(pattern, options).match(p); + } + + function Minimatch(pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options, cache); + } + + if (typeof pattern !== "string") { + throw new TypeError("glob pattern string required"); + } + + if (!options) options = {}; // windows: need to use /, not \ + // On other platforms, \ is a valid (albeit bad) filename char. + + if (platform === "win32") { + pattern = pattern.split("\\").join("/"); + } // lru storage. + // these things aren't particularly big, but walking down the string + // and turning it into a regexp can get pretty costly. + + + var cacheKey = pattern + "\n" + sigmund_1(options); + var cached = minimatch.cache.get(cacheKey); + if (cached) return cached; + minimatch.cache.set(cacheKey, this); + this.options = options; + this.set = []; + this.pattern = pattern; + this.regexp = null; + this.negate = false; + this.comment = false; + this.empty = false; // make the set of regexps etc. + + this.make(); + } + + Minimatch.prototype.make = make; + + function make() { + // don't do it more than once. + if (this._made) return; + var pattern = this.pattern; + var options = this.options; // empty patterns and comments match nothing. + + if (!options.nocomment && pattern.charAt(0) === "#") { + this.comment = true; + return; + } + + if (!pattern) { + this.empty = true; + return; + } // step 1: figure out negation, etc. + + + this.parseNegate(); // step 2: expand braces + + var set = this.globSet = this.braceExpand(); + if (options.debug) console.error(this.pattern, set); // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + + set = this.globParts = set.map(function (s) { + return s.split(slashSplit); + }); + if (options.debug) console.error(this.pattern, set); // glob --> regexps + + set = set.map(function (s, si, set) { + return s.map(this.parse, this); + }, this); + if (options.debug) console.error(this.pattern, set); // filter out everything that didn't compile properly. + + set = set.filter(function (s) { + return -1 === s.indexOf(false); + }); + if (options.debug) console.error(this.pattern, set); + this.set = set; + } + + Minimatch.prototype.parseNegate = parseNegate; + + function parseNegate() { + var pattern = this.pattern, + negate = false, + options = this.options, + negateOffset = 0; + if (options.nonegate) return; + + for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) { + negate = !negate; + negateOffset++; + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset); + this.negate = negate; + } // Brace expansion: + // a{b,c}d -> abd acd + // a{b,}c -> abc ac + // a{0..3}d -> a0d a1d a2d a3d + // a{b,c{d,e}f}g -> abg acdfg acefg + // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg + // + // Invalid sets are not expanded. + // a{2..}b -> a{2..}b + // a{b}c -> a{b}c + + + minimatch.braceExpand = function (pattern, options) { + return new Minimatch(pattern, options).braceExpand(); + }; + + Minimatch.prototype.braceExpand = braceExpand; + + function braceExpand(pattern, options) { + options = options || this.options; + pattern = typeof pattern === "undefined" ? this.pattern : pattern; + + if (typeof pattern === "undefined") { + throw new Error("undefined pattern"); + } + + if (options.nobrace || !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern]; + } + + var escaping = false; // examples and comments refer to this crazy pattern: + // a{b,c{d,e},{f,g}h}x{y,z} + // expected: + // abxy + // abxz + // acdxy + // acdxz + // acexy + // acexz + // afhxy + // afhxz + // aghxy + // aghxz + // everything before the first \{ is just a prefix. + // So, we pluck that off, and work with the rest, + // and then prepend it to everything we find. + + if (pattern.charAt(0) !== "{") { + // console.error(pattern) + var prefix = null; + + for (var i = 0, l = pattern.length; i < l; i++) { + var c = pattern.charAt(i); // console.error(i, c) + + if (c === "\\") { + escaping = !escaping; + } else if (c === "{" && !escaping) { + prefix = pattern.substr(0, i); + break; + } + } // actually no sets, all { were escaped. + + + if (prefix === null) { + // console.error("no sets") + return [pattern]; + } + + var tail = braceExpand(pattern.substr(i), options); + return tail.map(function (t) { + return prefix + t; + }); + } // now we have something like: + // {b,c{d,e},{f,g}h}x{y,z} + // walk through the set, expanding each part, until + // the set ends. then, we'll expand the suffix. + // If the set only has a single member, then'll put the {} back + // first, handle numeric sets, since they're easier + + + var numset = pattern.match(/^\{(-?[0-9]+)\.\.(-?[0-9]+)\}/); + + if (numset) { + // console.error("numset", numset[1], numset[2]) + var suf = braceExpand(pattern.substr(numset[0].length), options), + start = +numset[1], + end = +numset[2], + inc = start > end ? -1 : 1, + set = []; + + for (var i = start; i != end + inc; i += inc) { + // append all the suffixes + for (var ii = 0, ll = suf.length; ii < ll; ii++) { + set.push(i + suf[ii]); + } + } + + return set; + } // ok, walk through the set + // We hope, somewhat optimistically, that there + // will be a } at the end. + // If the closing brace isn't found, then the pattern is + // interpreted as braceExpand("\\" + pattern) so that + // the leading \{ will be interpreted literally. + + + var i = 1 // skip the \{ + , + depth = 1, + set = [], + member = "", + escaping = false; + + function addMember() { + set.push(member); + member = ""; + } // console.error("Entering for") + + + FOR: for (i = 1, l = pattern.length; i < l; i++) { + var c = pattern.charAt(i); // console.error("", i, c) + + if (escaping) { + escaping = false; + member += "\\" + c; + } else { + switch (c) { + case "\\": + escaping = true; + continue; + + case "{": + depth++; + member += "{"; + continue; + + case "}": + depth--; // if this closes the actual set, then we're done + + if (depth === 0) { + addMember(); // pluck off the close-brace + + i++; + break FOR; + } else { + member += c; + continue; + } + + case ",": + if (depth === 1) { + addMember(); + } else { + member += c; + } + + continue; + + default: + member += c; + continue; + } // switch + + } // else + + } // for + // now we've either finished the set, and the suffix is + // pattern.substr(i), or we have *not* closed the set, + // and need to escape the leading brace + + + if (depth !== 0) { + // console.error("didn't close", pattern) + return braceExpand("\\" + pattern, options); + } // x{y,z} -> ["xy", "xz"] + // console.error("set", set) + // console.error("suffix", pattern.substr(i)) + + + var suf = braceExpand(pattern.substr(i), options); // ["b", "c{d,e}","{f,g}h"] -> + // [["b"], ["cd", "ce"], ["fh", "gh"]] + + var addBraces = set.length === 1; // console.error("set pre-expanded", set) + + set = set.map(function (p) { + return braceExpand(p, options); + }); // console.error("set expanded", set) + // [["b"], ["cd", "ce"], ["fh", "gh"]] -> + // ["b", "cd", "ce", "fh", "gh"] + + set = set.reduce(function (l, r) { + return l.concat(r); + }); + + if (addBraces) { + set = set.map(function (s) { + return "{" + s + "}"; + }); + } // now attach the suffixes. + + + var ret = []; + + for (var i = 0, l = set.length; i < l; i++) { + for (var ii = 0, ll = suf.length; ii < ll; ii++) { + ret.push(set[i] + suf[ii]); + } + } + + return ret; + } // parse a component of the expanded set. + // At this point, no pattern may contain "/" in it + // so we're going to return a 2d array, where each entry is the full + // pattern, split on '/', and then turned into a regular expression. + // A regexp is made at the end which joins each array with an + // escaped /, and another full one which joins each regexp with |. + // + // Following the lead of Bash 4.1, note that "**" only has special meaning + // when it is the *only* thing in a path portion. Otherwise, any series + // of * is equivalent to a single *. Globstar behavior is enabled by + // default, and can be disabled by setting options.noglobstar. + + + Minimatch.prototype.parse = parse; + var SUBPARSE = {}; + + function parse(pattern, isSub) { + var options = this.options; // shortcuts + + if (!options.noglobstar && pattern === "**") return GLOBSTAR; + if (pattern === "") return ""; + var re = "", + hasMagic = !!options.nocase, + escaping = false // ? => one single character + , + patternListStack = [], + plType, + stateChar, + inClass = false, + reClassStart = -1, + classStart = -1 // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + , + patternStart = pattern.charAt(0) === "." ? "" // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? "(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))" : "(?!\\.)"; + + function clearStateChar() { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case "*": + re += star; + hasMagic = true; + break; + + case "?": + re += qmark; + hasMagic = true; + break; + + default: + re += "\\" + stateChar; + break; + } + + stateChar = false; + } + } + + for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) { + if (options.debug) { + console.error("%s\t%s %s %j", pattern, i, re, c); + } // skip over any that are escaped. + + + if (escaping && reSpecials[c]) { + re += "\\" + c; + escaping = false; + continue; + } + + switch (c) { + case "/": + // completely not allowed, even escaped. + // Should already be path-split by now. + return false; + + case "\\": + clearStateChar(); + escaping = true; + continue; + // the various stateChar values + // for the "extglob" stuff. + + case "?": + case "*": + case "+": + case "@": + case "!": + if (options.debug) { + console.error("%s\t%s %s %j <-- stateChar", pattern, i, re, c); + } // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + + + if (inClass) { + if (c === "!" && i === classStart + 1) c = "^"; + re += c; + continue; + } // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + + + clearStateChar(); + stateChar = c; // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + + if (options.noext) clearStateChar(); + continue; + + case "(": + if (inClass) { + re += "("; + continue; + } + + if (!stateChar) { + re += "\\("; + continue; + } + + plType = stateChar; + patternListStack.push({ + type: plType, + start: i - 1, + reStart: re.length + }); // negation is (?:(?!js)[^/]*) + + re += stateChar === "!" ? "(?:(?!" : "(?:"; + stateChar = false; + continue; + + case ")": + if (inClass || !patternListStack.length) { + re += "\\)"; + continue; + } + + hasMagic = true; + re += ")"; + plType = patternListStack.pop().type; // negation is (?:(?!js)[^/]*) + // The others are (?:) + + switch (plType) { + case "!": + re += "[^/]*?)"; + break; + + case "?": + case "+": + case "*": + re += plType; + // the default anyway + } + + continue; + + case "|": + if (inClass || !patternListStack.length || escaping) { + re += "\\|"; + escaping = false; + continue; + } + + re += "|"; + continue; + // these are mostly the same in regexp and glob + + case "[": + // swallow any state-tracking char before the [ + clearStateChar(); + + if (inClass) { + re += "\\" + c; + continue; + } + + inClass = true; + classStart = i; + reClassStart = re.length; + re += c; + continue; + + case "]": + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += "\\" + c; + escaping = false; + continue; + } // finish up the class. + + + hasMagic = true; + inClass = false; + re += c; + continue; + + default: + // swallow any state char that wasn't consumed + clearStateChar(); + + if (escaping) { + // no need + escaping = false; + } else if (reSpecials[c] && !(c === "^" && inClass)) { + re += "\\"; + } + + re += c; + } // switch + + } // for + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + + + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + var cs = pattern.substr(classStart + 1), + sp = this.parse(cs, SUBPARSE); + re = re.substr(0, reClassStart) + "\\[" + sp[0]; + hasMagic = hasMagic || sp[1]; + } // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + + + var pl; + + while (pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3); // maybe some even number of \, then maybe 1 \, followed by a | + + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = "\\"; + } // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + + + return $1 + $1 + $2 + "|"; + }); // console.error("tail=%j\n %s", tail, tail) + + var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type; + hasMagic = true; + re = re.slice(0, pl.reStart) + t + "\\(" + tail; + } // handle trailing things that only matter at the very end. + + + clearStateChar(); + + if (escaping) { + // trailing \\ + re += "\\\\"; + } // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + + + var addPatternStart = false; + + switch (re.charAt(0)) { + case ".": + case "[": + case "(": + addPatternStart = true; + } // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + + + if (re !== "" && hasMagic) re = "(?=.)" + re; + if (addPatternStart) re = patternStart + re; // parsing just a piece of a larger pattern. + + if (isSub === SUBPARSE) { + return [re, hasMagic]; + } // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + + + if (!hasMagic) { + return globUnescape(pattern); + } + + var flags = options.nocase ? "i" : "", + regExp = new RegExp("^" + re + "$", flags); + regExp._glob = pattern; + regExp._src = re; + return regExp; + } + + minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe(); + }; + + Minimatch.prototype.makeRe = makeRe; + + function makeRe() { + if (this.regexp || this.regexp === false) return this.regexp; // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + + var set = this.set; + if (!set.length) return this.regexp = false; + var options = this.options; + var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot, + flags = options.nocase ? "i" : ""; + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src; + }).join("\\\/"); + }).join("|"); // must match entire pattern + // ending in a * or ** will make it less strict. + + re = "^(?:" + re + ")$"; // can match anything, as long as it's not this. + + if (this.negate) re = "^(?!" + re + ").*$"; + + try { + return this.regexp = new RegExp(re, flags); + } catch (ex) { + return this.regexp = false; + } + } + + minimatch.match = function (list, pattern, options) { + var mm = new Minimatch(pattern, options); + list = list.filter(function (f) { + return mm.match(f); + }); + + if (options.nonull && !list.length) { + list.push(pattern); + } + + return list; + }; + + Minimatch.prototype.match = match; + + function match(f, partial) { + // console.error("match", f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false; + if (this.empty) return f === ""; + if (f === "/" && partial) return true; + var options = this.options; // windows: need to use /, not \ + // On other platforms, \ is a valid (albeit bad) filename char. + + if (platform === "win32") { + f = f.split("\\").join("/"); + } // treat the test path as a set of pathparts. + + + f = f.split(slashSplit); + + if (options.debug) { + console.error(this.pattern, "split", f); + } // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + + var set = this.set; // console.error(this.pattern, "set", set) + + for (var i = 0, l = set.length; i < l; i++) { + var pattern = set[i]; + var hit = this.matchOne(f, pattern, partial); + + if (hit) { + if (options.flipNegate) return true; + return !this.negate; + } + } // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + + + if (options.flipNegate) return false; + return this.negate; + } // set partial to true to test if, for example, + // "/a/b" matches the start of "/*/b/*/d" + // Partial means, if you run out of file before you run + // out of pattern, then that's fine, as long as all + // the parts match. + + + Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options; + + if (options.debug) { + console.error("matchOne", { + "this": this, + file: file, + pattern: pattern + }); + } + + if (options.matchBase && pattern.length === 1) { + file = path$2.basename(file.join("/")).split("/"); + } + + if (options.debug) { + console.error("matchOne", file.length, pattern.length); + } + + for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) { + if (options.debug) { + console.error("matchOne loop"); + } + + var p = pattern[pi], + f = file[fi]; + + if (options.debug) { + console.error(pattern, p, f); + } // should be impossible. + // some invalid regexp stuff in the set. + + + if (p === false) return false; + + if (p === GLOBSTAR) { + if (options.debug) console.error('GLOBSTAR', [pattern, p, f]); // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + + var fr = fi, + pr = pi + 1; + + if (pr === pl) { + if (options.debug) console.error('** at the end'); // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + + for (; fi < fl; fi++) { + if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false; + } + + return true; + } // ok, let's see if we can swallow whatever we can. + + + WHILE: while (fr < fl) { + var swallowee = file[fr]; + + if (options.debug) { + console.error('\nglobstar while', file, fr, pattern, pr, swallowee); + } // XXX remove this slice. Just pass the start index. + + + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + if (options.debug) console.error('globstar found match!', fr, fl, swallowee); // found a match. + + return true; + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") { + if (options.debug) console.error("dot detected!", file, fr, pattern, pr); + break WHILE; + } // ** swallows a segment, and continue. + + + if (options.debug) console.error('globstar swallow a segment, and continue'); + fr++; + } + } // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + + + if (partial) { + // ran out of file + // console.error("\n>>> no match, partial?", file, fr, pattern, pr) + if (fr === fl) return true; + } + + return false; + } // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + + + var hit; + + if (typeof p === "string") { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase(); + } else { + hit = f === p; + } + + if (options.debug) { + console.error("string match", p, f, hit); + } + } else { + hit = f.match(p); + + if (options.debug) { + console.error("pattern match", p, f, hit); + } + } + + if (!hit) return false; + } // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + // now either we fell off the end of the pattern, or we're done. + + + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true; + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial; + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = fi === fl - 1 && file[fi] === ""; + return emptyFileEnd; + } // should be unreachable. + + + throw new Error("wtf?"); + }; // replace stuff like \* with * + + + function globUnescape(s) { + return s.replace(/\\(.)/g, "$1"); + } + + function regExpEscape(s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + } +}); +var fnmatch_1 = fnmatch.minimatch; + +var ini = createCommonjsModule(function (module, exports) { + + var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : new P(function (resolve) { + resolve(result.value); + }).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + var __generator = this && this.__generator || function (thisArg, body) { + var _ = { + label: 0, + sent: function () { + if (t[0] & 1) throw t[1]; + return t[1]; + }, + trys: [], + ops: [] + }, + f, + y, + t, + g; + return g = { + next: verb(0), + "throw": verb(1), + "return": verb(2) + }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { + return this; + }), g; + + function verb(n) { + return function (v) { + return step([n, v]); + }; + } + + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + + switch (op[0]) { + case 0: + case 1: + t = op; + break; + + case 4: + _.label++; + return { + value: op[1], + done: false + }; + + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + + case 7: + op = _.ops.pop(); + + _.trys.pop(); + + continue; + + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + + if (t && _.label < t[2]) { + _.label = t[2]; + + _.ops.push(op); + + break; + } + + if (t[2]) _.ops.pop(); + + _.trys.pop(); + + continue; + } + + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + + if (op[0] & 5) throw op[1]; + return { + value: op[0] ? op[1] : void 0, + done: true + }; + } + }; + + var __importStar = this && this.__importStar || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; + }; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var fs = __importStar(fs$3); + /** + * define the possible values: + * section: [section] + * param: key=value + * comment: ;this is a comment + */ + + + var regex = { + section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/, + param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/, + comment: /^\s*[#;].*$/ + }; + /** + * Parses an .ini file + * @param file The location of the .ini file + */ + + function parse(file) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 + /*return*/ + , new Promise(function (resolve, reject) { + fs.readFile(file, 'utf8', function (err, data) { + if (err) { + reject(err); + return; + } + + resolve(parseString(data)); + }); + })]; + }); + }); + } + + exports.parse = parse; + + function parseSync(file) { + return parseString(fs.readFileSync(file, 'utf8')); + } + + exports.parseSync = parseSync; + + function parseString(data) { + var sectionBody = {}; + var sectionName = null; + var value = [[sectionName, sectionBody]]; + var lines = data.split(/\r\n|\r|\n/); + lines.forEach(function (line) { + var match; + + if (regex.comment.test(line)) { + return; + } + + if (regex.param.test(line)) { + match = line.match(regex.param); + sectionBody[match[1]] = match[2]; + } else if (regex.section.test(line)) { + match = line.match(regex.section); + sectionName = match[1]; + sectionBody = {}; + value.push([sectionName, sectionBody]); + } + }); + return value; + } + + exports.parseString = parseString; +}); +unwrapExports(ini); +var ini_1 = ini.parse; +var ini_2 = ini.parseSync; +var ini_3 = ini.parseString; + +var name$1 = "editorconfig"; +var version$1 = "0.15.3"; +var description$1 = "EditorConfig File Locator and Interpreter for Node.js"; +var keywords = [ + "editorconfig", + "core" +]; +var main$1 = "src/index.js"; +var contributors = [ + "Hong Xu (topbug.net)", + "Jed Mao (https://github.com/jedmao/)", + "Trey Hunner (http://treyhunner.com)" +]; +var directories = { + bin: "./bin", + lib: "./lib" +}; +var scripts$1 = { + clean: "rimraf dist", + prebuild: "npm run clean", + build: "tsc", + pretest: "npm run lint && npm run build && npm run copy && cmake .", + test: "ctest .", + "pretest:ci": "npm run pretest", + "test:ci": "ctest -VV --output-on-failure .", + lint: "npm run eclint && npm run tslint", + eclint: "eclint check --indent_size ignore \"src/**\"", + tslint: "tslint --project tsconfig.json --exclude package.json", + copy: "cpy .npmignore LICENSE README.md CHANGELOG.md dist && cpy bin/* dist/bin && cpy src/lib/fnmatch*.* dist/src/lib", + prepub: "npm run lint && npm run build && npm run copy", + pub: "npm publish ./dist" +}; +var repository$1 = { + type: "git", + url: "git://github.com/editorconfig/editorconfig-core-js.git" +}; +var bugs = "https://github.com/editorconfig/editorconfig-core-js/issues"; +var author$1 = "EditorConfig Team"; +var license$1 = "MIT"; +var dependencies$1 = { + commander: "^2.19.0", + "lru-cache": "^4.1.5", + semver: "^5.6.0", + sigmund: "^1.0.1" +}; +var devDependencies$1 = { + "@types/mocha": "^5.2.6", + "@types/node": "^10.12.29", + "@types/semver": "^5.5.0", + "cpy-cli": "^2.0.0", + eclint: "^2.8.1", + mocha: "^5.2.0", + rimraf: "^2.6.3", + should: "^13.2.3", + tslint: "^5.13.1", + typescript: "^3.3.3333" +}; +var _package$2 = { + name: name$1, + version: version$1, + description: description$1, + keywords: keywords, + main: main$1, + contributors: contributors, + directories: directories, + scripts: scripts$1, + repository: repository$1, + bugs: bugs, + author: author$1, + license: license$1, + dependencies: dependencies$1, + devDependencies: devDependencies$1 +}; + +var _package$3 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$1, + version: version$1, + description: description$1, + keywords: keywords, + main: main$1, + contributors: contributors, + directories: directories, + scripts: scripts$1, + repository: repository$1, + bugs: bugs, + author: author$1, + license: license$1, + dependencies: dependencies$1, + devDependencies: devDependencies$1, + 'default': _package$2 +}); + +var require$$4 = getCjsExportFromNamespace(_package$3); + +var src = createCommonjsModule(function (module, exports) { + + var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : new P(function (resolve) { + resolve(result.value); + }).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + var __generator = this && this.__generator || function (thisArg, body) { + var _ = { + label: 0, + sent: function () { + if (t[0] & 1) throw t[1]; + return t[1]; + }, + trys: [], + ops: [] + }, + f, + y, + t, + g; + return g = { + next: verb(0), + "throw": verb(1), + "return": verb(2) + }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { + return this; + }), g; + + function verb(n) { + return function (v) { + return step([n, v]); + }; + } + + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + + switch (op[0]) { + case 0: + case 1: + t = op; + break; + + case 4: + _.label++; + return { + value: op[1], + done: false + }; + + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + + case 7: + op = _.ops.pop(); + + _.trys.pop(); + + continue; + + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + + if (t && _.label < t[2]) { + _.label = t[2]; + + _.ops.push(op); + + break; + } + + if (t[2]) _.ops.pop(); + + _.trys.pop(); + + continue; + } + + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + + if (op[0] & 5) throw op[1]; + return { + value: op[0] ? op[1] : void 0, + done: true + }; + } + }; + + var __importStar = this && this.__importStar || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; + }; + + var __importDefault = this && this.__importDefault || function (mod) { + return mod && mod.__esModule ? mod : { + "default": mod + }; + }; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var fs = __importStar(fs$3); + + var path = __importStar(path$2); + + var semver = __importStar(semver$2); + + var fnmatch_1 = __importDefault(fnmatch); + + exports.parseString = ini.parseString; + + var package_json_1 = __importDefault(require$$4); + + var knownProps = { + end_of_line: true, + indent_style: true, + indent_size: true, + insert_final_newline: true, + trim_trailing_whitespace: true, + charset: true + }; + + function fnmatch$1(filepath, glob) { + var matchOptions = { + matchBase: true, + dot: true, + noext: true + }; + glob = glob.replace(/\*\*/g, '{*,**/**/**}'); + return fnmatch_1.default(filepath, glob, matchOptions); + } + + function getConfigFileNames(filepath, options) { + var paths = []; + + do { + filepath = path.dirname(filepath); + paths.push(path.join(filepath, options.config)); + } while (filepath !== options.root); + + return paths; + } + + function processMatches(matches, version) { + // Set indent_size to 'tab' if indent_size is unspecified and + // indent_style is set to 'tab'. + if ('indent_style' in matches && matches.indent_style === 'tab' && !('indent_size' in matches) && semver.gte(version, '0.10.0')) { + matches.indent_size = 'tab'; + } // Set tab_width to indent_size if indent_size is specified and + // tab_width is unspecified + + + if ('indent_size' in matches && !('tab_width' in matches) && matches.indent_size !== 'tab') { + matches.tab_width = matches.indent_size; + } // Set indent_size to tab_width if indent_size is 'tab' + + + if ('indent_size' in matches && 'tab_width' in matches && matches.indent_size === 'tab') { + matches.indent_size = matches.tab_width; + } + + return matches; + } + + function processOptions(options, filepath) { + if (options === void 0) { + options = {}; + } + + return { + config: options.config || '.editorconfig', + version: options.version || package_json_1.default.version, + root: path.resolve(options.root || path.parse(filepath).root) + }; + } + + function buildFullGlob(pathPrefix, glob) { + switch (glob.indexOf('/')) { + case -1: + glob = '**/' + glob; + break; + + case 0: + glob = glob.substring(1); + break; + } + + return path.join(pathPrefix, glob); + } + + function extendProps(props, options) { + if (props === void 0) { + props = {}; + } + + if (options === void 0) { + options = {}; + } + + for (var key in options) { + if (options.hasOwnProperty(key)) { + var value = options[key]; + var key2 = key.toLowerCase(); + var value2 = value; + + if (knownProps[key2]) { + value2 = value.toLowerCase(); + } + + try { + value2 = JSON.parse(value); + } catch (e) {} + + if (typeof value === 'undefined' || value === null) { + // null and undefined are values specific to JSON (no special meaning + // in editorconfig) & should just be returned as regular strings. + value2 = String(value); + } + + props[key2] = value2; + } + } + + return props; + } + + function parseFromConfigs(configs, filepath, options) { + return processMatches(configs.reverse().reduce(function (matches, file) { + var pathPrefix = path.dirname(file.name); + file.contents.forEach(function (section) { + var glob = section[0]; + var options2 = section[1]; + + if (!glob) { + return; + } + + var fullGlob = buildFullGlob(pathPrefix, glob); + + if (!fnmatch$1(filepath, fullGlob)) { + return; + } + + matches = extendProps(matches, options2); + }); + return matches; + }, {}), options.version); + } + + function getConfigsForFiles(files) { + var configs = []; + + for (var i in files) { + if (files.hasOwnProperty(i)) { + var file = files[i]; + var contents = ini.parseString(file.contents); + configs.push({ + name: file.name, + contents: contents + }); + + if ((contents[0][1].root || '').toLowerCase() === 'true') { + break; + } + } + } + + return configs; + } + + function readConfigFiles(filepaths) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 + /*return*/ + , Promise.all(filepaths.map(function (name) { + return new Promise(function (resolve) { + fs.readFile(name, 'utf8', function (err, data) { + resolve({ + name: name, + contents: err ? '' : data + }); + }); + }); + }))]; + }); + }); + } + + function readConfigFilesSync(filepaths) { + var files = []; + var file; + filepaths.forEach(function (filepath) { + try { + file = fs.readFileSync(filepath, 'utf8'); + } catch (e) { + file = ''; + } + + files.push({ + name: filepath, + contents: file + }); + }); + return files; + } + + function opts(filepath, options) { + if (options === void 0) { + options = {}; + } + + var resolvedFilePath = path.resolve(filepath); + return [resolvedFilePath, processOptions(options, resolvedFilePath)]; + } + + function parseFromFiles(filepath, files, options) { + if (options === void 0) { + options = {}; + } + + return __awaiter(this, void 0, void 0, function () { + var _a, resolvedFilePath, processedOptions; + + return __generator(this, function (_b) { + _a = opts(filepath, options), resolvedFilePath = _a[0], processedOptions = _a[1]; + return [2 + /*return*/ + , files.then(getConfigsForFiles).then(function (configs) { + return parseFromConfigs(configs, resolvedFilePath, processedOptions); + })]; + }); + }); + } + + exports.parseFromFiles = parseFromFiles; + + function parseFromFilesSync(filepath, files, options) { + if (options === void 0) { + options = {}; + } + + var _a = opts(filepath, options), + resolvedFilePath = _a[0], + processedOptions = _a[1]; + + return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions); + } + + exports.parseFromFilesSync = parseFromFilesSync; + + function parse(_filepath, _options) { + if (_options === void 0) { + _options = {}; + } + + return __awaiter(this, void 0, void 0, function () { + var _a, resolvedFilePath, processedOptions, filepaths; + + return __generator(this, function (_b) { + _a = opts(_filepath, _options), resolvedFilePath = _a[0], processedOptions = _a[1]; + filepaths = getConfigFileNames(resolvedFilePath, processedOptions); + return [2 + /*return*/ + , readConfigFiles(filepaths).then(getConfigsForFiles).then(function (configs) { + return parseFromConfigs(configs, resolvedFilePath, processedOptions); + })]; + }); + }); + } + + exports.parse = parse; + + function parseSync(_filepath, _options) { + if (_options === void 0) { + _options = {}; + } + + var _a = opts(_filepath, _options), + resolvedFilePath = _a[0], + processedOptions = _a[1]; + + var filepaths = getConfigFileNames(resolvedFilePath, processedOptions); + var files = readConfigFilesSync(filepaths); + return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions); + } + + exports.parseSync = parseSync; +}); +unwrapExports(src); +var src_1 = src.parseString; +var src_2 = src.parseFromFiles; +var src_3 = src.parseFromFilesSync; +var src_4 = src.parse; +var src_5 = src.parseSync; + +var editorconfigToPrettier = editorConfigToPrettier; + +function removeUnset(editorConfig) { + const result = {}; + const keys = Object.keys(editorConfig); + + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + + if (editorConfig[key] === "unset") { + continue; + } + + result[key] = editorConfig[key]; + } + + return result; +} + +function editorConfigToPrettier(editorConfig) { + if (!editorConfig) { + return null; + } + + editorConfig = removeUnset(editorConfig); + + if (Object.keys(editorConfig).length === 0) { + return null; + } + + const result = {}; + + if (editorConfig.indent_style) { + result.useTabs = editorConfig.indent_style === "tab"; + } + + if (editorConfig.indent_size === "tab") { + result.useTabs = true; + } + + if (result.useTabs && editorConfig.tab_width) { + result.tabWidth = editorConfig.tab_width; + } else if (editorConfig.indent_style === "space" && editorConfig.indent_size && editorConfig.indent_size !== "tab") { + result.tabWidth = editorConfig.indent_size; + } else if (editorConfig.tab_width !== undefined) { + result.tabWidth = editorConfig.tab_width; + } + + if (editorConfig.max_line_length && editorConfig.max_line_length !== "off") { + result.printWidth = editorConfig.max_line_length; + } + + if (editorConfig.quote_type === "single") { + result.singleQuote = true; + } else if (editorConfig.quote_type === "double") { + result.singleQuote = false; + } + + if (["cr", "crlf", "lf"].indexOf(editorConfig.end_of_line) !== -1) { + result.endOfLine = editorConfig.end_of_line; + } + + return result; +} + +function markerExists(files, markers) { + return markers.some(function (marker) { + return files.some(function (file) { + return file === marker; + }); + }); +} + +function traverseFolder(directory, levels, markers) { + var files = fs$3.readdirSync(directory); + + if (levels === 0) { + return null; + } else if (markerExists(files, markers)) { + return directory; + } else { + return traverseFolder(path$2.resolve(directory, '..'), levels - 1, markers); + } +} + +var findProjectRoot = function findRoot(dir, opts) { + if (!dir) throw new Error("Directory not defined"); + opts = opts || {}; + var levels = opts.maxDepth || findRoot.MAX_DEPTH; + var markers = opts.markers || findRoot.MARKERS; + return traverseFolder(dir, levels, markers); +}; + +var MAX_DEPTH = 9; +var MARKERS = ['.git', '.hg']; +findProjectRoot.MAX_DEPTH = MAX_DEPTH; +findProjectRoot.MARKERS = MARKERS; + +const jsonStringifyMem = fn => mem_1(fn, { + cacheKey: JSON.stringify +}); + +const maybeParse = (filePath, parse) => { + // findProjectRoot will throw an error if we pass a nonexistent directory to + // it, which is possible, for example, when the path is given via + // --stdin-filepath. So, first, traverse up until we find an existing + // directory. + let dirPath = path$2.dirname(path$2.resolve(filePath)); + const fsRoot = path$2.parse(dirPath).root; + + while (dirPath !== fsRoot && !fs$3.existsSync(dirPath)) { + dirPath = path$2.dirname(dirPath); + } + + const root = findProjectRoot(dirPath); + return filePath && parse(filePath, { + root + }); +}; + +const editorconfigAsyncNoCache = async filePath => { + const editorConfig = await maybeParse(filePath, src.parse); + return editorconfigToPrettier(editorConfig); +}; + +const editorconfigAsyncWithCache = jsonStringifyMem(editorconfigAsyncNoCache); + +const editorconfigSyncNoCache = filePath => { + return editorconfigToPrettier(maybeParse(filePath, src.parseSync)); +}; + +const editorconfigSyncWithCache = jsonStringifyMem(editorconfigSyncNoCache); + +function getLoadFunction(opts) { + if (!opts.editorconfig) { + return () => null; + } + + if (opts.sync) { + return opts.cache ? editorconfigSyncWithCache : editorconfigSyncNoCache; + } + + return opts.cache ? editorconfigAsyncWithCache : editorconfigAsyncNoCache; +} + +function clearCache() { + mem_1.clear(editorconfigSyncWithCache); + mem_1.clear(editorconfigAsyncWithCache); +} + +var resolveConfigEditorconfig = { + getLoadFunction, + clearCache +}; + +const ParserEND = 0x110000; + +class ParserError extends Error { + /* istanbul ignore next */ + constructor(msg, filename, linenumber) { + super('[ParserError] ' + msg, filename, linenumber); + this.name = 'ParserError'; + this.code = 'ParserError'; + if (Error.captureStackTrace) Error.captureStackTrace(this, ParserError); + } + +} + +class State { + constructor(parser) { + this.parser = parser; + this.buf = ''; + this.returned = null; + this.result = null; + this.resultTable = null; + this.resultArr = null; + } + +} + +class Parser { + constructor() { + this.pos = 0; + this.col = 0; + this.line = 0; + this.obj = {}; + this.ctx = this.obj; + this.stack = []; + this._buf = ''; + this.char = null; + this.ii = 0; + this.state = new State(this.parseStart); + } + + parse(str) { + /* istanbul ignore next */ + if (str.length === 0 || str.length == null) return; + this._buf = String(str); + this.ii = -1; + this.char = -1; + let getNext; + + while (getNext === false || this.nextChar()) { + getNext = this.runOne(); + } + + this._buf = null; + } + + nextChar() { + if (this.char === 0x0A) { + ++this.line; + this.col = -1; + } + + ++this.ii; + this.char = this._buf.codePointAt(this.ii); + ++this.pos; + ++this.col; + return this.haveBuffer(); + } + + haveBuffer() { + return this.ii < this._buf.length; + } + + runOne() { + return this.state.parser.call(this, this.state.returned); + } + + finish() { + this.char = ParserEND; + let last; + + do { + last = this.state.parser; + this.runOne(); + } while (this.state.parser !== last); + + this.ctx = null; + this.state = null; + this._buf = null; + return this.obj; + } + + next(fn) { + /* istanbul ignore next */ + if (typeof fn !== 'function') throw new ParserError('Tried to set state to non-existent state: ' + JSON.stringify(fn)); + this.state.parser = fn; + } + + goto(fn) { + this.next(fn); + return this.runOne(); + } + + call(fn, returnWith) { + if (returnWith) this.next(returnWith); + this.stack.push(this.state); + this.state = new State(fn); + } + + callNow(fn, returnWith) { + this.call(fn, returnWith); + return this.runOne(); + } + + return(value) { + /* istanbul ignore next */ + if (this.stack.length === 0) throw this.error(new ParserError('Stack underflow')); + if (value === undefined) value = this.state.buf; + this.state = this.stack.pop(); + this.state.returned = value; + } + + returnNow(value) { + this.return(value); + return this.runOne(); + } + + consume() { + /* istanbul ignore next */ + if (this.char === ParserEND) throw this.error(new ParserError('Unexpected end-of-buffer')); + this.state.buf += this._buf[this.ii]; + } + + error(err) { + err.line = this.line; + err.col = this.col; + err.pos = this.pos; + return err; + } + /* istanbul ignore next */ + + + parseStart() { + throw new ParserError('Must declare a parseStart method'); + } + +} + +Parser.END = ParserEND; +Parser.Error = ParserError; +var parser$1 = Parser; + +var createDatetime = value => { + const date = new Date(value); + /* istanbul ignore if */ + + if (isNaN(date)) { + throw new TypeError('Invalid Datetime'); + } else { + return date; + } +}; + +var formatNum = (d, num) => { + num = String(num); + + while (num.length < d) num = '0' + num; + + return num; +}; + +class FloatingDateTime extends Date { + constructor(value) { + super(value + 'Z'); + this.isFloating = true; + } + + toISOString() { + const date = `${this.getUTCFullYear()}-${formatNum(2, this.getUTCMonth() + 1)}-${formatNum(2, this.getUTCDate())}`; + const time = `${formatNum(2, this.getUTCHours())}:${formatNum(2, this.getUTCMinutes())}:${formatNum(2, this.getUTCSeconds())}.${formatNum(3, this.getUTCMilliseconds())}`; + return `${date}T${time}`; + } + +} + +var createDatetimeFloat = value => { + const date = new FloatingDateTime(value); + /* istanbul ignore if */ + + if (isNaN(date)) { + throw new TypeError('Invalid Datetime'); + } else { + return date; + } +}; + +const DateTime = global.Date; + +class Date$1 extends DateTime { + constructor(value) { + super(value); + this.isDate = true; + } + + toISOString() { + return `${this.getUTCFullYear()}-${formatNum(2, this.getUTCMonth() + 1)}-${formatNum(2, this.getUTCDate())}`; + } + +} + +var createDate = value => { + const date = new Date$1(value); + /* istanbul ignore if */ + + if (isNaN(date)) { + throw new TypeError('Invalid Datetime'); + } else { + return date; + } +}; + +class Time extends Date { + constructor(value) { + super(`0000-01-01T${value}Z`); + this.isTime = true; + } + + toISOString() { + return `${formatNum(2, this.getUTCHours())}:${formatNum(2, this.getUTCMinutes())}:${formatNum(2, this.getUTCSeconds())}.${formatNum(3, this.getUTCMilliseconds())}`; + } + +} + +var createTime = value => { + const date = new Time(value); + /* istanbul ignore if */ + + if (isNaN(date)) { + throw new TypeError('Invalid Datetime'); + } else { + return date; + } +}; + +/* eslint-disable no-new-wrappers, no-eval, camelcase, operator-linebreak */ + + +var tomlParser = makeParserClass(parser$1); +var makeParserClass_1 = makeParserClass; + +class TomlError extends Error { + constructor(msg) { + super(msg); + this.name = 'TomlError'; + /* istanbul ignore next */ + + if (Error.captureStackTrace) Error.captureStackTrace(this, TomlError); + this.fromTOML = true; + this.wrapped = null; + } + +} + +TomlError.wrap = err => { + const terr = new TomlError(err.message); + terr.code = err.code; + terr.wrapped = err; + return terr; +}; + +var TomlError_1 = TomlError; +const CTRL_I = 0x09; +const CTRL_J = 0x0A; +const CTRL_M = 0x0D; +const CTRL_CHAR_BOUNDARY = 0x1F; // the last non-character in the latin1 region of unicode, except DEL + +const CHAR_SP = 0x20; +const CHAR_QUOT = 0x22; +const CHAR_NUM = 0x23; +const CHAR_APOS = 0x27; +const CHAR_PLUS = 0x2B; +const CHAR_COMMA = 0x2C; +const CHAR_HYPHEN = 0x2D; +const CHAR_PERIOD = 0x2E; +const CHAR_0 = 0x30; +const CHAR_1 = 0x31; +const CHAR_7 = 0x37; +const CHAR_9 = 0x39; +const CHAR_COLON = 0x3A; +const CHAR_EQUALS = 0x3D; +const CHAR_A = 0x41; +const CHAR_E = 0x45; +const CHAR_F = 0x46; +const CHAR_T = 0x54; +const CHAR_U = 0x55; +const CHAR_Z = 0x5A; +const CHAR_LOWBAR = 0x5F; +const CHAR_a = 0x61; +const CHAR_b = 0x62; +const CHAR_e = 0x65; +const CHAR_f = 0x66; +const CHAR_i = 0x69; +const CHAR_l = 0x6C; +const CHAR_n = 0x6E; +const CHAR_o = 0x6F; +const CHAR_r = 0x72; +const CHAR_s = 0x73; +const CHAR_t = 0x74; +const CHAR_u = 0x75; +const CHAR_x = 0x78; +const CHAR_z = 0x7A; +const CHAR_LCUB = 0x7B; +const CHAR_RCUB = 0x7D; +const CHAR_LSQB = 0x5B; +const CHAR_BSOL = 0x5C; +const CHAR_RSQB = 0x5D; +const CHAR_DEL = 0x7F; +const SURROGATE_FIRST = 0xD800; +const SURROGATE_LAST = 0xDFFF; +const escapes = { + [CHAR_b]: '\u0008', + [CHAR_t]: '\u0009', + [CHAR_n]: '\u000A', + [CHAR_f]: '\u000C', + [CHAR_r]: '\u000D', + [CHAR_QUOT]: '\u0022', + [CHAR_BSOL]: '\u005C' +}; + +function isDigit(cp) { + return cp >= CHAR_0 && cp <= CHAR_9; +} + +function isHexit(cp) { + return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9; +} + +function isBit(cp) { + return cp === CHAR_1 || cp === CHAR_0; +} + +function isOctit(cp) { + return cp >= CHAR_0 && cp <= CHAR_7; +} + +function isAlphaNumQuoteHyphen(cp) { + return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN; +} + +function isAlphaNumHyphen(cp) { + return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN; +} + +const _type = Symbol('type'); + +const _declared = Symbol('declared'); + +const hasOwnProperty$1 = Object.prototype.hasOwnProperty; +const defineProperty = Object.defineProperty; +const descriptor = { + configurable: true, + enumerable: true, + writable: true, + value: undefined +}; + +function hasKey(obj, key) { + if (hasOwnProperty$1.call(obj, key)) return true; + if (key === '__proto__') defineProperty(obj, '__proto__', descriptor); + return false; +} + +const INLINE_TABLE = Symbol('inline-table'); + +function InlineTable() { + return Object.defineProperties({}, { + [_type]: { + value: INLINE_TABLE + } + }); +} + +function isInlineTable(obj) { + if (obj === null || typeof obj !== 'object') return false; + return obj[_type] === INLINE_TABLE; +} + +const TABLE = Symbol('table'); + +function Table() { + return Object.defineProperties({}, { + [_type]: { + value: TABLE + }, + [_declared]: { + value: false, + writable: true + } + }); +} + +function isTable(obj) { + if (obj === null || typeof obj !== 'object') return false; + return obj[_type] === TABLE; +} + +const _contentType = Symbol('content-type'); + +const INLINE_LIST = Symbol('inline-list'); + +function InlineList(type) { + return Object.defineProperties([], { + [_type]: { + value: INLINE_LIST + }, + [_contentType]: { + value: type + } + }); +} + +function isInlineList(obj) { + if (obj === null || typeof obj !== 'object') return false; + return obj[_type] === INLINE_LIST; +} + +const LIST = Symbol('list'); + +function List() { + return Object.defineProperties([], { + [_type]: { + value: LIST + } + }); +} + +function isList(obj) { + if (obj === null || typeof obj !== 'object') return false; + return obj[_type] === LIST; +} // in an eval, to let bundlers not slurp in a util proxy + + +let _custom; + +try { + const utilInspect = eval("require('util').inspect"); + _custom = utilInspect.custom; +} catch (_) {} +/* eval require not available in transpiled bundle */ + +/* istanbul ignore next */ + + +const _inspect = _custom || 'inspect'; + +class BoxedBigInt { + constructor(value) { + try { + this.value = global.BigInt.asIntN(64, value); + } catch (_) { + /* istanbul ignore next */ + this.value = null; + } + + Object.defineProperty(this, _type, { + value: INTEGER + }); + } + + isNaN() { + return this.value === null; + } + /* istanbul ignore next */ + + + toString() { + return String(this.value); + } + /* istanbul ignore next */ + + + [_inspect]() { + return `[BigInt: ${this.toString()}]}`; + } + + valueOf() { + return this.value; + } + +} + +const INTEGER = Symbol('integer'); + +function Integer(value) { + let num = Number(value); // -0 is a float thing, not an int thing + + if (Object.is(num, -0)) num = 0; + /* istanbul ignore else */ + + if (global.BigInt && !Number.isSafeInteger(num)) { + return new BoxedBigInt(value); + } else { + /* istanbul ignore next */ + return Object.defineProperties(new Number(num), { + isNaN: { + value: function () { + return isNaN(this); + } + }, + [_type]: { + value: INTEGER + }, + [_inspect]: { + value: () => `[Integer: ${value}]` + } + }); + } +} + +function isInteger(obj) { + if (obj === null || typeof obj !== 'object') return false; + return obj[_type] === INTEGER; +} + +const FLOAT = Symbol('float'); + +function Float(value) { + /* istanbul ignore next */ + return Object.defineProperties(new Number(value), { + [_type]: { + value: FLOAT + }, + [_inspect]: { + value: () => `[Float: ${value}]` + } + }); +} + +function isFloat(obj) { + if (obj === null || typeof obj !== 'object') return false; + return obj[_type] === FLOAT; +} + +function tomlType(value) { + const type = typeof value; + + if (type === 'object') { + /* istanbul ignore if */ + if (value === null) return 'null'; + if (value instanceof Date) return 'datetime'; + /* istanbul ignore else */ + + if (_type in value) { + switch (value[_type]) { + case INLINE_TABLE: + return 'inline-table'; + + case INLINE_LIST: + return 'inline-list'; + + /* istanbul ignore next */ + + case TABLE: + return 'table'; + + /* istanbul ignore next */ + + case LIST: + return 'list'; + + case FLOAT: + return 'float'; + + case INTEGER: + return 'integer'; + } + } + } + + return type; +} + +function makeParserClass(Parser) { + class TOMLParser extends Parser { + constructor() { + super(); + this.ctx = this.obj = Table(); + } + /* MATCH HELPER */ + + + atEndOfWord() { + return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine(); + } + + atEndOfLine() { + return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M; + } + + parseStart() { + if (this.char === Parser.END) { + return null; + } else if (this.char === CHAR_LSQB) { + return this.call(this.parseTableOrList); + } else if (this.char === CHAR_NUM) { + return this.call(this.parseComment); + } else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) { + return null; + } else if (isAlphaNumQuoteHyphen(this.char)) { + return this.callNow(this.parseAssignStatement); + } else { + throw this.error(new TomlError(`Unknown character "${this.char}"`)); + } + } // HELPER, this strips any whitespace and comments to the end of the line + // then RETURNS. Last state in a production. + + + parseWhitespaceToEOL() { + if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) { + return null; + } else if (this.char === CHAR_NUM) { + return this.goto(this.parseComment); + } else if (this.char === Parser.END || this.char === CTRL_J) { + return this.return(); + } else { + throw this.error(new TomlError('Unexpected character, expected only whitespace or comments till end of line')); + } + } + /* ASSIGNMENT: key = value */ + + + parseAssignStatement() { + return this.callNow(this.parseAssign, this.recordAssignStatement); + } + + recordAssignStatement(kv) { + let target = this.ctx; + let finalKey = kv.key.pop(); + + for (let kw of kv.key) { + if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) { + throw this.error(new TomlError("Can't redefine existing key")); + } + + target = target[kw] = target[kw] || Table(); + } + + if (hasKey(target, finalKey)) { + throw this.error(new TomlError("Can't redefine existing key")); + } // unbox our numbers + + + if (isInteger(kv.value) || isFloat(kv.value)) { + target[finalKey] = kv.value.valueOf(); + } else { + target[finalKey] = kv.value; + } + + return this.goto(this.parseWhitespaceToEOL); + } + /* ASSSIGNMENT expression, key = value possibly inside an inline table */ + + + parseAssign() { + return this.callNow(this.parseKeyword, this.recordAssignKeyword); + } + + recordAssignKeyword(key) { + if (this.state.resultTable) { + this.state.resultTable.push(key); + } else { + this.state.resultTable = [key]; + } + + return this.goto(this.parseAssignKeywordPreDot); + } + + parseAssignKeywordPreDot() { + if (this.char === CHAR_PERIOD) { + return this.next(this.parseAssignKeywordPostDot); + } else if (this.char !== CHAR_SP && this.char !== CTRL_I) { + return this.goto(this.parseAssignEqual); + } + } + + parseAssignKeywordPostDot() { + if (this.char !== CHAR_SP && this.char !== CTRL_I) { + return this.callNow(this.parseKeyword, this.recordAssignKeyword); + } + } + + parseAssignEqual() { + if (this.char === CHAR_EQUALS) { + return this.next(this.parseAssignPreValue); + } else { + throw this.error(new TomlError('Invalid character, expected "="')); + } + } + + parseAssignPreValue() { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null; + } else { + return this.callNow(this.parseValue, this.recordAssignValue); + } + } + + recordAssignValue(value) { + return this.returnNow({ + key: this.state.resultTable, + value: value + }); + } + /* COMMENTS: #...eol */ + + + parseComment() { + do { + if (this.char === Parser.END || this.char === CTRL_J) { + return this.return(); + } + } while (this.nextChar()); + } + /* TABLES AND LISTS, [foo] and [[foo]] */ + + + parseTableOrList() { + if (this.char === CHAR_LSQB) { + this.next(this.parseList); + } else { + return this.goto(this.parseTable); + } + } + /* TABLE [foo.bar.baz] */ + + + parseTable() { + this.ctx = this.obj; + return this.goto(this.parseTableNext); + } + + parseTableNext() { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null; + } else { + return this.callNow(this.parseKeyword, this.parseTableMore); + } + } + + parseTableMore(keyword) { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null; + } else if (this.char === CHAR_RSQB) { + if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) { + throw this.error(new TomlError("Can't redefine existing key")); + } else { + this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table(); + this.ctx[_declared] = true; + } + + return this.next(this.parseWhitespaceToEOL); + } else if (this.char === CHAR_PERIOD) { + if (!hasKey(this.ctx, keyword)) { + this.ctx = this.ctx[keyword] = Table(); + } else if (isTable(this.ctx[keyword])) { + this.ctx = this.ctx[keyword]; + } else if (isList(this.ctx[keyword])) { + this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1]; + } else { + throw this.error(new TomlError("Can't redefine existing key")); + } + + return this.next(this.parseTableNext); + } else { + throw this.error(new TomlError('Unexpected character, expected whitespace, . or ]')); + } + } + /* LIST [[a.b.c]] */ + + + parseList() { + this.ctx = this.obj; + return this.goto(this.parseListNext); + } + + parseListNext() { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null; + } else { + return this.callNow(this.parseKeyword, this.parseListMore); + } + } + + parseListMore(keyword) { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null; + } else if (this.char === CHAR_RSQB) { + if (!hasKey(this.ctx, keyword)) { + this.ctx[keyword] = List(); + } + + if (isInlineList(this.ctx[keyword])) { + throw this.error(new TomlError("Can't extend an inline array")); + } else if (isList(this.ctx[keyword])) { + const next = Table(); + this.ctx[keyword].push(next); + this.ctx = next; + } else { + throw this.error(new TomlError("Can't redefine an existing key")); + } + + return this.next(this.parseListEnd); + } else if (this.char === CHAR_PERIOD) { + if (!hasKey(this.ctx, keyword)) { + this.ctx = this.ctx[keyword] = Table(); + } else if (isInlineList(this.ctx[keyword])) { + throw this.error(new TomlError("Can't extend an inline array")); + } else if (isInlineTable(this.ctx[keyword])) { + throw this.error(new TomlError("Can't extend an inline table")); + } else if (isList(this.ctx[keyword])) { + this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1]; + } else if (isTable(this.ctx[keyword])) { + this.ctx = this.ctx[keyword]; + } else { + throw this.error(new TomlError("Can't redefine an existing key")); + } + + return this.next(this.parseListNext); + } else { + throw this.error(new TomlError('Unexpected character, expected whitespace, . or ]')); + } + } + + parseListEnd(keyword) { + if (this.char === CHAR_RSQB) { + return this.next(this.parseWhitespaceToEOL); + } else { + throw this.error(new TomlError('Unexpected character, expected whitespace, . or ]')); + } + } + /* VALUE string, number, boolean, inline list, inline object */ + + + parseValue() { + if (this.char === Parser.END) { + throw this.error(new TomlError('Key without value')); + } else if (this.char === CHAR_QUOT) { + return this.next(this.parseDoubleString); + } + + if (this.char === CHAR_APOS) { + return this.next(this.parseSingleString); + } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) { + return this.goto(this.parseNumberSign); + } else if (this.char === CHAR_i) { + return this.next(this.parseInf); + } else if (this.char === CHAR_n) { + return this.next(this.parseNan); + } else if (isDigit(this.char)) { + return this.goto(this.parseNumberOrDateTime); + } else if (this.char === CHAR_t || this.char === CHAR_f) { + return this.goto(this.parseBoolean); + } else if (this.char === CHAR_LSQB) { + return this.call(this.parseInlineList, this.recordValue); + } else if (this.char === CHAR_LCUB) { + return this.call(this.parseInlineTable, this.recordValue); + } else { + throw this.error(new TomlError('Unexpected character, expecting string, number, datetime, boolean, inline array or inline table')); + } + } + + recordValue(value) { + return this.returnNow(value); + } + + parseInf() { + if (this.char === CHAR_n) { + return this.next(this.parseInf2); + } else { + throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"')); + } + } + + parseInf2() { + if (this.char === CHAR_f) { + if (this.state.buf === '-') { + return this.return(-Infinity); + } else { + return this.return(Infinity); + } + } else { + throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"')); + } + } + + parseNan() { + if (this.char === CHAR_a) { + return this.next(this.parseNan2); + } else { + throw this.error(new TomlError('Unexpected character, expected "nan"')); + } + } + + parseNan2() { + if (this.char === CHAR_n) { + return this.return(NaN); + } else { + throw this.error(new TomlError('Unexpected character, expected "nan"')); + } + } + /* KEYS, barewords or basic, literal, or dotted */ + + + parseKeyword() { + if (this.char === CHAR_QUOT) { + return this.next(this.parseBasicString); + } else if (this.char === CHAR_APOS) { + return this.next(this.parseLiteralString); + } else { + return this.goto(this.parseBareKey); + } + } + /* KEYS: barewords */ + + + parseBareKey() { + do { + if (this.char === Parser.END) { + throw this.error(new TomlError('Key ended without value')); + } else if (isAlphaNumHyphen(this.char)) { + this.consume(); + } else if (this.state.buf.length === 0) { + throw this.error(new TomlError('Empty bare keys are not allowed')); + } else { + return this.returnNow(); + } + } while (this.nextChar()); + } + /* STRINGS, single quoted (literal) */ + + + parseSingleString() { + if (this.char === CHAR_APOS) { + return this.next(this.parseLiteralMultiStringMaybe); + } else { + return this.goto(this.parseLiteralString); + } + } + + parseLiteralString() { + do { + if (this.char === CHAR_APOS) { + return this.return(); + } else if (this.atEndOfLine()) { + throw this.error(new TomlError('Unterminated string')); + } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) { + throw this.errorControlCharInString(); + } else { + this.consume(); + } + } while (this.nextChar()); + } + + parseLiteralMultiStringMaybe() { + if (this.char === CHAR_APOS) { + return this.next(this.parseLiteralMultiString); + } else { + return this.returnNow(); + } + } + + parseLiteralMultiString() { + if (this.char === CTRL_M) { + return null; + } else if (this.char === CTRL_J) { + return this.next(this.parseLiteralMultiStringContent); + } else { + return this.goto(this.parseLiteralMultiStringContent); + } + } + + parseLiteralMultiStringContent() { + do { + if (this.char === CHAR_APOS) { + return this.next(this.parseLiteralMultiEnd); + } else if (this.char === Parser.END) { + throw this.error(new TomlError('Unterminated multi-line string')); + } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) { + throw this.errorControlCharInString(); + } else { + this.consume(); + } + } while (this.nextChar()); + } + + parseLiteralMultiEnd() { + if (this.char === CHAR_APOS) { + return this.next(this.parseLiteralMultiEnd2); + } else { + this.state.buf += "'"; + return this.goto(this.parseLiteralMultiStringContent); + } + } + + parseLiteralMultiEnd2() { + if (this.char === CHAR_APOS) { + return this.return(); + } else { + this.state.buf += "''"; + return this.goto(this.parseLiteralMultiStringContent); + } + } + /* STRINGS double quoted */ + + + parseDoubleString() { + if (this.char === CHAR_QUOT) { + return this.next(this.parseMultiStringMaybe); + } else { + return this.goto(this.parseBasicString); + } + } + + parseBasicString() { + do { + if (this.char === CHAR_BSOL) { + return this.call(this.parseEscape, this.recordEscapeReplacement); + } else if (this.char === CHAR_QUOT) { + return this.return(); + } else if (this.atEndOfLine()) { + throw this.error(new TomlError('Unterminated string')); + } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) { + throw this.errorControlCharInString(); + } else { + this.consume(); + } + } while (this.nextChar()); + } + + recordEscapeReplacement(replacement) { + this.state.buf += replacement; + return this.goto(this.parseBasicString); + } + + parseMultiStringMaybe() { + if (this.char === CHAR_QUOT) { + return this.next(this.parseMultiString); + } else { + return this.returnNow(); + } + } + + parseMultiString() { + if (this.char === CTRL_M) { + return null; + } else if (this.char === CTRL_J) { + return this.next(this.parseMultiStringContent); + } else { + return this.goto(this.parseMultiStringContent); + } + } + + parseMultiStringContent() { + do { + if (this.char === CHAR_BSOL) { + return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement); + } else if (this.char === CHAR_QUOT) { + return this.next(this.parseMultiEnd); + } else if (this.char === Parser.END) { + throw this.error(new TomlError('Unterminated multi-line string')); + } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) { + throw this.errorControlCharInString(); + } else { + this.consume(); + } + } while (this.nextChar()); + } + + errorControlCharInString() { + let displayCode = '\\u00'; + + if (this.char < 16) { + displayCode += '0'; + } + + displayCode += this.char.toString(16); + return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`)); + } + + recordMultiEscapeReplacement(replacement) { + this.state.buf += replacement; + return this.goto(this.parseMultiStringContent); + } + + parseMultiEnd() { + if (this.char === CHAR_QUOT) { + return this.next(this.parseMultiEnd2); + } else { + this.state.buf += '"'; + return this.goto(this.parseMultiStringContent); + } + } + + parseMultiEnd2() { + if (this.char === CHAR_QUOT) { + return this.return(); + } else { + this.state.buf += '""'; + return this.goto(this.parseMultiStringContent); + } + } + + parseMultiEscape() { + if (this.char === CTRL_M || this.char === CTRL_J) { + return this.next(this.parseMultiTrim); + } else if (this.char === CHAR_SP || this.char === CTRL_I) { + return this.next(this.parsePreMultiTrim); + } else { + return this.goto(this.parseEscape); + } + } + + parsePreMultiTrim() { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null; + } else if (this.char === CTRL_M || this.char === CTRL_J) { + return this.next(this.parseMultiTrim); + } else { + throw this.error(new TomlError("Can't escape whitespace")); + } + } + + parseMultiTrim() { + // explicitly whitespace here, END should follow the same path as chars + if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) { + return null; + } else { + return this.returnNow(); + } + } + + parseEscape() { + if (this.char in escapes) { + return this.return(escapes[this.char]); + } else if (this.char === CHAR_u) { + return this.call(this.parseSmallUnicode, this.parseUnicodeReturn); + } else if (this.char === CHAR_U) { + return this.call(this.parseLargeUnicode, this.parseUnicodeReturn); + } else { + throw this.error(new TomlError('Unknown escape character: ' + this.char)); + } + } + + parseUnicodeReturn(char) { + try { + const codePoint = parseInt(char, 16); + + if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) { + throw this.error(new TomlError('Invalid unicode, character in range 0xD800 - 0xDFFF is reserved')); + } + + return this.returnNow(String.fromCodePoint(codePoint)); + } catch (err) { + throw this.error(TomlError.wrap(err)); + } + } + + parseSmallUnicode() { + if (!isHexit(this.char)) { + throw this.error(new TomlError('Invalid character in unicode sequence, expected hex')); + } else { + this.consume(); + if (this.state.buf.length >= 4) return this.return(); + } + } + + parseLargeUnicode() { + if (!isHexit(this.char)) { + throw this.error(new TomlError('Invalid character in unicode sequence, expected hex')); + } else { + this.consume(); + if (this.state.buf.length >= 8) return this.return(); + } + } + /* NUMBERS */ + + + parseNumberSign() { + this.consume(); + return this.next(this.parseMaybeSignedInfOrNan); + } + + parseMaybeSignedInfOrNan() { + if (this.char === CHAR_i) { + return this.next(this.parseInf); + } else if (this.char === CHAR_n) { + return this.next(this.parseNan); + } else { + return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart); + } + } + + parseNumberIntegerStart() { + if (this.char === CHAR_0) { + this.consume(); + return this.next(this.parseNumberIntegerExponentOrDecimal); + } else { + return this.goto(this.parseNumberInteger); + } + } + + parseNumberIntegerExponentOrDecimal() { + if (this.char === CHAR_PERIOD) { + this.consume(); + return this.call(this.parseNoUnder, this.parseNumberFloat); + } else if (this.char === CHAR_E || this.char === CHAR_e) { + this.consume(); + return this.next(this.parseNumberExponentSign); + } else { + return this.returnNow(Integer(this.state.buf)); + } + } + + parseNumberInteger() { + if (isDigit(this.char)) { + this.consume(); + } else if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnder); + } else if (this.char === CHAR_E || this.char === CHAR_e) { + this.consume(); + return this.next(this.parseNumberExponentSign); + } else if (this.char === CHAR_PERIOD) { + this.consume(); + return this.call(this.parseNoUnder, this.parseNumberFloat); + } else { + const result = Integer(this.state.buf); + /* istanbul ignore if */ + + if (result.isNaN()) { + throw this.error(new TomlError('Invalid number')); + } else { + return this.returnNow(result); + } + } + } + + parseNoUnder() { + if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) { + throw this.error(new TomlError('Unexpected character, expected digit')); + } else if (this.atEndOfWord()) { + throw this.error(new TomlError('Incomplete number')); + } + + return this.returnNow(); + } + + parseNumberFloat() { + if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnder, this.parseNumberFloat); + } else if (isDigit(this.char)) { + this.consume(); + } else if (this.char === CHAR_E || this.char === CHAR_e) { + this.consume(); + return this.next(this.parseNumberExponentSign); + } else { + return this.returnNow(Float(this.state.buf)); + } + } + + parseNumberExponentSign() { + if (isDigit(this.char)) { + return this.goto(this.parseNumberExponent); + } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) { + this.consume(); + this.call(this.parseNoUnder, this.parseNumberExponent); + } else { + throw this.error(new TomlError('Unexpected character, expected -, + or digit')); + } + } + + parseNumberExponent() { + if (isDigit(this.char)) { + this.consume(); + } else if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnder); + } else { + return this.returnNow(Float(this.state.buf)); + } + } + /* NUMBERS or DATETIMES */ + + + parseNumberOrDateTime() { + if (this.char === CHAR_0) { + this.consume(); + return this.next(this.parseNumberBaseOrDateTime); + } else { + return this.goto(this.parseNumberOrDateTimeOnly); + } + } + + parseNumberOrDateTimeOnly() { + // note, if two zeros are in a row then it MUST be a date + if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnder, this.parseNumberInteger); + } else if (isDigit(this.char)) { + this.consume(); + if (this.state.buf.length > 4) this.next(this.parseNumberInteger); + } else if (this.char === CHAR_E || this.char === CHAR_e) { + this.consume(); + return this.next(this.parseNumberExponentSign); + } else if (this.char === CHAR_PERIOD) { + this.consume(); + return this.call(this.parseNoUnder, this.parseNumberFloat); + } else if (this.char === CHAR_HYPHEN) { + return this.goto(this.parseDateTime); + } else if (this.char === CHAR_COLON) { + return this.goto(this.parseOnlyTimeHour); + } else { + return this.returnNow(Integer(this.state.buf)); + } + } + + parseDateTimeOnly() { + if (this.state.buf.length < 4) { + if (isDigit(this.char)) { + return this.consume(); + } else if (this.char === CHAR_COLON) { + return this.goto(this.parseOnlyTimeHour); + } else { + throw this.error(new TomlError('Expected digit while parsing year part of a date')); + } + } else { + if (this.char === CHAR_HYPHEN) { + return this.goto(this.parseDateTime); + } else { + throw this.error(new TomlError('Expected hyphen (-) while parsing year part of date')); + } + } + } + + parseNumberBaseOrDateTime() { + if (this.char === CHAR_b) { + this.consume(); + return this.call(this.parseNoUnder, this.parseIntegerBin); + } else if (this.char === CHAR_o) { + this.consume(); + return this.call(this.parseNoUnder, this.parseIntegerOct); + } else if (this.char === CHAR_x) { + this.consume(); + return this.call(this.parseNoUnder, this.parseIntegerHex); + } else if (this.char === CHAR_PERIOD) { + return this.goto(this.parseNumberInteger); + } else if (isDigit(this.char)) { + return this.goto(this.parseDateTimeOnly); + } else { + return this.returnNow(Integer(this.state.buf)); + } + } + + parseIntegerHex() { + if (isHexit(this.char)) { + this.consume(); + } else if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnder); + } else { + const result = Integer(this.state.buf); + /* istanbul ignore if */ + + if (result.isNaN()) { + throw this.error(new TomlError('Invalid number')); + } else { + return this.returnNow(result); + } + } + } + + parseIntegerOct() { + if (isOctit(this.char)) { + this.consume(); + } else if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnder); + } else { + const result = Integer(this.state.buf); + /* istanbul ignore if */ + + if (result.isNaN()) { + throw this.error(new TomlError('Invalid number')); + } else { + return this.returnNow(result); + } + } + } + + parseIntegerBin() { + if (isBit(this.char)) { + this.consume(); + } else if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnder); + } else { + const result = Integer(this.state.buf); + /* istanbul ignore if */ + + if (result.isNaN()) { + throw this.error(new TomlError('Invalid number')); + } else { + return this.returnNow(result); + } + } + } + /* DATETIME */ + + + parseDateTime() { + // we enter here having just consumed the year and about to consume the hyphen + if (this.state.buf.length < 4) { + throw this.error(new TomlError('Years less than 1000 must be zero padded to four characters')); + } + + this.state.result = this.state.buf; + this.state.buf = ''; + return this.next(this.parseDateMonth); + } + + parseDateMonth() { + if (this.char === CHAR_HYPHEN) { + if (this.state.buf.length < 2) { + throw this.error(new TomlError('Months less than 10 must be zero padded to two characters')); + } + + this.state.result += '-' + this.state.buf; + this.state.buf = ''; + return this.next(this.parseDateDay); + } else if (isDigit(this.char)) { + this.consume(); + } else { + throw this.error(new TomlError('Incomplete datetime')); + } + } + + parseDateDay() { + if (this.char === CHAR_T || this.char === CHAR_SP) { + if (this.state.buf.length < 2) { + throw this.error(new TomlError('Days less than 10 must be zero padded to two characters')); + } + + this.state.result += '-' + this.state.buf; + this.state.buf = ''; + return this.next(this.parseStartTimeHour); + } else if (this.atEndOfWord()) { + return this.return(createDate(this.state.result + '-' + this.state.buf)); + } else if (isDigit(this.char)) { + this.consume(); + } else { + throw this.error(new TomlError('Incomplete datetime')); + } + } + + parseStartTimeHour() { + if (this.atEndOfWord()) { + return this.returnNow(createDate(this.state.result)); + } else { + return this.goto(this.parseTimeHour); + } + } + + parseTimeHour() { + if (this.char === CHAR_COLON) { + if (this.state.buf.length < 2) { + throw this.error(new TomlError('Hours less than 10 must be zero padded to two characters')); + } + + this.state.result += 'T' + this.state.buf; + this.state.buf = ''; + return this.next(this.parseTimeMin); + } else if (isDigit(this.char)) { + this.consume(); + } else { + throw this.error(new TomlError('Incomplete datetime')); + } + } + + parseTimeMin() { + if (this.state.buf.length < 2 && isDigit(this.char)) { + this.consume(); + } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) { + this.state.result += ':' + this.state.buf; + this.state.buf = ''; + return this.next(this.parseTimeSec); + } else { + throw this.error(new TomlError('Incomplete datetime')); + } + } + + parseTimeSec() { + if (isDigit(this.char)) { + this.consume(); + + if (this.state.buf.length === 2) { + this.state.result += ':' + this.state.buf; + this.state.buf = ''; + return this.next(this.parseTimeZoneOrFraction); + } + } else { + throw this.error(new TomlError('Incomplete datetime')); + } + } + + parseOnlyTimeHour() { + /* istanbul ignore else */ + if (this.char === CHAR_COLON) { + if (this.state.buf.length < 2) { + throw this.error(new TomlError('Hours less than 10 must be zero padded to two characters')); + } + + this.state.result = this.state.buf; + this.state.buf = ''; + return this.next(this.parseOnlyTimeMin); + } else { + throw this.error(new TomlError('Incomplete time')); + } + } + + parseOnlyTimeMin() { + if (this.state.buf.length < 2 && isDigit(this.char)) { + this.consume(); + } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) { + this.state.result += ':' + this.state.buf; + this.state.buf = ''; + return this.next(this.parseOnlyTimeSec); + } else { + throw this.error(new TomlError('Incomplete time')); + } + } + + parseOnlyTimeSec() { + if (isDigit(this.char)) { + this.consume(); + + if (this.state.buf.length === 2) { + return this.next(this.parseOnlyTimeFractionMaybe); + } + } else { + throw this.error(new TomlError('Incomplete time')); + } + } + + parseOnlyTimeFractionMaybe() { + this.state.result += ':' + this.state.buf; + + if (this.char === CHAR_PERIOD) { + this.state.buf = ''; + this.next(this.parseOnlyTimeFraction); + } else { + return this.return(createTime(this.state.result)); + } + } + + parseOnlyTimeFraction() { + if (isDigit(this.char)) { + this.consume(); + } else if (this.atEndOfWord()) { + if (this.state.buf.length === 0) throw this.error(new TomlError('Expected digit in milliseconds')); + return this.returnNow(createTime(this.state.result + '.' + this.state.buf)); + } else { + throw this.error(new TomlError('Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z')); + } + } + + parseTimeZoneOrFraction() { + if (this.char === CHAR_PERIOD) { + this.consume(); + this.next(this.parseDateTimeFraction); + } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) { + this.consume(); + this.next(this.parseTimeZoneHour); + } else if (this.char === CHAR_Z) { + this.consume(); + return this.return(createDatetime(this.state.result + this.state.buf)); + } else if (this.atEndOfWord()) { + return this.returnNow(createDatetimeFloat(this.state.result + this.state.buf)); + } else { + throw this.error(new TomlError('Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z')); + } + } + + parseDateTimeFraction() { + if (isDigit(this.char)) { + this.consume(); + } else if (this.state.buf.length === 1) { + throw this.error(new TomlError('Expected digit in milliseconds')); + } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) { + this.consume(); + this.next(this.parseTimeZoneHour); + } else if (this.char === CHAR_Z) { + this.consume(); + return this.return(createDatetime(this.state.result + this.state.buf)); + } else if (this.atEndOfWord()) { + return this.returnNow(createDatetimeFloat(this.state.result + this.state.buf)); + } else { + throw this.error(new TomlError('Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z')); + } + } + + parseTimeZoneHour() { + if (isDigit(this.char)) { + this.consume(); // FIXME: No more regexps + + if (/\d\d$/.test(this.state.buf)) return this.next(this.parseTimeZoneSep); + } else { + throw this.error(new TomlError('Unexpected character in datetime, expected digit')); + } + } + + parseTimeZoneSep() { + if (this.char === CHAR_COLON) { + this.consume(); + this.next(this.parseTimeZoneMin); + } else { + throw this.error(new TomlError('Unexpected character in datetime, expected colon')); + } + } + + parseTimeZoneMin() { + if (isDigit(this.char)) { + this.consume(); + if (/\d\d$/.test(this.state.buf)) return this.return(createDatetime(this.state.result + this.state.buf)); + } else { + throw this.error(new TomlError('Unexpected character in datetime, expected digit')); + } + } + /* BOOLEAN */ + + + parseBoolean() { + /* istanbul ignore else */ + if (this.char === CHAR_t) { + this.consume(); + return this.next(this.parseTrue_r); + } else if (this.char === CHAR_f) { + this.consume(); + return this.next(this.parseFalse_a); + } + } + + parseTrue_r() { + if (this.char === CHAR_r) { + this.consume(); + return this.next(this.parseTrue_u); + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')); + } + } + + parseTrue_u() { + if (this.char === CHAR_u) { + this.consume(); + return this.next(this.parseTrue_e); + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')); + } + } + + parseTrue_e() { + if (this.char === CHAR_e) { + return this.return(true); + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')); + } + } + + parseFalse_a() { + if (this.char === CHAR_a) { + this.consume(); + return this.next(this.parseFalse_l); + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')); + } + } + + parseFalse_l() { + if (this.char === CHAR_l) { + this.consume(); + return this.next(this.parseFalse_s); + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')); + } + } + + parseFalse_s() { + if (this.char === CHAR_s) { + this.consume(); + return this.next(this.parseFalse_e); + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')); + } + } + + parseFalse_e() { + if (this.char === CHAR_e) { + return this.return(false); + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')); + } + } + /* INLINE LISTS */ + + + parseInlineList() { + if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) { + return null; + } else if (this.char === Parser.END) { + throw this.error(new TomlError('Unterminated inline array')); + } else if (this.char === CHAR_NUM) { + return this.call(this.parseComment); + } else if (this.char === CHAR_RSQB) { + return this.return(this.state.resultArr || InlineList()); + } else { + return this.callNow(this.parseValue, this.recordInlineListValue); + } + } + + recordInlineListValue(value) { + if (this.state.resultArr) { + const listType = this.state.resultArr[_contentType]; + const valueType = tomlType(value); + + if (listType !== valueType) { + throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`)); + } + } else { + this.state.resultArr = InlineList(tomlType(value)); + } + + if (isFloat(value) || isInteger(value)) { + // unbox now that we've verified they're ok + this.state.resultArr.push(value.valueOf()); + } else { + this.state.resultArr.push(value); + } + + return this.goto(this.parseInlineListNext); + } + + parseInlineListNext() { + if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) { + return null; + } else if (this.char === CHAR_NUM) { + return this.call(this.parseComment); + } else if (this.char === CHAR_COMMA) { + return this.next(this.parseInlineList); + } else if (this.char === CHAR_RSQB) { + return this.goto(this.parseInlineList); + } else { + throw this.error(new TomlError('Invalid character, expected whitespace, comma (,) or close bracket (])')); + } + } + /* INLINE TABLE */ + + + parseInlineTable() { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null; + } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) { + throw this.error(new TomlError('Unterminated inline array')); + } else if (this.char === CHAR_RCUB) { + return this.return(this.state.resultTable || InlineTable()); + } else { + if (!this.state.resultTable) this.state.resultTable = InlineTable(); + return this.callNow(this.parseAssign, this.recordInlineTableValue); + } + } + + recordInlineTableValue(kv) { + let target = this.state.resultTable; + let finalKey = kv.key.pop(); + + for (let kw of kv.key) { + if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) { + throw this.error(new TomlError("Can't redefine existing key")); + } + + target = target[kw] = target[kw] || Table(); + } + + if (hasKey(target, finalKey)) { + throw this.error(new TomlError("Can't redefine existing key")); + } + + if (isInteger(kv.value) || isFloat(kv.value)) { + target[finalKey] = kv.value.valueOf(); + } else { + target[finalKey] = kv.value; + } + + return this.goto(this.parseInlineTableNext); + } + + parseInlineTableNext() { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null; + } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) { + throw this.error(new TomlError('Unterminated inline array')); + } else if (this.char === CHAR_COMMA) { + return this.next(this.parseInlineTable); + } else if (this.char === CHAR_RCUB) { + return this.goto(this.parseInlineTable); + } else { + throw this.error(new TomlError('Invalid character, expected whitespace, comma (,) or close bracket (])')); + } + } + + } + + return TOMLParser; +} +tomlParser.makeParserClass = makeParserClass_1; +tomlParser.TomlError = TomlError_1; + +var parsePrettyError = prettyError; + +function prettyError(err, buf) { + /* istanbul ignore if */ + if (err.pos == null || err.line == null) return err; + let msg = err.message; + msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}:\n`; + /* istanbul ignore else */ + + if (buf && buf.split) { + const lines = buf.split(/\n/); + const lineNumWidth = String(Math.min(lines.length, err.line + 3)).length; + let linePadding = ' '; + + while (linePadding.length < lineNumWidth) linePadding += ' '; + + for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) { + let lineNum = String(ii + 1); + if (lineNum.length < lineNumWidth) lineNum = ' ' + lineNum; + + if (err.line === ii) { + msg += lineNum + '> ' + lines[ii] + '\n'; + msg += linePadding + ' '; + + for (let hh = 0; hh < err.col; ++hh) { + msg += ' '; + } + + msg += '^\n'; + } else { + msg += lineNum + ': ' + lines[ii] + '\n'; + } + } + } + + err.message = msg + '\n'; + return err; +} + +var parseString_1 = parseString; + +function parseString(str) { + if (global.Buffer && global.Buffer.isBuffer(str)) { + str = str.toString('utf8'); + } + + const parser = new tomlParser(); + + try { + parser.parse(str); + return parser.finish(); + } catch (err) { + throw parsePrettyError(err, str); + } +} + +var loadToml = function (filePath, content) { + try { + return parseString_1(content); + } catch (error) { + error.message = `TOML Error in ${filePath}:\n${error.message}`; + throw error; + } +}; + +var caller = function () { + // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi + var origPrepareStackTrace = Error.prepareStackTrace; + + Error.prepareStackTrace = function (_, stack) { + return stack; + }; + + var stack = new Error().stack; + Error.prepareStackTrace = origPrepareStackTrace; + return stack[2].getFileName(); +}; + +var pathParse = createCommonjsModule(function (module) { + + var isWindows = process.platform === 'win32'; // Regex to split a windows path into three parts: [*, device, slash, + // tail] windows-only + + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; // Regex to split the tail part of the above into [*, dir, basename, ext] + + var splitTailRe = /^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/; + var win32 = {}; // Function to split a filename into [root, dir, basename, ext] + + function win32SplitPath(filename) { + // Separate device+slash from tail + var result = splitDeviceRe.exec(filename), + device = (result[1] || '') + (result[2] || ''), + tail = result[3] || ''; // Split the tail into dir, basename and extension + + var result2 = splitTailRe.exec(tail), + dir = result2[1], + basename = result2[2], + ext = result2[3]; + return [device, dir, basename, ext]; + } + + win32.parse = function (pathString) { + if (typeof pathString !== 'string') { + throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString); + } + + var allParts = win32SplitPath(pathString); + + if (!allParts || allParts.length !== 4) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + + return { + root: allParts[0], + dir: allParts[0] + allParts[1].slice(0, -1), + base: allParts[2], + ext: allParts[3], + name: allParts[2].slice(0, allParts[2].length - allParts[3].length) + }; + }; // Split a filename into [root, dir, basename, ext], unix version + // 'root' is just a slash, or nothing. + + + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + var posix = {}; + + function posixSplitPath(filename) { + return splitPathRe.exec(filename).slice(1); + } + + posix.parse = function (pathString) { + if (typeof pathString !== 'string') { + throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString); + } + + var allParts = posixSplitPath(pathString); + + if (!allParts || allParts.length !== 4) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + + allParts[1] = allParts[1] || ''; + allParts[2] = allParts[2] || ''; + allParts[3] = allParts[3] || ''; + return { + root: allParts[0], + dir: allParts[0] + allParts[1].slice(0, -1), + base: allParts[2], + ext: allParts[3], + name: allParts[2].slice(0, allParts[2].length - allParts[3].length) + }; + }; + + if (isWindows) module.exports = win32.parse;else + /* posix */ + module.exports = posix.parse; + module.exports.posix = posix.parse; + module.exports.win32 = win32.parse; +}); +var pathParse_1 = pathParse.posix; +var pathParse_2 = pathParse.win32; + +var parse$2 = path$2.parse || pathParse; + +var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { + var prefix = '/'; + + if (/^([A-Za-z]:)/.test(absoluteStart)) { + prefix = ''; + } else if (/^\\\\/.test(absoluteStart)) { + prefix = '\\\\'; + } + + var paths = [absoluteStart]; + var parsed = parse$2(absoluteStart); + + while (parsed.dir !== paths[paths.length - 1]) { + paths.push(parsed.dir); + parsed = parse$2(parsed.dir); + } + + return paths.reduce(function (dirs, aPath) { + return dirs.concat(modules.map(function (moduleDir) { + return path$2.resolve(prefix, aPath, moduleDir); + })); + }, []); +}; + +var nodeModulesPaths = function nodeModulesPaths(start, opts, request) { + var modules = opts && opts.moduleDirectory ? [].concat(opts.moduleDirectory) : ['node_modules']; + + if (opts && typeof opts.paths === 'function') { + return opts.paths(request, start, function () { + return getNodeModulesDirs(start, modules); + }, opts); + } + + var dirs = getNodeModulesDirs(start, modules); + return opts && opts.paths ? dirs.concat(opts.paths) : dirs; +}; + +var normalizeOptions$2 = function (x, opts) { + /** + * This file is purposefully a passthrough. It's expected that third-party + * environments will override it at runtime in order to inject special logic + * into `resolve` (by manipulating the options). One such example is the PnP + * code path in Yarn. + */ + return opts || {}; +}; + +var assert = true; +var async_hooks = ">= 8"; +var buffer_ieee754 = "< 0.9.7"; +var buffer = true; +var child_process = true; +var cluster = true; +var console$1 = true; +var constants$1 = true; +var crypto = true; +var _debug_agent = ">= 1 && < 8"; +var _debugger = "< 8"; +var dgram = true; +var dns = true; +var domain = true; +var events = true; +var freelist = "< 6"; +var fs = true; +var _http_agent = ">= 0.11.1"; +var _http_client = ">= 0.11.1"; +var _http_common = ">= 0.11.1"; +var _http_incoming = ">= 0.11.1"; +var _http_outgoing = ">= 0.11.1"; +var _http_server = ">= 0.11.1"; +var http = true; +var http2 = ">= 8.8"; +var https = true; +var inspector = ">= 8.0.0"; +var _linklist = "< 8"; +var module$1 = true; +var net = true; +var os = true; +var path$1 = true; +var perf_hooks = ">= 8.5"; +var process$1 = ">= 1"; +var punycode = true; +var querystring = true; +var readline = true; +var repl = true; +var smalloc = ">= 0.11.5 && < 3"; +var _stream_duplex = ">= 0.9.4"; +var _stream_transform = ">= 0.9.4"; +var _stream_wrap = ">= 1.4.1"; +var _stream_passthrough = ">= 0.9.4"; +var _stream_readable = ">= 0.9.4"; +var _stream_writable = ">= 0.9.4"; +var stream = true; +var string_decoder = true; +var sys = true; +var timers = true; +var _tls_common = ">= 0.11.13"; +var _tls_legacy = ">= 0.11.3 && < 10"; +var _tls_wrap = ">= 0.11.3"; +var tls = true; +var trace_events = ">= 10"; +var tty = true; +var url = true; +var util$2 = true; +var v8 = ">= 1"; +var vm = true; +var wasi = ">= 13.4 && < 13.5"; +var worker_threads = ">= 11.7"; +var zlib = true; +var core$1 = { + assert: assert, + async_hooks: async_hooks, + buffer_ieee754: buffer_ieee754, + buffer: buffer, + child_process: child_process, + cluster: cluster, + console: console$1, + constants: constants$1, + crypto: crypto, + _debug_agent: _debug_agent, + _debugger: _debugger, + dgram: dgram, + dns: dns, + domain: domain, + events: events, + freelist: freelist, + fs: fs, + "fs/promises": [ + ">= 10 && < 10.1", + ">= 14" +], + _http_agent: _http_agent, + _http_client: _http_client, + _http_common: _http_common, + _http_incoming: _http_incoming, + _http_outgoing: _http_outgoing, + _http_server: _http_server, + http: http, + http2: http2, + https: https, + inspector: inspector, + _linklist: _linklist, + module: module$1, + net: net, + "node-inspect/lib/_inspect": ">= 7.6.0 && < 12", + "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12", + "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12", + os: os, + path: path$1, + perf_hooks: perf_hooks, + process: process$1, + punycode: punycode, + querystring: querystring, + readline: readline, + repl: repl, + smalloc: smalloc, + _stream_duplex: _stream_duplex, + _stream_transform: _stream_transform, + _stream_wrap: _stream_wrap, + _stream_passthrough: _stream_passthrough, + _stream_readable: _stream_readable, + _stream_writable: _stream_writable, + stream: stream, + string_decoder: string_decoder, + sys: sys, + timers: timers, + _tls_common: _tls_common, + _tls_legacy: _tls_legacy, + _tls_wrap: _tls_wrap, + tls: tls, + trace_events: trace_events, + tty: tty, + url: url, + util: util$2, + "v8/tools/arguments": ">= 10 && < 12", + "v8/tools/codemap": [ + ">= 4.4.0 && < 5", + ">= 5.2.0 && < 12" +], + "v8/tools/consarray": [ + ">= 4.4.0 && < 5", + ">= 5.2.0 && < 12" +], + "v8/tools/csvparser": [ + ">= 4.4.0 && < 5", + ">= 5.2.0 && < 12" +], + "v8/tools/logreader": [ + ">= 4.4.0 && < 5", + ">= 5.2.0 && < 12" +], + "v8/tools/profile_view": [ + ">= 4.4.0 && < 5", + ">= 5.2.0 && < 12" +], + "v8/tools/splaytree": [ + ">= 4.4.0 && < 5", + ">= 5.2.0 && < 12" +], + v8: v8, + vm: vm, + wasi: wasi, + worker_threads: worker_threads, + zlib: zlib +}; + +var core$2 = /*#__PURE__*/Object.freeze({ + __proto__: null, + assert: assert, + async_hooks: async_hooks, + buffer_ieee754: buffer_ieee754, + buffer: buffer, + child_process: child_process, + cluster: cluster, + console: console$1, + constants: constants$1, + crypto: crypto, + _debug_agent: _debug_agent, + _debugger: _debugger, + dgram: dgram, + dns: dns, + domain: domain, + events: events, + freelist: freelist, + fs: fs, + _http_agent: _http_agent, + _http_client: _http_client, + _http_common: _http_common, + _http_incoming: _http_incoming, + _http_outgoing: _http_outgoing, + _http_server: _http_server, + http: http, + http2: http2, + https: https, + inspector: inspector, + _linklist: _linklist, + module: module$1, + net: net, + os: os, + path: path$1, + perf_hooks: perf_hooks, + process: process$1, + punycode: punycode, + querystring: querystring, + readline: readline, + repl: repl, + smalloc: smalloc, + _stream_duplex: _stream_duplex, + _stream_transform: _stream_transform, + _stream_wrap: _stream_wrap, + _stream_passthrough: _stream_passthrough, + _stream_readable: _stream_readable, + _stream_writable: _stream_writable, + stream: stream, + string_decoder: string_decoder, + sys: sys, + timers: timers, + _tls_common: _tls_common, + _tls_legacy: _tls_legacy, + _tls_wrap: _tls_wrap, + tls: tls, + trace_events: trace_events, + tty: tty, + url: url, + util: util$2, + v8: v8, + vm: vm, + wasi: wasi, + worker_threads: worker_threads, + zlib: zlib, + 'default': core$1 +}); + +var data = getCjsExportFromNamespace(core$2); + +var current = process.versions && process.versions.node && process.versions.node.split('.') || []; + +function specifierIncluded(specifier) { + var parts = specifier.split(' '); + var op = parts.length > 1 ? parts[0] : '='; + var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); + + for (var i = 0; i < 3; ++i) { + var cur = Number(current[i] || 0); + var ver = Number(versionParts[i] || 0); + + if (cur === ver) { + continue; // eslint-disable-line no-restricted-syntax, no-continue + } + + if (op === '<') { + return cur < ver; + } else if (op === '>=') { + return cur >= ver; + } else { + return false; + } + } + + return op === '>='; +} + +function matchesRange(range) { + var specifiers = range.split(/ ?&& ?/); + + if (specifiers.length === 0) { + return false; + } + + for (var i = 0; i < specifiers.length; ++i) { + if (!specifierIncluded(specifiers[i])) { + return false; + } + } + + return true; +} + +function versionIncluded(specifierValue) { + if (typeof specifierValue === 'boolean') { + return specifierValue; + } + + if (specifierValue && typeof specifierValue === 'object') { + for (var i = 0; i < specifierValue.length; ++i) { + if (matchesRange(specifierValue[i])) { + return true; + } + } + + return false; + } + + return matchesRange(specifierValue); +} + +var core$3 = {}; + +for (var mod in data) { + // eslint-disable-line no-restricted-syntax + if (Object.prototype.hasOwnProperty.call(data, mod)) { + core$3[mod] = versionIncluded(data[mod]); + } +} + +var core_1 = core$3; + +var isCore = function isCore(x) { + return Object.prototype.hasOwnProperty.call(core_1, x); +}; + +var realpath = fs$3.realpath && typeof fs$3.realpath.native === 'function' ? fs$3.realpath.native : fs$3.realpath; + +var defaultIsFile = function isFile(file, cb) { + fs$3.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultIsDir = function isDirectory(dir, cb) { + fs$3.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var maybeUnwrapSymlink = function maybeUnwrapSymlink(x, opts, cb) { + if (opts && opts.preserveSymlinks === false) { + realpath(x, function (realPathErr, realPath) { + if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr);else cb(null, realPathErr ? x : realPath); + }); + } else { + cb(null, x); + } +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path$2.join(dirs[i], x); + } + + return dirs; +}; + +var async = function resolve(x, options, callback) { + var cb = callback; + var opts = options; + + if (typeof options === 'function') { + cb = opts; + opts = {}; + } + + if (typeof x !== 'string') { + var err = new TypeError('Path must be a string.'); + return process.nextTick(function () { + cb(err); + }); + } + + opts = normalizeOptions$2(x, opts); + var isFile = opts.isFile || defaultIsFile; + var isDirectory = opts.isDirectory || defaultIsDir; + var readFile = opts.readFile || fs$3.readFile; + var packageIterator = opts.packageIterator; + var extensions = opts.extensions || ['.js']; + var basedir = opts.basedir || path$2.dirname(caller()); + var parent = opts.filename || basedir; + opts.paths = opts.paths || []; // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + + var absoluteStart = path$2.resolve(basedir); + maybeUnwrapSymlink(absoluteStart, opts, function (err, realStart) { + if (err) cb(err);else init(realStart); + }); + var res; + + function init(basedir) { + if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) { + res = path$2.resolve(basedir, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + + if (/\/$/.test(x) && res === basedir) { + loadAsDirectory(res, opts.package, onfile); + } else loadAsFile(res, opts.package, onfile); + } else if (isCore(x)) { + return cb(null, x); + } else loadNodeModules(x, basedir, function (err, n, pkg) { + if (err) cb(err);else if (n) { + return maybeUnwrapSymlink(n, opts, function (err, realN) { + if (err) { + cb(err); + } else { + cb(null, realN, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function onfile(err, m, pkg) { + if (err) cb(err);else if (m) cb(null, m, pkg);else loadAsDirectory(res, function (err, d, pkg) { + if (err) cb(err);else if (d) { + maybeUnwrapSymlink(d, opts, function (err, realD) { + if (err) { + cb(err); + } else { + cb(null, realD, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function loadAsFile(x, thePackage, callback) { + var loadAsFilePackage = thePackage; + var cb = callback; + + if (typeof loadAsFilePackage === 'function') { + cb = loadAsFilePackage; + loadAsFilePackage = undefined; + } + + var exts = [''].concat(extensions); + load(exts, x, loadAsFilePackage); + + function load(exts, x, loadPackage) { + if (exts.length === 0) return cb(null, undefined, loadPackage); + var file = x + exts[0]; + var pkg = loadPackage; + if (pkg) onpkg(null, pkg);else loadpkg(path$2.dirname(file), onpkg); + + function onpkg(err, pkg_, dir) { + pkg = pkg_; + if (err) return cb(err); + + if (dir && pkg && opts.pathFilter) { + var rfile = path$2.relative(dir, file); + var rel = rfile.slice(0, rfile.length - exts[0].length); + var r = opts.pathFilter(pkg, x, rel); + if (r) return load([''].concat(extensions.slice()), path$2.resolve(dir, r), pkg); + } + + isFile(file, onex); + } + + function onex(err, ex) { + if (err) return cb(err); + if (ex) return cb(null, file, pkg); + load(exts.slice(1), x, pkg); + } + } + } + + function loadpkg(dir, cb) { + if (dir === '' || dir === '/') return cb(null); + + if (process.platform === 'win32' && /^\w:[/\\]*$/.test(dir)) { + return cb(null); + } + + if (/[/\\]node_modules[/\\]*$/.test(dir)) return cb(null); + maybeUnwrapSymlink(dir, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return loadpkg(path$2.dirname(dir), cb); + var pkgfile = path$2.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + // on err, ex is false + if (!ex) return loadpkg(path$2.dirname(dir), cb); + readFile(pkgfile, function (err, body) { + if (err) cb(err); + + try { + var pkg = JSON.parse(body); + } catch (jsonErr) {} + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + + cb(null, pkg, dir); + }); + }); + }); + } + + function loadAsDirectory(x, loadAsDirectoryPackage, callback) { + var cb = callback; + var fpkg = loadAsDirectoryPackage; + + if (typeof fpkg === 'function') { + cb = fpkg; + fpkg = opts.package; + } + + maybeUnwrapSymlink(x, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return cb(unwrapErr); + var pkgfile = path$2.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + if (err) return cb(err); + if (!ex) return loadAsFile(path$2.join(x, 'index'), fpkg, cb); + readFile(pkgfile, function (err, body) { + if (err) return cb(err); + + try { + var pkg = JSON.parse(body); + } catch (jsonErr) {} + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + return cb(mainError); + } + + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + + loadAsFile(path$2.resolve(x, pkg.main), pkg, function (err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + if (!pkg) return loadAsFile(path$2.join(x, 'index'), pkg, cb); + var dir = path$2.resolve(x, pkg.main); + loadAsDirectory(dir, pkg, function (err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + loadAsFile(path$2.join(x, 'index'), pkg, cb); + }); + }); + return; + } + + loadAsFile(path$2.join(x, '/index'), pkg, cb); + }); + }); + }); + } + + function processDirs(cb, dirs) { + if (dirs.length === 0) return cb(null, undefined); + var dir = dirs[0]; + isDirectory(path$2.dirname(dir), isdir); + + function isdir(err, isdir) { + if (err) return cb(err); + if (!isdir) return processDirs(cb, dirs.slice(1)); + loadAsFile(dir, opts.package, onfile); + } + + function onfile(err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + loadAsDirectory(dir, opts.package, ondir); + } + + function ondir(err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + processDirs(cb, dirs.slice(1)); + } + } + + function loadNodeModules(x, start, cb) { + var thunk = function () { + return getPackageCandidates(x, start, opts); + }; + + processDirs(cb, packageIterator ? packageIterator(x, start, thunk, opts) : thunk()); + } +}; + +var realpath$1 = fs$3.realpathSync && typeof fs$3.realpathSync.native === 'function' ? fs$3.realpathSync.native : fs$3.realpathSync; + +var defaultIsFile$1 = function isFile(file) { + try { + var stat = fs$3.statSync(file); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + + return stat.isFile() || stat.isFIFO(); +}; + +var defaultIsDir$1 = function isDirectory(dir) { + try { + var stat = fs$3.statSync(dir); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + + return stat.isDirectory(); +}; + +var maybeUnwrapSymlink$1 = function maybeUnwrapSymlink(x, opts) { + if (opts && opts.preserveSymlinks === false) { + try { + return realpath$1(x); + } catch (realPathErr) { + if (realPathErr.code !== 'ENOENT') { + throw realPathErr; + } + } + } + + return x; +}; + +var getPackageCandidates$1 = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path$2.join(dirs[i], x); + } + + return dirs; +}; + +var sync = function resolveSync(x, options) { + if (typeof x !== 'string') { + throw new TypeError('Path must be a string.'); + } + + var opts = normalizeOptions$2(x, options); + var isFile = opts.isFile || defaultIsFile$1; + var readFileSync = opts.readFileSync || fs$3.readFileSync; + var isDirectory = opts.isDirectory || defaultIsDir$1; + var packageIterator = opts.packageIterator; + var extensions = opts.extensions || ['.js']; + var basedir = opts.basedir || path$2.dirname(caller()); + var parent = opts.filename || basedir; + opts.paths = opts.paths || []; // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + + var absoluteStart = maybeUnwrapSymlink$1(path$2.resolve(basedir), opts); + + if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) { + var res = path$2.resolve(absoluteStart, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + var m = loadAsFileSync(res) || loadAsDirectorySync(res); + if (m) return maybeUnwrapSymlink$1(m, opts); + } else if (isCore(x)) { + return x; + } else { + var n = loadNodeModulesSync(x, absoluteStart); + if (n) return maybeUnwrapSymlink$1(n, opts); + } + + var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + + function loadAsFileSync(x) { + var pkg = loadpkg(path$2.dirname(x)); + + if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) { + var rfile = path$2.relative(pkg.dir, x); + var r = opts.pathFilter(pkg.pkg, x, rfile); + + if (r) { + x = path$2.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign + } + } + + if (isFile(x)) { + return x; + } + + for (var i = 0; i < extensions.length; i++) { + var file = x + extensions[i]; + + if (isFile(file)) { + return file; + } + } + } + + function loadpkg(dir) { + if (dir === '' || dir === '/') return; + + if (process.platform === 'win32' && /^\w:[/\\]*$/.test(dir)) { + return; + } + + if (/[/\\]node_modules[/\\]*$/.test(dir)) return; + var pkgfile = path$2.join(maybeUnwrapSymlink$1(dir, opts), 'package.json'); + + if (!isFile(pkgfile)) { + return loadpkg(path$2.dirname(dir)); + } + + var body = readFileSync(pkgfile); + + try { + var pkg = JSON.parse(body); + } catch (jsonErr) {} + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, + /*pkgfile,*/ + dir); // eslint-disable-line spaced-comment + } + + return { + pkg: pkg, + dir: dir + }; + } + + function loadAsDirectorySync(x) { + var pkgfile = path$2.join(maybeUnwrapSymlink$1(x, opts), '/package.json'); + + if (isFile(pkgfile)) { + try { + var body = readFileSync(pkgfile, 'UTF8'); + var pkg = JSON.parse(body); + } catch (e) {} + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, + /*pkgfile,*/ + x); // eslint-disable-line spaced-comment + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + throw mainError; + } + + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + + try { + var m = loadAsFileSync(path$2.resolve(x, pkg.main)); + if (m) return m; + var n = loadAsDirectorySync(path$2.resolve(x, pkg.main)); + if (n) return n; + } catch (e) {} + } + } + + return loadAsFileSync(path$2.join(x, '/index')); + } + + function loadNodeModulesSync(x, start) { + var thunk = function () { + return getPackageCandidates$1(x, start, opts); + }; + + var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk(); + + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + + if (isDirectory(path$2.dirname(dir))) { + var m = loadAsFileSync(dir); + if (m) return m; + var n = loadAsDirectorySync(dir); + if (n) return n; + } + } + } +}; + +async.core = core_1; +async.isCore = isCore; +async.sync = sync; +var resolve = async; + +// eslint-disable-next-line prefer-destructuring + + +let resolve$1 = require.resolve; // In the VS Code and Atom extensions `require` is overridden and `require.resolve` doesn't support the 2nd argument. + +if (resolve$1.length === 1 || process.env.PRETTIER_FALLBACK_RESOLVE) { + resolve$1 = (id, options) => { + let basedir; + + if (options && options.paths && options.paths.length === 1) { + basedir = options.paths[0]; + } + + return resolve.sync(id, { + basedir + }); + }; +} + +var resolve_1 = resolve$1; + +const getExplorerMemoized = mem_1(opts => { + const cosmiconfig = thirdParty["cosmiconfig" + (opts.sync ? "Sync" : "")]; + const explorer = cosmiconfig("prettier", { + cache: opts.cache, + transform: result => { + if (result && result.config) { + if (typeof result.config === "string") { + const dir = path$2.dirname(result.filepath); + + try { + const modulePath = resolve_1(result.config, { + paths: [dir] + }); + result.config = require(modulePath); + } catch (error) { + // Original message contains `__filename`, can't pass tests + error.message = `Cannot find module '${result.config}' from '${dir}'`; + throw error; + } + } + + if (typeof result.config !== "object") { + throw new Error("Config is only allowed to be an object, " + `but received ${typeof result.config} in "${result.filepath}"`); + } + + delete result.config.$schema; + } + + return result; + }, + searchPlaces: ["package.json", ".prettierrc", ".prettierrc.json", ".prettierrc.yaml", ".prettierrc.yml", ".prettierrc.js", "prettier.config.js", ".prettierrc.toml"], + loaders: { + ".toml": loadToml + } + }); + return explorer; +}, { + cacheKey: JSON.stringify +}); +/** @param {{ cache: boolean, sync: boolean }} opts */ + +function getExplorer(opts) { + // Normalize opts before passing to a memoized function + opts = Object.assign({ + sync: false, + cache: false + }, opts); + return getExplorerMemoized(opts); +} + +function _resolveConfig(filePath, opts, sync) { + opts = Object.assign({ + useCache: true + }, opts); + const loadOpts = { + cache: !!opts.useCache, + sync: !!sync, + editorconfig: !!opts.editorconfig + }; + const { + load, + search + } = getExplorer(loadOpts); + const loadEditorConfig = resolveConfigEditorconfig.getLoadFunction(loadOpts); + const arr = [opts.config ? load(opts.config) : search(filePath), loadEditorConfig(filePath)]; + + const unwrapAndMerge = ([result, editorConfigured]) => { + const merged = Object.assign({}, editorConfigured, {}, mergeOverrides(result, filePath)); + ["plugins", "pluginSearchDirs"].forEach(optionName => { + if (Array.isArray(merged[optionName])) { + merged[optionName] = merged[optionName].map(value => typeof value === "string" && value.startsWith(".") // relative path + ? path$2.resolve(path$2.dirname(result.filepath), value) : value); + } + }); + + if (!result && !editorConfigured) { + return null; + } + + return merged; + }; + + if (loadOpts.sync) { + return unwrapAndMerge(arr); + } + + return Promise.all(arr).then(unwrapAndMerge); +} + +const resolveConfig = (filePath, opts) => _resolveConfig(filePath, opts, false); + +resolveConfig.sync = (filePath, opts) => _resolveConfig(filePath, opts, true); + +function clearCache$1() { + mem_1.clear(getExplorerMemoized); + resolveConfigEditorconfig.clearCache(); +} + +async function resolveConfigFile(filePath) { + const { + search + } = getExplorer({ + sync: false + }); + const result = await search(filePath); + return result ? result.filepath : null; +} + +resolveConfigFile.sync = filePath => { + const { + search + } = getExplorer({ + sync: true + }); + const result = search(filePath); + return result ? result.filepath : null; +}; + +function mergeOverrides(configResult, filePath) { + const { + config, + filepath: configPath + } = configResult || {}; + + const _ref = config || {}, + { + overrides + } = _ref, + options = _objectWithoutPropertiesLoose(_ref, ["overrides"]); + + if (filePath && overrides) { + const relativeFilePath = path$2.relative(path$2.dirname(configPath), filePath); + + for (const override of overrides) { + if (pathMatchesGlobs(relativeFilePath, override.files, override.excludeFiles)) { + Object.assign(options, override.options); + } + } + } + + return options; +} // Based on eslint: https://github.com/eslint/eslint/blob/master/lib/config/config-ops.js + + +function pathMatchesGlobs(filePath, patterns, excludedPatterns) { + const patternList = [].concat(patterns); + const excludedPatternList = [].concat(excludedPatterns || []); + const opts = { + matchBase: true, + dot: true + }; + return patternList.some(pattern => minimatch_1(filePath, pattern, opts)) && !excludedPatternList.some(excludedPattern => minimatch_1(filePath, excludedPattern, opts)); +} + +var resolveConfig_1 = { + resolveConfig, + resolveConfigFile, + clearCache: clearCache$1 +}; + +/** + * @typedef {{ ignorePath?: string, withNodeModules?: boolean, plugins: object }} FileInfoOptions + * @typedef {{ ignored: boolean, inferredParser: string | null }} FileInfoResult + */ + +/** + * @param {string} filePath + * @param {FileInfoOptions} opts + * @returns {Promise} + * + * Please note that prettier.getFileInfo() expects opts.plugins to be an array of paths, + * not an object. A transformation from this array to an object is automatically done + * internally by the method wrapper. See withPlugins() in index.js. + */ + + +async function getFileInfo(filePath, opts) { + if (typeof filePath !== "string") { + throw new TypeError(`expect \`filePath\` to be a string, got \`${typeof filePath}\``); + } + + const ignorer = await createIgnorer_1(opts.ignorePath, opts.withNodeModules); + return _getFileInfo({ + ignorer, + filePath: normalizeFilePath(filePath, opts.ignorePath), + plugins: opts.plugins, + resolveConfig: opts.resolveConfig, + sync: false + }); +} +/** + * @param {string} filePath + * @param {FileInfoOptions} opts + * @returns {FileInfoResult} + */ + + +getFileInfo.sync = function (filePath, opts) { + if (typeof filePath !== "string") { + throw new TypeError(`expect \`filePath\` to be a string, got \`${typeof filePath}\``); + } + + const ignorer = createIgnorer_1.sync(opts.ignorePath, opts.withNodeModules); + return _getFileInfo({ + ignorer, + filePath: normalizeFilePath(filePath, opts.ignorePath), + plugins: opts.plugins, + resolveConfig: opts.resolveConfig, + sync: true + }); +}; + +function _getFileInfo({ + ignorer, + filePath, + plugins, + resolveConfig = false, + sync = false +}) { + const fileInfo = { + ignored: ignorer.ignores(filePath), + inferredParser: options$1.inferParser(filePath, plugins) || null + }; + + if (!fileInfo.inferredParser && resolveConfig) { + if (!sync) { + return resolveConfig_1.resolveConfig(filePath).then(resolvedConfig => { + if (resolvedConfig && resolvedConfig.parser) { + fileInfo.inferredParser = resolvedConfig.parser; + } + + return fileInfo; + }); + } + + const resolvedConfig = resolveConfig_1.resolveConfig.sync(filePath); + + if (resolvedConfig && resolvedConfig.parser) { + fileInfo.inferredParser = resolvedConfig.parser; + } + } + + return fileInfo; +} + +function normalizeFilePath(filePath, ignorePath) { + return ignorePath ? path$2.relative(path$2.dirname(ignorePath), filePath) : filePath; +} + +var getFileInfo_1 = getFileInfo; + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; + this.size = 0; +} + +var _listCacheClear = listCacheClear; + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || value !== value && other !== other; +} + +var eq_1 = eq; + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + +function assocIndexOf(array, key) { + var length = array.length; + + while (length--) { + if (eq_1(array[length][0], key)) { + return length; + } + } + + return -1; +} + +var _assocIndexOf = assocIndexOf; + +/** Used for built-in method references. */ + +var arrayProto = Array.prototype; +/** Built-in value references. */ + +var splice = arrayProto.splice; +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + +function listCacheDelete(key) { + var data = this.__data__, + index = _assocIndexOf(data, key); + + if (index < 0) { + return false; + } + + var lastIndex = data.length - 1; + + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + + --this.size; + return true; +} + +var _listCacheDelete = listCacheDelete; + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + +function listCacheGet(key) { + var data = this.__data__, + index = _assocIndexOf(data, key); + return index < 0 ? undefined : data[index][1]; +} + +var _listCacheGet = listCacheGet; + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + +function listCacheHas(key) { + return _assocIndexOf(this.__data__, key) > -1; +} + +var _listCacheHas = listCacheHas; + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ + +function listCacheSet(key, value) { + var data = this.__data__, + index = _assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + + return this; +} + +var _listCacheSet = listCacheSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + +function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + this.clear(); + + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} // Add methods to `ListCache`. + + +ListCache.prototype.clear = _listCacheClear; +ListCache.prototype['delete'] = _listCacheDelete; +ListCache.prototype.get = _listCacheGet; +ListCache.prototype.has = _listCacheHas; +ListCache.prototype.set = _listCacheSet; +var _ListCache = ListCache; + +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ + +function stackClear() { + this.__data__ = new _ListCache(); + this.size = 0; +} + +var _stackClear = stackClear; + +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function stackDelete(key) { + var data = this.__data__, + result = data['delete'](key); + this.size = data.size; + return result; +} + +var _stackDelete = stackDelete; + +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function stackGet(key) { + return this.__data__.get(key); +} + +var _stackGet = stackGet; + +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function stackHas(key) { + return this.__data__.has(key); +} + +var _stackHas = stackHas; + +/** Detect free variable `global` from Node.js. */ + +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; +var _freeGlobal = freeGlobal; + +/** Detect free variable `self`. */ + +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; +/** Used as a reference to the global object. */ + +var root = _freeGlobal || freeSelf || Function('return this')(); +var _root = root; + +/** Built-in value references. */ + +var Symbol$1 = _root.Symbol; +var _Symbol = Symbol$1; + +/** Used for built-in method references. */ + +var objectProto = Object.prototype; +/** Used to check objects for own properties. */ + +var hasOwnProperty$2 = objectProto.hasOwnProperty; +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + +var nativeObjectToString = objectProto.toString; +/** Built-in value references. */ + +var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined; +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ + +function getRawTag(value) { + var isOwn = hasOwnProperty$2.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + + return result; +} + +var _getRawTag = getRawTag; + +/** Used for built-in method references. */ +var objectProto$1 = Object.prototype; +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + +var nativeObjectToString$1 = objectProto$1.toString; +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ + +function objectToString(value) { + return nativeObjectToString$1.call(value); +} + +var _objectToString = objectToString; + +/** `Object#toString` result references. */ + +var nullTag = '[object Null]', + undefinedTag = '[object Undefined]'; +/** Built-in value references. */ + +var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined; +/** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + +function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + + return symToStringTag$1 && symToStringTag$1 in Object(value) ? _getRawTag(value) : _objectToString(value); +} + +var _baseGetTag = baseGetTag; + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); +} + +var isObject_1 = isObject; + +/** `Object#toString` result references. */ + +var asyncTag = '[object AsyncFunction]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + proxyTag = '[object Proxy]'; +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + +function isFunction(value) { + if (!isObject_1(value)) { + return false; + } // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + + + var tag = _baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; +} + +var isFunction_1 = isFunction; + +/** Used to detect overreaching core-js shims. */ + +var coreJsData = _root['__core-js_shared__']; +var _coreJsData = coreJsData; + +/** Used to detect methods masquerading as native. */ + +var maskSrcKey = function () { + var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || ''); + return uid ? 'Symbol(src)_1.' + uid : ''; +}(); +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ + + +function isMasked(func) { + return !!maskSrcKey && maskSrcKey in func; +} + +var _isMasked = isMasked; + +/** Used for built-in method references. */ +var funcProto = Function.prototype; +/** Used to resolve the decompiled source of functions. */ + +var funcToString = funcProto.toString; +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ + +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + + try { + return func + ''; + } catch (e) {} + } + + return ''; +} + +var _toSource = toSource; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ + +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; +/** Used to detect host constructors (Safari). */ + +var reIsHostCtor = /^\[object .+?Constructor\]$/; +/** Used for built-in method references. */ + +var funcProto$1 = Function.prototype, + objectProto$2 = Object.prototype; +/** Used to resolve the decompiled source of functions. */ + +var funcToString$1 = funcProto$1.toString; +/** Used to check objects for own properties. */ + +var hasOwnProperty$3 = objectProto$2.hasOwnProperty; +/** Used to detect if a method is native. */ + +var reIsNative = RegExp('^' + funcToString$1.call(hasOwnProperty$3).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ + +function baseIsNative(value) { + if (!isObject_1(value) || _isMasked(value)) { + return false; + } + + var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor; + return pattern.test(_toSource(value)); +} + +var _baseIsNative = baseIsNative; + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +var _getValue = getValue; + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + +function getNative(object, key) { + var value = _getValue(object, key); + return _baseIsNative(value) ? value : undefined; +} + +var _getNative = getNative; + +/* Built-in method references that are verified to be native. */ + +var Map$1 = _getNative(_root, 'Map'); +var _Map = Map$1; + +/* Built-in method references that are verified to be native. */ + +var nativeCreate = _getNative(Object, 'create'); +var _nativeCreate = nativeCreate; + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ + +function hashClear() { + this.__data__ = _nativeCreate ? _nativeCreate(null) : {}; + this.size = 0; +} + +var _hashClear = hashClear; + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; +} + +var _hashDelete = hashDelete; + +/** Used to stand-in for `undefined` hash values. */ + +var HASH_UNDEFINED = '__lodash_hash_undefined__'; +/** Used for built-in method references. */ + +var objectProto$3 = Object.prototype; +/** Used to check objects for own properties. */ + +var hasOwnProperty$4 = objectProto$3.hasOwnProperty; +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + +function hashGet(key) { + var data = this.__data__; + + if (_nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + + return hasOwnProperty$4.call(data, key) ? data[key] : undefined; +} + +var _hashGet = hashGet; + +/** Used for built-in method references. */ + +var objectProto$4 = Object.prototype; +/** Used to check objects for own properties. */ + +var hasOwnProperty$5 = objectProto$4.hasOwnProperty; +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + +function hashHas(key) { + var data = this.__data__; + return _nativeCreate ? data[key] !== undefined : hasOwnProperty$5.call(data, key); +} + +var _hashHas = hashHas; + +/** Used to stand-in for `undefined` hash values. */ + +var HASH_UNDEFINED$1 = '__lodash_hash_undefined__'; +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ + +function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = _nativeCreate && value === undefined ? HASH_UNDEFINED$1 : value; + return this; +} + +var _hashSet = hashSet; + +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + +function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + this.clear(); + + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} // Add methods to `Hash`. + + +Hash.prototype.clear = _hashClear; +Hash.prototype['delete'] = _hashDelete; +Hash.prototype.get = _hashGet; +Hash.prototype.has = _hashHas; +Hash.prototype.set = _hashSet; +var _Hash = Hash; + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ + +function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new _Hash(), + 'map': new (_Map || _ListCache)(), + 'string': new _Hash() + }; +} + +var _mapCacheClear = mapCacheClear; + +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null; +} + +var _isKeyable = isKeyable; + +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ + +function getMapData(map, key) { + var data = map.__data__; + return _isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; +} + +var _getMapData = getMapData; + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + +function mapCacheDelete(key) { + var result = _getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; +} + +var _mapCacheDelete = mapCacheDelete; + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + +function mapCacheGet(key) { + return _getMapData(this, key).get(key); +} + +var _mapCacheGet = mapCacheGet; + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + +function mapCacheHas(key) { + return _getMapData(this, key).has(key); +} + +var _mapCacheHas = mapCacheHas; + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ + +function mapCacheSet(key, value) { + var data = _getMapData(this, key), + size = data.size; + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; +} + +var _mapCacheSet = mapCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + +function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + this.clear(); + + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} // Add methods to `MapCache`. + + +MapCache.prototype.clear = _mapCacheClear; +MapCache.prototype['delete'] = _mapCacheDelete; +MapCache.prototype.get = _mapCacheGet; +MapCache.prototype.has = _mapCacheHas; +MapCache.prototype.set = _mapCacheSet; +var _MapCache = MapCache; + +/** Used as the size to enable large array optimizations. */ + +var LARGE_ARRAY_SIZE = 200; +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ + +function stackSet(key, value) { + var data = this.__data__; + + if (data instanceof _ListCache) { + var pairs = data.__data__; + + if (!_Map || pairs.length < LARGE_ARRAY_SIZE - 1) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + + data = this.__data__ = new _MapCache(pairs); + } + + data.set(key, value); + this.size = data.size; + return this; +} + +var _stackSet = stackSet; + +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + +function Stack(entries) { + var data = this.__data__ = new _ListCache(entries); + this.size = data.size; +} // Add methods to `Stack`. + + +Stack.prototype.clear = _stackClear; +Stack.prototype['delete'] = _stackDelete; +Stack.prototype.get = _stackGet; +Stack.prototype.has = _stackHas; +Stack.prototype.set = _stackSet; +var _Stack = Stack; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED$2 = '__lodash_hash_undefined__'; +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ + +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED$2); + + return this; +} + +var _setCacheAdd = setCacheAdd; + +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ +function setCacheHas(value) { + return this.__data__.has(value); +} + +var _setCacheHas = setCacheHas; + +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ + +function SetCache(values) { + var index = -1, + length = values == null ? 0 : values.length; + this.__data__ = new _MapCache(); + + while (++index < length) { + this.add(values[index]); + } +} // Add methods to `SetCache`. + + +SetCache.prototype.add = SetCache.prototype.push = _setCacheAdd; +SetCache.prototype.has = _setCacheHas; +var _SetCache = SetCache; + +/** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ +function arraySome(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + + return false; +} + +var _arraySome = arraySome; + +/** + * Checks if a `cache` value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function cacheHas(cache, key) { + return cache.has(key); +} + +var _cacheHas = cacheHas; + +/** Used to compose bitmasks for value comparisons. */ + +var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; +/** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ + +function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } // Assume cyclic values are equal. + + + var stacked = stack.get(array); + + if (stacked && stack.get(other)) { + return stacked == other; + } + + var index = -1, + result = true, + seen = bitmask & COMPARE_UNORDERED_FLAG ? new _SetCache() : undefined; + stack.set(array, other); + stack.set(other, array); // Ignore non-index properties. + + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); + } + + if (compared !== undefined) { + if (compared) { + continue; + } + + result = false; + break; + } // Recursively compare arrays (susceptible to call stack limits). + + + if (seen) { + if (!_arraySome(other, function (othValue, othIndex) { + if (!_cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + result = false; + break; + } + } + + stack['delete'](array); + stack['delete'](other); + return result; +} + +var _equalArrays = equalArrays; + +/** Built-in value references. */ + +var Uint8Array = _root.Uint8Array; +var _Uint8Array = Uint8Array; + +/** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ +function mapToArray(map) { + var index = -1, + result = Array(map.size); + map.forEach(function (value, key) { + result[++index] = [key, value]; + }); + return result; +} + +var _mapToArray = mapToArray; + +/** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ +function setToArray(set) { + var index = -1, + result = Array(set.size); + set.forEach(function (value) { + result[++index] = value; + }); + return result; +} + +var _setToArray = setToArray; + +/** Used to compose bitmasks for value comparisons. */ + +var COMPARE_PARTIAL_FLAG$1 = 1, + COMPARE_UNORDERED_FLAG$1 = 2; +/** `Object#toString` result references. */ + +var boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + mapTag = '[object Map]', + numberTag = '[object Number]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]'; +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]'; +/** Used to convert symbols to primitives and strings. */ + +var symbolProto = _Symbol ? _Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + +function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag: + if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { + return false; + } + + object = object.buffer; + other = other.buffer; + + case arrayBufferTag: + if (object.byteLength != other.byteLength || !equalFunc(new _Uint8Array(object), new _Uint8Array(other))) { + return false; + } + + return true; + + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq_1(+object, +other); + + case errorTag: + return object.name == other.name && object.message == other.message; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == other + ''; + + case mapTag: + var convert = _mapToArray; + + case setTag: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1; + convert || (convert = _setToArray); + + if (object.size != other.size && !isPartial) { + return false; + } // Assume cyclic values are equal. + + + var stacked = stack.get(object); + + if (stacked) { + return stacked == other; + } + + bitmask |= COMPARE_UNORDERED_FLAG$1; // Recursively compare objects (susceptible to call stack limits). + + stack.set(object, other); + var result = _equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + stack['delete'](object); + return result; + + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + + } + + return false; +} + +var _equalByTag = equalByTag; + +/** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ +function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + + return array; +} + +var _arrayPush = arrayPush; + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray$1 = Array.isArray; +var isArray_1 = isArray$1; + +/** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ + +function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object)); +} + +var _baseGetAllKeys = baseGetAllKeys; + +/** + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ +function arrayFilter(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + + return result; +} + +var _arrayFilter = arrayFilter; + +/** + * This method returns a new empty array. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {Array} Returns the new empty array. + * @example + * + * var arrays = _.times(2, _.stubArray); + * + * console.log(arrays); + * // => [[], []] + * + * console.log(arrays[0] === arrays[1]); + * // => false + */ +function stubArray() { + return []; +} + +var stubArray_1 = stubArray; + +/** Used for built-in method references. */ + +var objectProto$5 = Object.prototype; +/** Built-in value references. */ + +var propertyIsEnumerable = objectProto$5.propertyIsEnumerable; +/* Built-in method references for those with the same name as other `lodash` methods. */ + +var nativeGetSymbols = Object.getOwnPropertySymbols; +/** + * Creates an array of the own enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + +var getSymbols = !nativeGetSymbols ? stubArray_1 : function (object) { + if (object == null) { + return []; + } + + object = Object(object); + return _arrayFilter(nativeGetSymbols(object), function (symbol) { + return propertyIsEnumerable.call(object, symbol); + }); +}; +var _getSymbols = getSymbols; + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + + return result; +} + +var _baseTimes = baseTimes; + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return value != null && typeof value == 'object'; +} + +var isObjectLike_1 = isObjectLike; + +/** `Object#toString` result references. */ + +var argsTag = '[object Arguments]'; +/** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ + +function baseIsArguments(value) { + return isObjectLike_1(value) && _baseGetTag(value) == argsTag; +} + +var _baseIsArguments = baseIsArguments; + +/** Used for built-in method references. */ + +var objectProto$6 = Object.prototype; +/** Used to check objects for own properties. */ + +var hasOwnProperty$6 = objectProto$6.hasOwnProperty; +/** Built-in value references. */ + +var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable; +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ + +var isArguments = _baseIsArguments(function () { + return arguments; +}()) ? _baseIsArguments : function (value) { + return isObjectLike_1(value) && hasOwnProperty$6.call(value, 'callee') && !propertyIsEnumerable$1.call(value, 'callee'); +}; +var isArguments_1 = isArguments; + +/** + * This method returns `false`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] + */ +function stubFalse() { + return false; +} + +var stubFalse_1 = stubFalse; + +var isBuffer_1 = createCommonjsModule(function (module, exports) { + /** Detect free variable `exports`. */ + var freeExports = exports && !exports.nodeType && exports; + /** Detect free variable `module`. */ + + var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module; + /** Detect the popular CommonJS extension `module.exports`. */ + + var moduleExports = freeModule && freeModule.exports === freeExports; + /** Built-in value references. */ + + var Buffer = moduleExports ? _root.Buffer : undefined; + /* Built-in method references for those with the same name as other `lodash` methods. */ + + var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; + /** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ + + var isBuffer = nativeIsBuffer || stubFalse_1; + module.exports = isBuffer; +}); + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER$2 = 9007199254740991; +/** Used to detect unsigned integer values. */ + +var reIsUint = /^(?:0|[1-9]\d*)$/; +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + +function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER$2 : length; + return !!length && (type == 'number' || type != 'symbol' && reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length; +} + +var _isIndex = isIndex; + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER$3 = 9007199254740991; +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ + +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$3; +} + +var isLength_1 = isLength; + +/** `Object#toString` result references. */ + +var argsTag$1 = '[object Arguments]', + arrayTag = '[object Array]', + boolTag$1 = '[object Boolean]', + dateTag$1 = '[object Date]', + errorTag$1 = '[object Error]', + funcTag$1 = '[object Function]', + mapTag$1 = '[object Map]', + numberTag$1 = '[object Number]', + objectTag = '[object Object]', + regexpTag$1 = '[object RegExp]', + setTag$1 = '[object Set]', + stringTag$1 = '[object String]', + weakMapTag = '[object WeakMap]'; +var arrayBufferTag$1 = '[object ArrayBuffer]', + dataViewTag$1 = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; +/** Used to identify `toStringTag` values of typed arrays. */ + +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$1] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$1] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag] = false; +/** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ + +function baseIsTypedArray(value) { + return isObjectLike_1(value) && isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)]; +} + +var _baseIsTypedArray = baseIsTypedArray; + +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function (value) { + return func(value); + }; +} + +var _baseUnary = baseUnary; + +var _nodeUtil = createCommonjsModule(function (module, exports) { + /** Detect free variable `exports`. */ + var freeExports = exports && !exports.nodeType && exports; + /** Detect free variable `module`. */ + + var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module; + /** Detect the popular CommonJS extension `module.exports`. */ + + var moduleExports = freeModule && freeModule.exports === freeExports; + /** Detect free variable `process` from Node.js. */ + + var freeProcess = moduleExports && _freeGlobal.process; + /** Used to access faster Node.js helpers. */ + + var nodeUtil = function () { + try { + // Use `util.types` for Node.js 10+. + var types = freeModule && freeModule.require && freeModule.require('util').types; + + if (types) { + return types; + } // Legacy `process.binding('util')` for Node.js < 10. + + + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} + }(); + + module.exports = nodeUtil; +}); + +/* Node.js helper references. */ + +var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray; +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ + +var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray; +var isTypedArray_1 = isTypedArray; + +/** Used for built-in method references. */ + +var objectProto$7 = Object.prototype; +/** Used to check objects for own properties. */ + +var hasOwnProperty$7 = objectProto$7.hasOwnProperty; +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ + +function arrayLikeKeys(value, inherited) { + var isArr = isArray_1(value), + isArg = !isArr && isArguments_1(value), + isBuff = !isArr && !isArg && isBuffer_1(value), + isType = !isArr && !isArg && !isBuff && isTypedArray_1(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? _baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty$7.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers. + isBuff && (key == 'offset' || key == 'parent') || // PhantomJS 2 has enumerable non-index properties on typed arrays. + isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') || // Skip index properties. + _isIndex(key, length)))) { + result.push(key); + } + } + + return result; +} + +var _arrayLikeKeys = arrayLikeKeys; + +/** Used for built-in method references. */ +var objectProto$8 = Object.prototype; +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ + +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = typeof Ctor == 'function' && Ctor.prototype || objectProto$8; + return value === proto; +} + +var _isPrototype = isPrototype; + +/** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function (arg) { + return func(transform(arg)); + }; +} + +var _overArg = overArg; + +/* Built-in method references for those with the same name as other `lodash` methods. */ + +var nativeKeys = _overArg(Object.keys, Object); +var _nativeKeys = nativeKeys; + +/** Used for built-in method references. */ + +var objectProto$9 = Object.prototype; +/** Used to check objects for own properties. */ + +var hasOwnProperty$8 = objectProto$9.hasOwnProperty; +/** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + +function baseKeys(object) { + if (!_isPrototype(object)) { + return _nativeKeys(object); + } + + var result = []; + + for (var key in Object(object)) { + if (hasOwnProperty$8.call(object, key) && key != 'constructor') { + result.push(key); + } + } + + return result; +} + +var _baseKeys = baseKeys; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ + +function isArrayLike(value) { + return value != null && isLength_1(value.length) && !isFunction_1(value); +} + +var isArrayLike_1 = isArrayLike; + +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ + +function keys(object) { + return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object); +} + +var keys_1 = keys; + +/** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + +function getAllKeys(object) { + return _baseGetAllKeys(object, keys_1, _getSymbols); +} + +var _getAllKeys = getAllKeys; + +/** Used to compose bitmasks for value comparisons. */ + +var COMPARE_PARTIAL_FLAG$2 = 1; +/** Used for built-in method references. */ + +var objectProto$a = Object.prototype; +/** Used to check objects for own properties. */ + +var hasOwnProperty$9 = objectProto$a.hasOwnProperty; +/** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + +function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2, + objProps = _getAllKeys(object), + objLength = objProps.length, + othProps = _getAllKeys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + + var index = objLength; + + while (index--) { + var key = objProps[index]; + + if (!(isPartial ? key in other : hasOwnProperty$9.call(other, key))) { + return false; + } + } // Assume cyclic values are equal. + + + var stacked = stack.get(object); + + if (stacked && stack.get(other)) { + return stacked == other; + } + + var result = true; + stack.set(object, other); + stack.set(other, object); + var skipCtor = isPartial; + + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); + } // Recursively compare objects (susceptible to call stack limits). + + + if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { + result = false; + break; + } + + skipCtor || (skipCtor = key == 'constructor'); + } + + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. + + if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { + result = false; + } + } + + stack['delete'](object); + stack['delete'](other); + return result; +} + +var _equalObjects = equalObjects; + +/* Built-in method references that are verified to be native. */ + +var DataView = _getNative(_root, 'DataView'); +var _DataView = DataView; + +/* Built-in method references that are verified to be native. */ + +var Promise$1 = _getNative(_root, 'Promise'); +var _Promise = Promise$1; + +/* Built-in method references that are verified to be native. */ + +var Set$1 = _getNative(_root, 'Set'); +var _Set = Set$1; + +/* Built-in method references that are verified to be native. */ + +var WeakMap$1 = _getNative(_root, 'WeakMap'); +var _WeakMap = WeakMap$1; + +/** `Object#toString` result references. */ + +var mapTag$2 = '[object Map]', + objectTag$1 = '[object Object]', + promiseTag = '[object Promise]', + setTag$2 = '[object Set]', + weakMapTag$1 = '[object WeakMap]'; +var dataViewTag$2 = '[object DataView]'; +/** Used to detect maps, sets, and weakmaps. */ + +var dataViewCtorString = _toSource(_DataView), + mapCtorString = _toSource(_Map), + promiseCtorString = _toSource(_Promise), + setCtorString = _toSource(_Set), + weakMapCtorString = _toSource(_WeakMap); +/** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + +var getTag = _baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. + +if (_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$2 || _Map && getTag(new _Map()) != mapTag$2 || _Promise && getTag(_Promise.resolve()) != promiseTag || _Set && getTag(new _Set()) != setTag$2 || _WeakMap && getTag(new _WeakMap()) != weakMapTag$1) { + getTag = function (value) { + var result = _baseGetTag(value), + Ctor = result == objectTag$1 ? value.constructor : undefined, + ctorString = Ctor ? _toSource(Ctor) : ''; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: + return dataViewTag$2; + + case mapCtorString: + return mapTag$2; + + case promiseCtorString: + return promiseTag; + + case setCtorString: + return setTag$2; + + case weakMapCtorString: + return weakMapTag$1; + } + } + + return result; + }; +} + +var _getTag = getTag; + +/** Used to compose bitmasks for value comparisons. */ + +var COMPARE_PARTIAL_FLAG$3 = 1; +/** `Object#toString` result references. */ + +var argsTag$2 = '[object Arguments]', + arrayTag$1 = '[object Array]', + objectTag$2 = '[object Object]'; +/** Used for built-in method references. */ + +var objectProto$b = Object.prototype; +/** Used to check objects for own properties. */ + +var hasOwnProperty$a = objectProto$b.hasOwnProperty; +/** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + +function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray_1(object), + othIsArr = isArray_1(other), + objTag = objIsArr ? arrayTag$1 : _getTag(object), + othTag = othIsArr ? arrayTag$1 : _getTag(other); + objTag = objTag == argsTag$2 ? objectTag$2 : objTag; + othTag = othTag == argsTag$2 ? objectTag$2 : othTag; + var objIsObj = objTag == objectTag$2, + othIsObj = othTag == objectTag$2, + isSameTag = objTag == othTag; + + if (isSameTag && isBuffer_1(object)) { + if (!isBuffer_1(other)) { + return false; + } + + objIsArr = true; + objIsObj = false; + } + + if (isSameTag && !objIsObj) { + stack || (stack = new _Stack()); + return objIsArr || isTypedArray_1(object) ? _equalArrays(object, other, bitmask, customizer, equalFunc, stack) : _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + } + + if (!(bitmask & COMPARE_PARTIAL_FLAG$3)) { + var objIsWrapped = objIsObj && hasOwnProperty$a.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty$a.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + stack || (stack = new _Stack()); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + + if (!isSameTag) { + return false; + } + + stack || (stack = new _Stack()); + return _equalObjects(object, other, bitmask, customizer, equalFunc, stack); +} + +var _baseIsEqualDeep = baseIsEqualDeep; + +/** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Function} [customizer] The function to customize comparisons. + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ + +function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) { + return true; + } + + if (value == null || other == null || !isObjectLike_1(value) && !isObjectLike_1(other)) { + return value !== value && other !== other; + } + + return _baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); +} + +var _baseIsEqual = baseIsEqual; + +/** Used to compose bitmasks for value comparisons. */ + +var COMPARE_PARTIAL_FLAG$4 = 1, + COMPARE_UNORDERED_FLAG$2 = 2; +/** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ + +function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + + object = Object(object); + + while (index--) { + var data = matchData[index]; + + if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { + return false; + } + } + + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var stack = new _Stack(); + + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + + if (!(result === undefined ? _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$4 | COMPARE_UNORDERED_FLAG$2, customizer, stack) : result)) { + return false; + } + } + } + + return true; +} + +var _baseIsMatch = baseIsMatch; + +/** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ + +function isStrictComparable(value) { + return value === value && !isObject_1(value); +} + +var _isStrictComparable = isStrictComparable; + +/** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ + +function getMatchData(object) { + var result = keys_1(object), + length = result.length; + + while (length--) { + var key = result[length], + value = object[key]; + result[length] = [key, value, _isStrictComparable(value)]; + } + + return result; +} + +var _getMatchData = getMatchData; + +/** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ +function matchesStrictComparable(key, srcValue) { + return function (object) { + if (object == null) { + return false; + } + + return object[key] === srcValue && (srcValue !== undefined || key in Object(object)); + }; +} + +var _matchesStrictComparable = matchesStrictComparable; + +/** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ + +function baseMatches(source) { + var matchData = _getMatchData(source); + + if (matchData.length == 1 && matchData[0][2]) { + return _matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + + return function (object) { + return object === source || _baseIsMatch(object, source, matchData); + }; +} + +var _baseMatches = baseMatches; + +/** `Object#toString` result references. */ + +var symbolTag$1 = '[object Symbol]'; +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + +function isSymbol(value) { + return typeof value == 'symbol' || isObjectLike_1(value) && _baseGetTag(value) == symbolTag$1; +} + +var isSymbol_1 = isSymbol; + +/** Used to match property names within property paths. */ + +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/; +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ + +function isKey(value, object) { + if (isArray_1(value)) { + return false; + } + + var type = typeof value; + + if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol_1(value)) { + return true; + } + + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); +} + +var _isKey = isKey; + +/** Error message constants. */ + +var FUNC_ERROR_TEXT = 'Expected a function'; +/** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ + +function memoize(func, resolver) { + if (typeof func != 'function' || resolver != null && typeof resolver != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + + var memoized = function () { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + + memoized.cache = new (memoize.Cache || _MapCache)(); + return memoized; +} // Expose `MapCache`. + + +memoize.Cache = _MapCache; +var memoize_1 = memoize; + +/** Used as the maximum memoize cache size. */ + +var MAX_MEMOIZE_SIZE = 500; +/** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ + +function memoizeCapped(func) { + var result = memoize_1(func, function (key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + + return key; + }); + var cache = result.cache; + return result; +} + +var _memoizeCapped = memoizeCapped; + +/** Used to match property names within property paths. */ + +var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; +/** Used to match backslashes in property paths. */ + +var reEscapeChar = /\\(\\)?/g; +/** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ + +var stringToPath = _memoizeCapped(function (string) { + var result = []; + + if (string.charCodeAt(0) === 46 + /* . */ + ) { + result.push(''); + } + + string.replace(rePropName, function (match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : number || match); + }); + return result; +}); +var _stringToPath = stringToPath; + +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + + return result; +} + +var _arrayMap = arrayMap; + +/** Used as references for various `Number` constants. */ + +var INFINITY = 1 / 0; +/** Used to convert symbols to primitives and strings. */ + +var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined, + symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined; +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + + if (isArray_1(value)) { + // Recursively convert values (susceptible to call stack limits). + return _arrayMap(value, baseToString) + ''; + } + + if (isSymbol_1(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + + var result = value + ''; + return result == '0' && 1 / value == -INFINITY ? '-0' : result; +} + +var _baseToString = baseToString; + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + +function toString(value) { + return value == null ? '' : _baseToString(value); +} + +var toString_1 = toString; + +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ + +function castPath(value, object) { + if (isArray_1(value)) { + return value; + } + + return _isKey(value, object) ? [value] : _stringToPath(toString_1(value)); +} + +var _castPath = castPath; + +/** Used as references for various `Number` constants. */ + +var INFINITY$1 = 1 / 0; +/** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ + +function toKey(value) { + if (typeof value == 'string' || isSymbol_1(value)) { + return value; + } + + var result = value + ''; + return result == '0' && 1 / value == -INFINITY$1 ? '-0' : result; +} + +var _toKey = toKey; + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ + +function baseGet(object, path) { + path = _castPath(path, object); + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[_toKey(path[index++])]; + } + + return index && index == length ? object : undefined; +} + +var _baseGet = baseGet; + +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + +function get$1(object, path, defaultValue) { + var result = object == null ? undefined : _baseGet(object, path); + return result === undefined ? defaultValue : result; +} + +var get_1 = get$1; + +/** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHasIn(object, key) { + return object != null && key in Object(object); +} + +var _baseHasIn = baseHasIn; + +/** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ + +function hasPath(object, path, hasFunc) { + path = _castPath(path, object); + var index = -1, + length = path.length, + result = false; + + while (++index < length) { + var key = _toKey(path[index]); + + if (!(result = object != null && hasFunc(object, key))) { + break; + } + + object = object[key]; + } + + if (result || ++index != length) { + return result; + } + + length = object == null ? 0 : object.length; + return !!length && isLength_1(length) && _isIndex(key, length) && (isArray_1(object) || isArguments_1(object)); +} + +var _hasPath = hasPath; + +/** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + +function hasIn(object, path) { + return object != null && _hasPath(object, path, _baseHasIn); +} + +var hasIn_1 = hasIn; + +/** Used to compose bitmasks for value comparisons. */ + +var COMPARE_PARTIAL_FLAG$5 = 1, + COMPARE_UNORDERED_FLAG$3 = 2; +/** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + +function baseMatchesProperty(path, srcValue) { + if (_isKey(path) && _isStrictComparable(srcValue)) { + return _matchesStrictComparable(_toKey(path), srcValue); + } + + return function (object) { + var objValue = get_1(object, path); + return objValue === undefined && objValue === srcValue ? hasIn_1(object, path) : _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$5 | COMPARE_UNORDERED_FLAG$3); + }; +} + +var _baseMatchesProperty = baseMatchesProperty; + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} + +var identity_1 = identity; + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function (object) { + return object == null ? undefined : object[key]; + }; +} + +var _baseProperty = baseProperty; + +/** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ + +function basePropertyDeep(path) { + return function (object) { + return _baseGet(object, path); + }; +} + +var _basePropertyDeep = basePropertyDeep; + +/** + * Creates a function that returns the value at `path` of a given object. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + * @example + * + * var objects = [ + * { 'a': { 'b': 2 } }, + * { 'a': { 'b': 1 } } + * ]; + * + * _.map(objects, _.property('a.b')); + * // => [2, 1] + * + * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); + * // => [1, 2] + */ + +function property(path) { + return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path); +} + +var property_1 = property; + +/** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ + +function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; + } + + if (value == null) { + return identity_1; + } + + if (typeof value == 'object') { + return isArray_1(value) ? _baseMatchesProperty(value[0], value[1]) : _baseMatches(value); + } + + return property_1(value); +} + +var _baseIteratee = baseIteratee; + +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while (fromRight ? index-- : ++index < length) { + if (predicate(array[index], index, array)) { + return index; + } + } + + return -1; +} + +var _baseFindIndex = baseFindIndex; + +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +var _baseIsNaN = baseIsNaN; + +/** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + + return -1; +} + +var _strictIndexOf = strictIndexOf; + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + +function baseIndexOf(array, value, fromIndex) { + return value === value ? _strictIndexOf(array, value, fromIndex) : _baseFindIndex(array, _baseIsNaN, fromIndex); +} + +var _baseIndexOf = baseIndexOf; + +/** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + +function arrayIncludes(array, value) { + var length = array == null ? 0 : array.length; + return !!length && _baseIndexOf(array, value, 0) > -1; +} + +var _arrayIncludes = arrayIncludes; + +/** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludesWith(array, value, comparator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } + } + + return false; +} + +var _arrayIncludesWith = arrayIncludesWith; + +/** + * This method returns `undefined`. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Util + * @example + * + * _.times(2, _.noop); + * // => [undefined, undefined] + */ +function noop() {// No operation performed. +} + +var noop_1 = noop; + +/** Used as references for various `Number` constants. */ + +var INFINITY$2 = 1 / 0; +/** + * Creates a set object of `values`. + * + * @private + * @param {Array} values The values to add to the set. + * @returns {Object} Returns the new set. + */ + +var createSet = !(_Set && 1 / _setToArray(new _Set([, -0]))[1] == INFINITY$2) ? noop_1 : function (values) { + return new _Set(values); +}; +var _createSet = createSet; + +/** Used as the size to enable large array optimizations. */ + +var LARGE_ARRAY_SIZE$1 = 200; +/** + * The base implementation of `_.uniqBy` without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ + +function baseUniq(array, iteratee, comparator) { + var index = -1, + includes = _arrayIncludes, + length = array.length, + isCommon = true, + result = [], + seen = result; + + if (comparator) { + isCommon = false; + includes = _arrayIncludesWith; + } else if (length >= LARGE_ARRAY_SIZE$1) { + var set = iteratee ? null : _createSet(array); + + if (set) { + return _setToArray(set); + } + + isCommon = false; + includes = _cacheHas; + seen = new _SetCache(); + } else { + seen = iteratee ? [] : result; + } + + outer: while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + value = comparator || value !== 0 ? value : 0; + + if (isCommon && computed === computed) { + var seenIndex = seen.length; + + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + + if (iteratee) { + seen.push(computed); + } + + result.push(value); + } else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + + result.push(value); + } + } + + return result; +} + +var _baseUniq = baseUniq; + +/** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The order of result values is determined by the + * order they occur in the array. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // The `_.property` iteratee shorthand. + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + +function uniqBy(array, iteratee) { + return array && array.length ? _baseUniq(array, _baseIteratee(iteratee)) : []; +} + +var uniqBy_1 = uniqBy; + +/** + * A specialized version of `baseAggregator` for arrays. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ +function arrayAggregator(array, setter, iteratee, accumulator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + var value = array[index]; + setter(accumulator, value, iteratee(value), array); + } + + return accumulator; +} + +var _arrayAggregator = arrayAggregator; + +/** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseFor(fromRight) { + return function (object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + + return object; + }; +} + +var _createBaseFor = createBaseFor; + +/** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + +var baseFor = _createBaseFor(); +var _baseFor = baseFor; + +/** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + +function baseForOwn(object, iteratee) { + return object && _baseFor(object, iteratee, keys_1); +} + +var _baseForOwn = baseForOwn; + +/** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + +function createBaseEach(eachFunc, fromRight) { + return function (collection, iteratee) { + if (collection == null) { + return collection; + } + + if (!isArrayLike_1(collection)) { + return eachFunc(collection, iteratee); + } + + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); + + while (fromRight ? index-- : ++index < length) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + + return collection; + }; +} + +var _createBaseEach = createBaseEach; + +/** + * The base implementation of `_.forEach` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + +var baseEach = _createBaseEach(_baseForOwn); +var _baseEach = baseEach; + +/** + * Aggregates elements of `collection` on `accumulator` with keys transformed + * by `iteratee` and values set by `setter`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ + +function baseAggregator(collection, setter, iteratee, accumulator) { + _baseEach(collection, function (value, key, collection) { + setter(accumulator, value, iteratee(value), collection); + }); + return accumulator; +} + +var _baseAggregator = baseAggregator; + +/** + * Creates a function like `_.groupBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} [initializer] The accumulator object initializer. + * @returns {Function} Returns the new aggregator function. + */ + +function createAggregator(setter, initializer) { + return function (collection, iteratee) { + var func = isArray_1(collection) ? _arrayAggregator : _baseAggregator, + accumulator = initializer ? initializer() : {}; + return func(collection, setter, _baseIteratee(iteratee), accumulator); + }; +} + +var _createAggregator = createAggregator; + +/** + * Creates an array of elements split into two groups, the first of which + * contains elements `predicate` returns truthy for, the second of which + * contains elements `predicate` returns falsey for. The predicate is + * invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the array of grouped elements. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true }, + * { 'user': 'pebbles', 'age': 1, 'active': false } + * ]; + * + * _.partition(users, function(o) { return o.active; }); + * // => objects for [['fred'], ['barney', 'pebbles']] + * + * // The `_.matches` iteratee shorthand. + * _.partition(users, { 'age': 1, 'active': false }); + * // => objects for [['pebbles'], ['barney', 'fred']] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.partition(users, ['active', false]); + * // => objects for [['barney', 'pebbles'], ['fred']] + * + * // The `_.property` iteratee shorthand. + * _.partition(users, 'active'); + * // => objects for [['fred'], ['barney', 'pebbles']] + */ + +var partition = _createAggregator(function (result, value, key) { + result[key ? 0 : 1].push(value); +}, function () { + return [[], []]; +}); +var partition_1 = partition; + +var arrayUnion = (...arguments_) => { + return [...new Set([].concat(...arguments_))]; +}; + +/* + * merge2 + * https://github.com/teambition/merge2 + * + * Copyright (c) 2014-2016 Teambition + * Licensed under the MIT license. + */ + + +const PassThrough = stream$6.PassThrough; +const slice = Array.prototype.slice; +var merge2_1 = merge2; + +function merge2() { + const streamsQueue = []; + let merging = false; + const args = slice.call(arguments); + let options = args[args.length - 1]; + if (options && !Array.isArray(options) && options.pipe == null) args.pop();else options = {}; + const doEnd = options.end !== false; + if (options.objectMode == null) options.objectMode = true; + if (options.highWaterMark == null) options.highWaterMark = 64 * 1024; + const mergedStream = PassThrough(options); + + function addStream() { + for (let i = 0, len = arguments.length; i < len; i++) { + streamsQueue.push(pauseStreams(arguments[i], options)); + } + + mergeStream(); + return this; + } + + function mergeStream() { + if (merging) return; + merging = true; + let streams = streamsQueue.shift(); + + if (!streams) { + process.nextTick(endStream); + return; + } + + if (!Array.isArray(streams)) streams = [streams]; + let pipesCount = streams.length + 1; + + function next() { + if (--pipesCount > 0) return; + merging = false; + mergeStream(); + } + + function pipe(stream) { + function onend() { + stream.removeListener('merge2UnpipeEnd', onend); + stream.removeListener('end', onend); + next(); + } // skip ended stream + + + if (stream._readableState.endEmitted) return next(); + stream.on('merge2UnpipeEnd', onend); + stream.on('end', onend); + stream.pipe(mergedStream, { + end: false + }); // compatible for old stream + + stream.resume(); + } + + for (let i = 0; i < streams.length; i++) pipe(streams[i]); + + next(); + } + + function endStream() { + merging = false; // emit 'queueDrain' when all streams merged. + + mergedStream.emit('queueDrain'); + return doEnd && mergedStream.end(); + } + + mergedStream.setMaxListeners(0); + mergedStream.add = addStream; + mergedStream.on('unpipe', function (stream) { + stream.emit('merge2UnpipeEnd'); + }); + if (args.length) addStream.apply(null, args); + return mergedStream; +} // check and pause streams for pipe. + + +function pauseStreams(streams, options) { + if (!Array.isArray(streams)) { + // Backwards-compat with old-style streams + if (!streams._readableState && streams.pipe) streams = streams.pipe(PassThrough(options)); + + if (!streams._readableState || !streams.pause || !streams.pipe) { + throw new Error('Only readable stream can be merged.'); + } + + streams.pause(); + } else { + for (let i = 0, len = streams.length; i < len; i++) streams[i] = pauseStreams(streams[i], options); + } + + return streams; +} + +var array$2 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function flatten(items) { + return items.reduce((collection, item) => [].concat(collection, item), []); + } + + exports.flatten = flatten; + + function splitWhen(items, predicate) { + const result = [[]]; + let groupIndex = 0; + + for (const item of items) { + if (predicate(item)) { + groupIndex++; + result[groupIndex] = []; + } else { + result[groupIndex].push(item); + } + } + + return result; + } + + exports.splitWhen = splitWhen; +}); +unwrapExports(array$2); +var array_1$1 = array$2.flatten; +var array_2 = array$2.splitWhen; + +var errno = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function isEnoentCodeError(error) { + return error.code === 'ENOENT'; + } + + exports.isEnoentCodeError = isEnoentCodeError; +}); +unwrapExports(errno); +var errno_1 = errno.isEnoentCodeError; + +var fs$1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } + + } + + function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); + } + + exports.createDirentFromStats = createDirentFromStats; +}); +unwrapExports(fs$1); +var fs_1 = fs$1.createDirentFromStats; + +var path_1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\ + + const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g; + /** + * Designed to work only with simple paths: `dir\\file`. + */ + + function unixify(filepath) { + return filepath.replace(/\\/g, '/'); + } + + exports.unixify = unixify; + + function makeAbsolute(cwd, filepath) { + return path$2.resolve(cwd, filepath); + } + + exports.makeAbsolute = makeAbsolute; + + function escape(pattern) { + return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); + } + + exports.escape = escape; + + function removeLeadingDotSegment(entry) { + // We do not use `startsWith` because this is 10x slower than current implementation for some cases. + // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with + if (entry.charAt(0) === '.') { + const secondCharactery = entry.charAt(1); + + if (secondCharactery === '/' || secondCharactery === '\\') { + return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); + } + } + + return entry; + } + + exports.removeLeadingDotSegment = removeLeadingDotSegment; +}); +unwrapExports(path_1); +var path_2 = path_1.unixify; +var path_3 = path_1.makeAbsolute; +var path_4 = path_1.escape; +var path_5 = path_1.removeLeadingDotSegment; + +/*! + * is-extglob + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + */ +var isExtglob = function isExtglob(str) { + if (typeof str !== 'string' || str === '') { + return false; + } + + var match; + + while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) { + if (match[2]) return true; + str = str.slice(match.index + match[0].length); + } + + return false; +}; + +/*! + * is-glob + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +var chars = { + '{': '}', + '(': ')', + '[': ']' +}; +var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; +var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/; + +var isGlob = function isGlob(str, options) { + if (typeof str !== 'string' || str === '') { + return false; + } + + if (isExtglob(str)) { + return true; + } + + var regex = strictRegex; + var match; // optionally relax regex + + if (options && options.strict === false) { + regex = relaxedRegex; + } + + while (match = regex.exec(str)) { + if (match[2]) return true; + var idx = match.index + match[0].length; // if an open bracket/brace/paren is escaped, + // set the index to the next closing character + + var open = match[1]; + var close = open ? chars[open] : null; + + if (open && close) { + var n = str.indexOf(close, idx); + + if (n !== -1) { + idx = n + 1; + } + } + + str = str.slice(idx); + } + + return false; +}; + +var pathPosixDirname = path$2.posix.dirname; +var isWin32 = os$1.platform() === 'win32'; +var slash = '/'; +var backslash = /\\/g; +var enclosure = /[\{\[].*[\/]*.*[\}\]]$/; +var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; +var escaped = /\\([\*\?\|\[\]\(\)\{\}])/g; +/** + * @param {string} str + * @param {Object} opts + * @param {boolean} [opts.flipBackslashes=true] + */ + +var globParent = function globParent(str, opts) { + var options = Object.assign({ + flipBackslashes: true + }, opts); // flip windows path separators + + if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { + str = str.replace(backslash, slash); + } // special case for strings ending in enclosure containing path separator + + + if (enclosure.test(str)) { + str += slash; + } // preserves full path in case of trailing path separator + + + str += 'a'; // remove path parts that are globby + + do { + str = pathPosixDirname(str); + } while (isGlob(str) || globby.test(str)); // remove escape chars and return result + + + return str.replace(escaped, '$1'); +}; + +var utils$2 = createCommonjsModule(function (module, exports) { + + exports.isInteger = num => { + if (typeof num === 'number') { + return Number.isInteger(num); + } + + if (typeof num === 'string' && num.trim() !== '') { + return Number.isInteger(Number(num)); + } + + return false; + }; + /** + * Find a node of the given type + */ + + + exports.find = (node, type) => node.nodes.find(node => node.type === type); + /** + * Find a node of the given type + */ + + + exports.exceedsLimit = (min, max, step = 1, limit) => { + if (limit === false) return false; + if (!exports.isInteger(min) || !exports.isInteger(max)) return false; + return (Number(max) - Number(min)) / Number(step) >= limit; + }; + /** + * Escape the given node with '\\' before node.value + */ + + + exports.escapeNode = (block, n = 0, type) => { + let node = block.nodes[n]; + if (!node) return; + + if (type && node.type === type || node.type === 'open' || node.type === 'close') { + if (node.escaped !== true) { + node.value = '\\' + node.value; + node.escaped = true; + } + } + }; + /** + * Returns true if the given brace node should be enclosed in literal braces + */ + + + exports.encloseBrace = node => { + if (node.type !== 'brace') return false; + + if (node.commas >> 0 + node.ranges >> 0 === 0) { + node.invalid = true; + return true; + } + + return false; + }; + /** + * Returns true if a brace node is invalid. + */ + + + exports.isInvalidBrace = block => { + if (block.type !== 'brace') return false; + if (block.invalid === true || block.dollar) return true; + + if (block.commas >> 0 + block.ranges >> 0 === 0) { + block.invalid = true; + return true; + } + + if (block.open !== true || block.close !== true) { + block.invalid = true; + return true; + } + + return false; + }; + /** + * Returns true if a node is an open or close node + */ + + + exports.isOpenOrClose = node => { + if (node.type === 'open' || node.type === 'close') { + return true; + } + + return node.open === true || node.close === true; + }; + /** + * Reduce an array of text nodes. + */ + + + exports.reduce = nodes => nodes.reduce((acc, node) => { + if (node.type === 'text') acc.push(node.value); + if (node.type === 'range') node.type = 'text'; + return acc; + }, []); + /** + * Flatten an array + */ + + + exports.flatten = (...args) => { + const result = []; + + const flat = arr => { + for (let i = 0; i < arr.length; i++) { + let ele = arr[i]; + Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele); + } + + return result; + }; + + flat(args); + return result; + }; +}); +var utils_1$2 = utils$2.isInteger; +var utils_2$2 = utils$2.find; +var utils_3$2 = utils$2.exceedsLimit; +var utils_4$1 = utils$2.escapeNode; +var utils_5$1 = utils$2.encloseBrace; +var utils_6$1 = utils$2.isInvalidBrace; +var utils_7$1 = utils$2.isOpenOrClose; +var utils_8$1 = utils$2.reduce; +var utils_9$1 = utils$2.flatten; + +var stringify = (ast, options = {}) => { + let stringify = (node, parent = {}) => { + let invalidBlock = options.escapeInvalid && utils$2.isInvalidBrace(parent); + let invalidNode = node.invalid === true && options.escapeInvalid === true; + let output = ''; + + if (node.value) { + if ((invalidBlock || invalidNode) && utils$2.isOpenOrClose(node)) { + return '\\' + node.value; + } + + return node.value; + } + + if (node.value) { + return node.value; + } + + if (node.nodes) { + for (let child of node.nodes) { + output += stringify(child); + } + } + + return output; + }; + + return stringify(ast); +}; + +/*! + * is-number + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Released under the MIT License. + */ + +var isNumber = function (num) { + if (typeof num === 'number') { + return num - num === 0; + } + + if (typeof num === 'string' && num.trim() !== '') { + return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); + } + + return false; +}; + +const toRegexRange = (min, max, options) => { + if (isNumber(min) === false) { + throw new TypeError('toRegexRange: expected the first argument to be a number'); + } + + if (max === void 0 || min === max) { + return String(min); + } + + if (isNumber(max) === false) { + throw new TypeError('toRegexRange: expected the second argument to be a number.'); + } + + let opts = Object.assign({ + relaxZeros: true + }, options); + + if (typeof opts.strictZeros === 'boolean') { + opts.relaxZeros = opts.strictZeros === false; + } + + let relax = String(opts.relaxZeros); + let shorthand = String(opts.shorthand); + let capture = String(opts.capture); + let wrap = String(opts.wrap); + let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap; + + if (toRegexRange.cache.hasOwnProperty(cacheKey)) { + return toRegexRange.cache[cacheKey].result; + } + + let a = Math.min(min, max); + let b = Math.max(min, max); + + if (Math.abs(a - b) === 1) { + let result = min + '|' + max; + + if (opts.capture) { + return `(${result})`; + } + + if (opts.wrap === false) { + return result; + } + + return `(?:${result})`; + } + + let isPadded = hasPadding(min) || hasPadding(max); + let state = { + min, + max, + a, + b + }; + let positives = []; + let negatives = []; + + if (isPadded) { + state.isPadded = isPadded; + state.maxLen = String(state.max).length; + } + + if (a < 0) { + let newMin = b < 0 ? Math.abs(b) : 1; + negatives = splitToPatterns(newMin, Math.abs(a), state, opts); + a = state.a = 0; + } + + if (b >= 0) { + positives = splitToPatterns(a, b, state, opts); + } + + state.negatives = negatives; + state.positives = positives; + state.result = collatePatterns(negatives, positives); + + if (opts.capture === true) { + state.result = `(${state.result})`; + } else if (opts.wrap !== false && positives.length + negatives.length > 1) { + state.result = `(?:${state.result})`; + } + + toRegexRange.cache[cacheKey] = state; + return state.result; +}; + +function collatePatterns(neg, pos, options) { + let onlyNegative = filterPatterns(neg, pos, '-', false) || []; + let onlyPositive = filterPatterns(pos, neg, '', false) || []; + let intersected = filterPatterns(neg, pos, '-?', true) || []; + let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive); + return subpatterns.join('|'); +} + +function splitToRanges(min, max) { + let nines = 1; + let zeros = 1; + let stop = countNines(min, nines); + let stops = new Set([max]); + + while (min <= stop && stop <= max) { + stops.add(stop); + nines += 1; + stop = countNines(min, nines); + } + + stop = countZeros(max + 1, zeros) - 1; + + while (min < stop && stop <= max) { + stops.add(stop); + zeros += 1; + stop = countZeros(max + 1, zeros) - 1; + } + + stops = [...stops]; + stops.sort(compare$1); + return stops; +} +/** + * Convert a range to a regex pattern + * @param {Number} `start` + * @param {Number} `stop` + * @return {String} + */ + + +function rangeToPattern(start, stop, options) { + if (start === stop) { + return { + pattern: start, + count: [], + digits: 0 + }; + } + + let zipped = zip(start, stop); + let digits = zipped.length; + let pattern = ''; + let count = 0; + + for (let i = 0; i < digits; i++) { + let [startDigit, stopDigit] = zipped[i]; + + if (startDigit === stopDigit) { + pattern += startDigit; + } else if (startDigit !== '0' || stopDigit !== '9') { + pattern += toCharacterClass(startDigit, stopDigit); + } else { + count++; + } + } + + if (count) { + pattern += options.shorthand === true ? '\\d' : '[0-9]'; + } + + return { + pattern, + count: [count], + digits + }; +} + +function splitToPatterns(min, max, tok, options) { + let ranges = splitToRanges(min, max); + let tokens = []; + let start = min; + let prev; + + for (let i = 0; i < ranges.length; i++) { + let max = ranges[i]; + let obj = rangeToPattern(String(start), String(max), options); + let zeros = ''; + + if (!tok.isPadded && prev && prev.pattern === obj.pattern) { + if (prev.count.length > 1) { + prev.count.pop(); + } + + prev.count.push(obj.count[0]); + prev.string = prev.pattern + toQuantifier(prev.count); + start = max + 1; + continue; + } + + if (tok.isPadded) { + zeros = padZeros(max, tok, options); + } + + obj.string = zeros + obj.pattern + toQuantifier(obj.count); + tokens.push(obj); + start = max + 1; + prev = obj; + } + + return tokens; +} + +function filterPatterns(arr, comparison, prefix, intersection, options) { + let result = []; + + for (let ele of arr) { + let { + string + } = ele; // only push if _both_ are negative... + + if (!intersection && !contains(comparison, 'string', string)) { + result.push(prefix + string); + } // or _both_ are positive + + + if (intersection && contains(comparison, 'string', string)) { + result.push(prefix + string); + } + } + + return result; +} +/** + * Zip strings + */ + + +function zip(a, b) { + let arr = []; + + for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]); + + return arr; +} + +function compare$1(a, b) { + return a > b ? 1 : b > a ? -1 : 0; +} + +function contains(arr, key, val) { + return arr.some(ele => ele[key] === val); +} + +function countNines(min, len) { + return Number(String(min).slice(0, -len) + '9'.repeat(len)); +} + +function countZeros(integer, zeros) { + return integer - integer % Math.pow(10, zeros); +} + +function toQuantifier(digits) { + let [start = 0, stop = ''] = digits; + + if (stop || start > 1) { + return `{${start + (stop ? ',' + stop : '')}}`; + } + + return ''; +} + +function toCharacterClass(a, b, options) { + return `[${a}${b - a === 1 ? '' : '-'}${b}]`; +} + +function hasPadding(str) { + return /^-?(0+)\d/.test(str); +} + +function padZeros(value, tok, options) { + if (!tok.isPadded) { + return value; + } + + let diff = Math.abs(tok.maxLen - String(value).length); + let relax = options.relaxZeros !== false; + + switch (diff) { + case 0: + return ''; + + case 1: + return relax ? '0?' : '0'; + + case 2: + return relax ? '0{0,2}' : '00'; + + default: + { + return relax ? `0{0,${diff}}` : `0{${diff}}`; + } + } +} +/** + * Cache + */ + + +toRegexRange.cache = {}; + +toRegexRange.clearCache = () => toRegexRange.cache = {}; +/** + * Expose `toRegexRange` + */ + + +var toRegexRange_1 = toRegexRange; + +const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val); + +const transform = toNumber => { + return value => toNumber === true ? Number(value) : String(value); +}; + +const isValidValue = value => { + return typeof value === 'number' || typeof value === 'string' && value !== ''; +}; + +const isNumber$1 = num => Number.isInteger(+num); + +const zeros = input => { + let value = `${input}`; + let index = -1; + if (value[0] === '-') value = value.slice(1); + if (value === '0') return false; + + while (value[++index] === '0'); + + return index > 0; +}; + +const stringify$1 = (start, end, options) => { + if (typeof start === 'string' || typeof end === 'string') { + return true; + } + + return options.stringify === true; +}; + +const pad = (input, maxLength, toNumber) => { + if (maxLength > 0) { + let dash = input[0] === '-' ? '-' : ''; + if (dash) input = input.slice(1); + input = dash + input.padStart(dash ? maxLength - 1 : maxLength, '0'); + } + + if (toNumber === false) { + return String(input); + } + + return input; +}; + +const toMaxLen = (input, maxLength) => { + let negative = input[0] === '-' ? '-' : ''; + + if (negative) { + input = input.slice(1); + maxLength--; + } + + while (input.length < maxLength) input = '0' + input; + + return negative ? '-' + input : input; +}; + +const toSequence = (parts, options) => { + parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); + parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); + let prefix = options.capture ? '' : '?:'; + let positives = ''; + let negatives = ''; + let result; + + if (parts.positives.length) { + positives = parts.positives.join('|'); + } + + if (parts.negatives.length) { + negatives = `-(${prefix}${parts.negatives.join('|')})`; + } + + if (positives && negatives) { + result = `${positives}|${negatives}`; + } else { + result = positives || negatives; + } + + if (options.wrap) { + return `(${prefix}${result})`; + } + + return result; +}; + +const toRange = (a, b, isNumbers, options) => { + if (isNumbers) { + return toRegexRange_1(a, b, Object.assign({ + wrap: false + }, options)); + } + + let start = String.fromCharCode(a); + if (a === b) return start; + let stop = String.fromCharCode(b); + return `[${start}-${stop}]`; +}; + +const toRegex = (start, end, options) => { + if (Array.isArray(start)) { + let wrap = options.wrap === true; + let prefix = options.capture ? '' : '?:'; + return wrap ? `(${prefix}${start.join('|')})` : start.join('|'); + } + + return toRegexRange_1(start, end, options); +}; + +const rangeError = (...args) => { + return new RangeError('Invalid range arguments: ' + util$4.inspect(...args)); +}; + +const invalidRange = (start, end, options) => { + if (options.strictRanges === true) throw rangeError([start, end]); + return []; +}; + +const invalidStep = (step, options) => { + if (options.strictRanges === true) { + throw new TypeError(`Expected step "${step}" to be a number`); + } + + return []; +}; + +const fillNumbers = (start, end, step = 1, options = {}) => { + let a = Number(start); + let b = Number(end); + + if (!Number.isInteger(a) || !Number.isInteger(b)) { + if (options.strictRanges === true) throw rangeError([start, end]); + return []; + } // fix negative zero + + + if (a === 0) a = 0; + if (b === 0) b = 0; + let descending = a > b; + let startString = String(start); + let endString = String(end); + let stepString = String(step); + step = Math.max(Math.abs(step), 1); + let padded = zeros(startString) || zeros(endString) || zeros(stepString); + let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; + let toNumber = padded === false && stringify$1(start, end, options) === false; + let format = options.transform || transform(toNumber); + + if (options.toRegex && step === 1) { + return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); + } + + let parts = { + negatives: [], + positives: [] + }; + + let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num)); + + let range = []; + let index = 0; + + while (descending ? a >= b : a <= b) { + if (options.toRegex === true && step > 1) { + push(a); + } else { + range.push(pad(format(a, index), maxLen, toNumber)); + } + + a = descending ? a - step : a + step; + index++; + } + + if (options.toRegex === true) { + return step > 1 ? toSequence(parts, options) : toRegex(range, null, Object.assign({ + wrap: false + }, options)); + } + + return range; +}; + +const fillLetters = (start, end, step = 1, options = {}) => { + if (!isNumber$1(start) && start.length > 1 || !isNumber$1(end) && end.length > 1) { + return invalidRange(start, end, options); + } + + let format = options.transform || (val => String.fromCharCode(val)); + + let a = `${start}`.charCodeAt(0); + let b = `${end}`.charCodeAt(0); + let descending = a > b; + let min = Math.min(a, b); + let max = Math.max(a, b); + + if (options.toRegex && step === 1) { + return toRange(min, max, false, options); + } + + let range = []; + let index = 0; + + while (descending ? a >= b : a <= b) { + range.push(format(a, index)); + a = descending ? a - step : a + step; + index++; + } + + if (options.toRegex === true) { + return toRegex(range, null, { + wrap: false, + options + }); + } + + return range; +}; + +const fill$2 = (start, end, step, options = {}) => { + if (end == null && isValidValue(start)) { + return [start]; + } + + if (!isValidValue(start) || !isValidValue(end)) { + return invalidRange(start, end, options); + } + + if (typeof step === 'function') { + return fill$2(start, end, 1, { + transform: step + }); + } + + if (isObject$1(step)) { + return fill$2(start, end, 0, step); + } + + let opts = Object.assign({}, options); + if (opts.capture === true) opts.wrap = true; + step = step || opts.step || 1; + + if (!isNumber$1(step)) { + if (step != null && !isObject$1(step)) return invalidStep(step, opts); + return fill$2(start, end, 1, step); + } + + if (isNumber$1(start) && isNumber$1(end)) { + return fillNumbers(start, end, step, opts); + } + + return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); +}; + +var fillRange = fill$2; + +const compile = (ast, options = {}) => { + let walk = (node, parent = {}) => { + let invalidBlock = utils$2.isInvalidBrace(parent); + let invalidNode = node.invalid === true && options.escapeInvalid === true; + let invalid = invalidBlock === true || invalidNode === true; + let prefix = options.escapeInvalid === true ? '\\' : ''; + let output = ''; + + if (node.isOpen === true) { + return prefix + node.value; + } + + if (node.isClose === true) { + return prefix + node.value; + } + + if (node.type === 'open') { + return invalid ? prefix + node.value : '('; + } + + if (node.type === 'close') { + return invalid ? prefix + node.value : ')'; + } + + if (node.type === 'comma') { + return node.prev.type === 'comma' ? '' : invalid ? node.value : '|'; + } + + if (node.value) { + return node.value; + } + + if (node.nodes && node.ranges > 0) { + let args = utils$2.reduce(node.nodes); + let range = fillRange(...args, Object.assign({}, options, { + wrap: false, + toRegex: true + })); + + if (range.length !== 0) { + return args.length > 1 && range.length > 1 ? `(${range})` : range; + } + } + + if (node.nodes) { + for (let child of node.nodes) { + output += walk(child, node); + } + } + + return output; + }; + + return walk(ast); +}; + +var compile_1 = compile; + +const append = (queue = '', stash = '', enclose = false) => { + let result = []; + queue = [].concat(queue); + stash = [].concat(stash); + if (!stash.length) return queue; + + if (!queue.length) { + return enclose ? utils$2.flatten(stash).map(ele => `{${ele}}`) : stash; + } + + for (let item of queue) { + if (Array.isArray(item)) { + for (let value of item) { + result.push(append(value, stash, enclose)); + } + } else { + for (let ele of stash) { + if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; + result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele); + } + } + } + + return utils$2.flatten(result); +}; + +const expand$1 = (ast, options = {}) => { + let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit; + + let walk = (node, parent = {}) => { + node.queue = []; + let p = parent; + let q = parent.queue; + + while (p.type !== 'brace' && p.type !== 'root' && p.parent) { + p = p.parent; + q = p.queue; + } + + if (node.invalid || node.dollar) { + q.push(append(q.pop(), stringify(node, options))); + return; + } + + if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { + q.push(append(q.pop(), ['{}'])); + return; + } + + if (node.nodes && node.ranges > 0) { + let args = utils$2.reduce(node.nodes); + + if (utils$2.exceedsLimit(...args, options.step, rangeLimit)) { + throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); + } + + let range = fillRange(...args, options); + + if (range.length === 0) { + range = stringify(node, options); + } + + q.push(append(q.pop(), range)); + node.nodes = []; + return; + } + + let enclose = utils$2.encloseBrace(node); + let queue = node.queue; + let block = node; + + while (block.type !== 'brace' && block.type !== 'root' && block.parent) { + block = block.parent; + queue = block.queue; + } + + for (let i = 0; i < node.nodes.length; i++) { + let child = node.nodes[i]; + + if (child.type === 'comma' && node.type === 'brace') { + if (i === 1) queue.push(''); + queue.push(''); + continue; + } + + if (child.type === 'close') { + q.push(append(q.pop(), queue, enclose)); + continue; + } + + if (child.value && child.type !== 'open') { + queue.push(append(queue.pop(), child.value)); + continue; + } + + if (child.nodes) { + walk(child, node); + } + } + + return queue; + }; + + return utils$2.flatten(walk(ast)); +}; + +var expand_1 = expand$1; + +var constants$2 = { + MAX_LENGTH: 1024 * 64, + // Digits + CHAR_0: '0', + + /* 0 */ + CHAR_9: '9', + + /* 9 */ + // Alphabet chars. + CHAR_UPPERCASE_A: 'A', + + /* A */ + CHAR_LOWERCASE_A: 'a', + + /* a */ + CHAR_UPPERCASE_Z: 'Z', + + /* Z */ + CHAR_LOWERCASE_Z: 'z', + + /* z */ + CHAR_LEFT_PARENTHESES: '(', + + /* ( */ + CHAR_RIGHT_PARENTHESES: ')', + + /* ) */ + CHAR_ASTERISK: '*', + + /* * */ + // Non-alphabetic chars. + CHAR_AMPERSAND: '&', + + /* & */ + CHAR_AT: '@', + + /* @ */ + CHAR_BACKSLASH: '\\', + + /* \ */ + CHAR_BACKTICK: '`', + + /* ` */ + CHAR_CARRIAGE_RETURN: '\r', + + /* \r */ + CHAR_CIRCUMFLEX_ACCENT: '^', + + /* ^ */ + CHAR_COLON: ':', + + /* : */ + CHAR_COMMA: ',', + + /* , */ + CHAR_DOLLAR: '$', + + /* . */ + CHAR_DOT: '.', + + /* . */ + CHAR_DOUBLE_QUOTE: '"', + + /* " */ + CHAR_EQUAL: '=', + + /* = */ + CHAR_EXCLAMATION_MARK: '!', + + /* ! */ + CHAR_FORM_FEED: '\f', + + /* \f */ + CHAR_FORWARD_SLASH: '/', + + /* / */ + CHAR_HASH: '#', + + /* # */ + CHAR_HYPHEN_MINUS: '-', + + /* - */ + CHAR_LEFT_ANGLE_BRACKET: '<', + + /* < */ + CHAR_LEFT_CURLY_BRACE: '{', + + /* { */ + CHAR_LEFT_SQUARE_BRACKET: '[', + + /* [ */ + CHAR_LINE_FEED: '\n', + + /* \n */ + CHAR_NO_BREAK_SPACE: '\u00A0', + + /* \u00A0 */ + CHAR_PERCENT: '%', + + /* % */ + CHAR_PLUS: '+', + + /* + */ + CHAR_QUESTION_MARK: '?', + + /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: '>', + + /* > */ + CHAR_RIGHT_CURLY_BRACE: '}', + + /* } */ + CHAR_RIGHT_SQUARE_BRACKET: ']', + + /* ] */ + CHAR_SEMICOLON: ';', + + /* ; */ + CHAR_SINGLE_QUOTE: '\'', + + /* ' */ + CHAR_SPACE: ' ', + + /* */ + CHAR_TAB: '\t', + + /* \t */ + CHAR_UNDERSCORE: '_', + + /* _ */ + CHAR_VERTICAL_LINE: '|', + + /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' + /* \uFEFF */ + +}; + +/** + * Constants + */ + + +const { + MAX_LENGTH: MAX_LENGTH$2, + CHAR_BACKSLASH, + + /* \ */ + CHAR_BACKTICK, + + /* ` */ + CHAR_COMMA: CHAR_COMMA$1, + + /* , */ + CHAR_DOT, + + /* . */ + CHAR_LEFT_PARENTHESES, + + /* ( */ + CHAR_RIGHT_PARENTHESES, + + /* ) */ + CHAR_LEFT_CURLY_BRACE, + + /* { */ + CHAR_RIGHT_CURLY_BRACE, + + /* } */ + CHAR_LEFT_SQUARE_BRACKET, + + /* [ */ + CHAR_RIGHT_SQUARE_BRACKET, + + /* ] */ + CHAR_DOUBLE_QUOTE, + + /* " */ + CHAR_SINGLE_QUOTE, + + /* ' */ + CHAR_NO_BREAK_SPACE, + CHAR_ZERO_WIDTH_NOBREAK_SPACE +} = constants$2; +/** + * parse + */ + +const parse$3 = (input, options = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + let opts = options || {}; + let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$2, opts.maxLength) : MAX_LENGTH$2; + + if (input.length > max) { + throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); + } + + let ast = { + type: 'root', + input, + nodes: [] + }; + let stack = [ast]; + let block = ast; + let prev = ast; + let brackets = 0; + let length = input.length; + let index = 0; + let depth = 0; + let value; + /** + * Helpers + */ + + const advance = () => input[index++]; + + const push = node => { + if (node.type === 'text' && prev.type === 'dot') { + prev.type = 'text'; + } + + if (prev && prev.type === 'text' && node.type === 'text') { + prev.value += node.value; + return; + } + + block.nodes.push(node); + node.parent = block; + node.prev = prev; + prev = node; + return node; + }; + + push({ + type: 'bos' + }); + + while (index < length) { + block = stack[stack.length - 1]; + value = advance(); + /** + * Invalid chars + */ + + if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { + continue; + } + /** + * Escaped chars + */ + + + if (value === CHAR_BACKSLASH) { + push({ + type: 'text', + value: (options.keepEscaping ? value : '') + advance() + }); + continue; + } + /** + * Right square bracket (literal): ']' + */ + + + if (value === CHAR_RIGHT_SQUARE_BRACKET) { + push({ + type: 'text', + value: '\\' + value + }); + continue; + } + /** + * Left square bracket: '[' + */ + + + if (value === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + let next; + + while (index < length && (next = advance())) { + value += next; + + if (next === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + continue; + } + + if (next === CHAR_BACKSLASH) { + value += advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + brackets--; + + if (brackets === 0) { + break; + } + } + } + + push({ + type: 'text', + value + }); + continue; + } + /** + * Parentheses + */ + + + if (value === CHAR_LEFT_PARENTHESES) { + block = push({ + type: 'paren', + nodes: [] + }); + stack.push(block); + push({ + type: 'text', + value + }); + continue; + } + + if (value === CHAR_RIGHT_PARENTHESES) { + if (block.type !== 'paren') { + push({ + type: 'text', + value + }); + continue; + } + + block = stack.pop(); + push({ + type: 'text', + value + }); + block = stack[stack.length - 1]; + continue; + } + /** + * Quotes: '|"|` + */ + + + if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { + let open = value; + let next; + + if (options.keepQuotes !== true) { + value = ''; + } + + while (index < length && (next = advance())) { + if (next === CHAR_BACKSLASH) { + value += next + advance(); + continue; + } + + if (next === open) { + if (options.keepQuotes === true) value += next; + break; + } + + value += next; + } + + push({ + type: 'text', + value + }); + continue; + } + /** + * Left curly brace: '{' + */ + + + if (value === CHAR_LEFT_CURLY_BRACE) { + depth++; + let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; + let brace = { + type: 'brace', + open: true, + close: false, + dollar, + depth, + commas: 0, + ranges: 0, + nodes: [] + }; + block = push(brace); + stack.push(block); + push({ + type: 'open', + value + }); + continue; + } + /** + * Right curly brace: '}' + */ + + + if (value === CHAR_RIGHT_CURLY_BRACE) { + if (block.type !== 'brace') { + push({ + type: 'text', + value + }); + continue; + } + + let type = 'close'; + block = stack.pop(); + block.close = true; + push({ + type, + value + }); + depth--; + block = stack[stack.length - 1]; + continue; + } + /** + * Comma: ',' + */ + + + if (value === CHAR_COMMA$1 && depth > 0) { + if (block.ranges > 0) { + block.ranges = 0; + let open = block.nodes.shift(); + block.nodes = [open, { + type: 'text', + value: stringify(block) + }]; + } + + push({ + type: 'comma', + value + }); + block.commas++; + continue; + } + /** + * Dot: '.' + */ + + + if (value === CHAR_DOT && depth > 0 && block.commas === 0) { + let siblings = block.nodes; + + if (depth === 0 || siblings.length === 0) { + push({ + type: 'text', + value + }); + continue; + } + + if (prev.type === 'dot') { + block.range = []; + prev.value += value; + prev.type = 'range'; + + if (block.nodes.length !== 3 && block.nodes.length !== 5) { + block.invalid = true; + block.ranges = 0; + prev.type = 'text'; + continue; + } + + block.ranges++; + block.args = []; + continue; + } + + if (prev.type === 'range') { + siblings.pop(); + let before = siblings[siblings.length - 1]; + before.value += prev.value + value; + prev = before; + block.ranges--; + continue; + } + + push({ + type: 'dot', + value + }); + continue; + } + /** + * Text + */ + + + push({ + type: 'text', + value + }); + } // Mark imbalanced braces and brackets as invalid + + + do { + block = stack.pop(); + + if (block.type !== 'root') { + block.nodes.forEach(node => { + if (!node.nodes) { + if (node.type === 'open') node.isOpen = true; + if (node.type === 'close') node.isClose = true; + if (!node.nodes) node.type = 'text'; + node.invalid = true; + } + }); // get the location of the block on parent.nodes (block's siblings) + + let parent = stack[stack.length - 1]; + let index = parent.nodes.indexOf(block); // replace the (invalid) block with it's nodes + + parent.nodes.splice(index, 1, ...block.nodes); + } + } while (stack.length > 0); + + push({ + type: 'eos' + }); + return ast; +}; + +var parse_1 = parse$3; + +/** + * Expand the given pattern or create a regex-compatible string. + * + * ```js + * const braces = require('braces'); + * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)'] + * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c'] + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {String} + * @api public + */ + + +const braces = (input, options = {}) => { + let output = []; + + if (Array.isArray(input)) { + for (let pattern of input) { + let result = braces.create(pattern, options); + + if (Array.isArray(result)) { + output.push(...result); + } else { + output.push(result); + } + } + } else { + output = [].concat(braces.create(input, options)); + } + + if (options && options.expand === true && options.nodupes === true) { + output = [...new Set(output)]; + } + + return output; +}; +/** + * Parse the given `str` with the given `options`. + * + * ```js + * // braces.parse(pattern, [, options]); + * const ast = braces.parse('a/{b,c}/d'); + * console.log(ast); + * ``` + * @param {String} pattern Brace pattern to parse + * @param {Object} options + * @return {Object} Returns an AST + * @api public + */ + + +braces.parse = (input, options = {}) => parse_1(input, options); +/** + * Creates a braces string from an AST, or an AST node. + * + * ```js + * const braces = require('braces'); + * let ast = braces.parse('foo/{a,b}/bar'); + * console.log(stringify(ast.nodes[2])); //=> '{a,b}' + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + + +braces.stringify = (input, options = {}) => { + if (typeof input === 'string') { + return stringify(braces.parse(input, options), options); + } + + return stringify(input, options); +}; +/** + * Compiles a brace pattern into a regex-compatible, optimized string. + * This method is called by the main [braces](#braces) function by default. + * + * ```js + * const braces = require('braces'); + * console.log(braces.compile('a/{b,c}/d')); + * //=> ['a/(b|c)/d'] + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + + +braces.compile = (input, options = {}) => { + if (typeof input === 'string') { + input = braces.parse(input, options); + } + + return compile_1(input, options); +}; +/** + * Expands a brace pattern into an array. This method is called by the + * main [braces](#braces) function when `options.expand` is true. Before + * using this method it's recommended that you read the [performance notes](#performance)) + * and advantages of using [.compile](#compile) instead. + * + * ```js + * const braces = require('braces'); + * console.log(braces.expand('a/{b,c}/d')); + * //=> ['a/b/d', 'a/c/d']; + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + + +braces.expand = (input, options = {}) => { + if (typeof input === 'string') { + input = braces.parse(input, options); + } + + let result = expand_1(input, options); // filter out empty strings if specified + + if (options.noempty === true) { + result = result.filter(Boolean); + } // filter out duplicates if specified + + + if (options.nodupes === true) { + result = [...new Set(result)]; + } + + return result; +}; +/** + * Processes a brace pattern and returns either an expanded array + * (if `options.expand` is true), a highly optimized regex-compatible string. + * This method is called by the main [braces](#braces) function. + * + * ```js + * const braces = require('braces'); + * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) + * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + + +braces.create = (input, options = {}) => { + if (input === '' || input.length < 3) { + return [input]; + } + + return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options); +}; +/** + * Expose "braces" + */ + + +var braces_1 = braces; + +const WIN_SLASH = '\\\\/'; +const WIN_NO_SLASH = `[^${WIN_SLASH}]`; +/** + * Posix glob regex + */ + +const DOT_LITERAL = '\\.'; +const PLUS_LITERAL = '\\+'; +const QMARK_LITERAL = '\\?'; +const SLASH_LITERAL = '\\/'; +const ONE_CHAR = '(?=.)'; +const QMARK = '[^/]'; +const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; +const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; +const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; +const NO_DOT = `(?!${DOT_LITERAL})`; +const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; +const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; +const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; +const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; +const STAR = `${QMARK}*?`; +const POSIX_CHARS = { + DOT_LITERAL, + PLUS_LITERAL, + QMARK_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + QMARK, + END_ANCHOR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK_NO_DOT, + STAR, + START_ANCHOR +}; +/** + * Windows glob regex + */ + +const WINDOWS_CHARS = Object.assign({}, POSIX_CHARS, { + SLASH_LITERAL: `[${WIN_SLASH}]`, + QMARK: WIN_NO_SLASH, + STAR: `${WIN_NO_SLASH}*?`, + DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, + NO_DOT: `(?!${DOT_LITERAL})`, + NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, + NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + QMARK_NO_DOT: `[^.${WIN_SLASH}]`, + START_ANCHOR: `(?:^|[${WIN_SLASH}])`, + END_ANCHOR: `(?:[${WIN_SLASH}]|$)` +}); +/** + * POSIX Bracket Regex + */ + +const POSIX_REGEX_SOURCE = { + alnum: 'a-zA-Z0-9', + alpha: 'a-zA-Z', + ascii: '\\x00-\\x7F', + blank: ' \\t', + cntrl: '\\x00-\\x1F\\x7F', + digit: '0-9', + graph: '\\x21-\\x7E', + lower: 'a-z', + print: '\\x20-\\x7E ', + punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', + space: ' \\t\\r\\n\\v\\f', + upper: 'A-Z', + word: 'A-Za-z0-9_', + xdigit: 'A-Fa-f0-9' +}; +var constants$3 = { + MAX_LENGTH: 1024 * 64, + POSIX_REGEX_SOURCE, + // regular expressions + REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, + REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, + REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, + REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, + REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, + REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, + // Replace globs with equivalent patterns to reduce parsing time. + REPLACEMENTS: { + '***': '*', + '**/**': '**', + '**/**/**': '**' + }, + // Digits + CHAR_0: 48, + + /* 0 */ + CHAR_9: 57, + + /* 9 */ + // Alphabet chars. + CHAR_UPPERCASE_A: 65, + + /* A */ + CHAR_LOWERCASE_A: 97, + + /* a */ + CHAR_UPPERCASE_Z: 90, + + /* Z */ + CHAR_LOWERCASE_Z: 122, + + /* z */ + CHAR_LEFT_PARENTHESES: 40, + + /* ( */ + CHAR_RIGHT_PARENTHESES: 41, + + /* ) */ + CHAR_ASTERISK: 42, + + /* * */ + // Non-alphabetic chars. + CHAR_AMPERSAND: 38, + + /* & */ + CHAR_AT: 64, + + /* @ */ + CHAR_BACKWARD_SLASH: 92, + + /* \ */ + CHAR_CARRIAGE_RETURN: 13, + + /* \r */ + CHAR_CIRCUMFLEX_ACCENT: 94, + + /* ^ */ + CHAR_COLON: 58, + + /* : */ + CHAR_COMMA: 44, + + /* , */ + CHAR_DOT: 46, + + /* . */ + CHAR_DOUBLE_QUOTE: 34, + + /* " */ + CHAR_EQUAL: 61, + + /* = */ + CHAR_EXCLAMATION_MARK: 33, + + /* ! */ + CHAR_FORM_FEED: 12, + + /* \f */ + CHAR_FORWARD_SLASH: 47, + + /* / */ + CHAR_GRAVE_ACCENT: 96, + + /* ` */ + CHAR_HASH: 35, + + /* # */ + CHAR_HYPHEN_MINUS: 45, + + /* - */ + CHAR_LEFT_ANGLE_BRACKET: 60, + + /* < */ + CHAR_LEFT_CURLY_BRACE: 123, + + /* { */ + CHAR_LEFT_SQUARE_BRACKET: 91, + + /* [ */ + CHAR_LINE_FEED: 10, + + /* \n */ + CHAR_NO_BREAK_SPACE: 160, + + /* \u00A0 */ + CHAR_PERCENT: 37, + + /* % */ + CHAR_PLUS: 43, + + /* + */ + CHAR_QUESTION_MARK: 63, + + /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: 62, + + /* > */ + CHAR_RIGHT_CURLY_BRACE: 125, + + /* } */ + CHAR_RIGHT_SQUARE_BRACKET: 93, + + /* ] */ + CHAR_SEMICOLON: 59, + + /* ; */ + CHAR_SINGLE_QUOTE: 39, + + /* ' */ + CHAR_SPACE: 32, + + /* */ + CHAR_TAB: 9, + + /* \t */ + CHAR_UNDERSCORE: 95, + + /* _ */ + CHAR_VERTICAL_LINE: 124, + + /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, + + /* \uFEFF */ + SEP: path$2.sep, + + /** + * Create EXTGLOB_CHARS + */ + extglobChars(chars) { + return { + '!': { + type: 'negate', + open: '(?:(?!(?:', + close: `))${chars.STAR})` + }, + '?': { + type: 'qmark', + open: '(?:', + close: ')?' + }, + '+': { + type: 'plus', + open: '(?:', + close: ')+' + }, + '*': { + type: 'star', + open: '(?:', + close: ')*' + }, + '@': { + type: 'at', + open: '(?:', + close: ')' + } + }; + }, + + /** + * Create GLOB_CHARS + */ + globChars(win32) { + return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; + } + +}; + +var utils$3 = createCommonjsModule(function (module, exports) { + + const win32 = process.platform === 'win32'; + const { + REGEX_BACKSLASH, + REGEX_REMOVE_BACKSLASH, + REGEX_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_GLOBAL + } = constants$3; + + exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); + + exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); + + exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); + + exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); + + exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); + + exports.removeBackslashes = str => { + return str.replace(REGEX_REMOVE_BACKSLASH, match => { + return match === '\\' ? '' : match; + }); + }; + + exports.supportsLookbehinds = () => { + const segs = process.version.slice(1).split('.').map(Number); + + if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) { + return true; + } + + return false; + }; + + exports.isWindows = options => { + if (options && typeof options.windows === 'boolean') { + return options.windows; + } + + return win32 === true || path$2.sep === '\\'; + }; + + exports.escapeLast = (input, char, lastIdx) => { + const idx = input.lastIndexOf(char, lastIdx); + if (idx === -1) return input; + if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); + return `${input.slice(0, idx)}\\${input.slice(idx)}`; + }; + + exports.removePrefix = (input, state = {}) => { + let output = input; + + if (output.startsWith('./')) { + output = output.slice(2); + state.prefix = './'; + } + + return output; + }; + + exports.wrapOutput = (input, state = {}, options = {}) => { + const prepend = options.contains ? '' : '^'; + const append = options.contains ? '' : '$'; + let output = `${prepend}(?:${input})${append}`; + + if (state.negated === true) { + output = `(?:^(?!${output}).*$)`; + } + + return output; + }; +}); +var utils_1$3 = utils$3.isObject; +var utils_2$3 = utils$3.hasRegexChars; +var utils_3$3 = utils$3.isRegexChar; +var utils_4$2 = utils$3.escapeRegex; +var utils_5$2 = utils$3.toPosixSlashes; +var utils_6$2 = utils$3.removeBackslashes; +var utils_7$2 = utils$3.supportsLookbehinds; +var utils_8$2 = utils$3.isWindows; +var utils_9$2 = utils$3.escapeLast; +var utils_10$1 = utils$3.removePrefix; +var utils_11$1 = utils$3.wrapOutput; + +const { + CHAR_ASTERISK, + + /* * */ + CHAR_AT, + + /* @ */ + CHAR_BACKWARD_SLASH, + + /* \ */ + CHAR_COMMA: CHAR_COMMA$2, + + /* , */ + CHAR_DOT: CHAR_DOT$1, + + /* . */ + CHAR_EXCLAMATION_MARK, + + /* ! */ + CHAR_FORWARD_SLASH, + + /* / */ + CHAR_LEFT_CURLY_BRACE: CHAR_LEFT_CURLY_BRACE$1, + + /* { */ + CHAR_LEFT_PARENTHESES: CHAR_LEFT_PARENTHESES$1, + + /* ( */ + CHAR_LEFT_SQUARE_BRACKET: CHAR_LEFT_SQUARE_BRACKET$1, + + /* [ */ + CHAR_PLUS: CHAR_PLUS$1, + + /* + */ + CHAR_QUESTION_MARK, + + /* ? */ + CHAR_RIGHT_CURLY_BRACE: CHAR_RIGHT_CURLY_BRACE$1, + + /* } */ + CHAR_RIGHT_PARENTHESES: CHAR_RIGHT_PARENTHESES$1, + + /* ) */ + CHAR_RIGHT_SQUARE_BRACKET: CHAR_RIGHT_SQUARE_BRACKET$1 + /* ] */ + +} = constants$3; + +const isPathSeparator = code => { + return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; +}; + +const depth = token => { + if (token.isPrefix !== true) { + token.depth = token.isGlobstar ? Infinity : 1; + } +}; +/** + * Quickly scans a glob pattern and returns an object with a handful of + * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), + * `glob` (the actual pattern), and `negated` (true if the path starts with `!`). + * + * ```js + * const pm = require('picomatch'); + * console.log(pm.scan('foo/bar/*.js')); + * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {Object} Returns an object with tokens and regex source string. + * @api public + */ + + +const scan = (input, options) => { + const opts = options || {}; + const length = input.length - 1; + const scanToEnd = opts.parts === true || opts.scanToEnd === true; + const slashes = []; + const tokens = []; + const parts = []; + let str = input; + let index = -1; + let start = 0; + let lastIndex = 0; + let isBrace = false; + let isBracket = false; + let isGlob = false; + let isExtglob = false; + let isGlobstar = false; + let braceEscaped = false; + let backslashes = false; + let negated = false; + let finished = false; + let braces = 0; + let prev; + let code; + let token = { + value: '', + depth: 0, + isGlob: false + }; + + const eos = () => index >= length; + + const peek = () => str.charCodeAt(index + 1); + + const advance = () => { + prev = code; + return str.charCodeAt(++index); + }; + + while (index < length) { + code = advance(); + let next; + + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + + if (code === CHAR_LEFT_CURLY_BRACE$1) { + braceEscaped = true; + } + + continue; + } + + if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE$1) { + braces++; + + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (code === CHAR_LEFT_CURLY_BRACE$1) { + braces++; + continue; + } + + if (braceEscaped !== true && code === CHAR_DOT$1 && (code = advance()) === CHAR_DOT$1) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (braceEscaped !== true && code === CHAR_COMMA$2) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_RIGHT_CURLY_BRACE$1) { + braces--; + + if (braces === 0) { + braceEscaped = false; + isBrace = token.isBrace = true; + finished = true; + break; + } + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_FORWARD_SLASH) { + slashes.push(index); + tokens.push(token); + token = { + value: '', + depth: 0, + isGlob: false + }; + if (finished === true) continue; + + if (prev === CHAR_DOT$1 && index === start + 1) { + start += 2; + continue; + } + + lastIndex = index + 1; + continue; + } + + if (opts.noext !== true) { + const isExtglobChar = code === CHAR_PLUS$1 || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK; + + if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES$1) { + isGlob = token.isGlob = true; + isExtglob = token.isExtglob = true; + finished = true; + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES$1) { + isGlob = token.isGlob = true; + finished = true; + break; + } + } + + continue; + } + + break; + } + } + + if (code === CHAR_ASTERISK) { + if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_QUESTION_MARK) { + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_LEFT_SQUARE_BRACKET$1) { + while (eos() !== true && (next = advance())) { + if (next === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET$1) { + isBracket = token.isBracket = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + } + } + + if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { + negated = token.negated = true; + start++; + continue; + } + + if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES$1) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES$1) { + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + } + } + + if (isGlob === true) { + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + } + + if (opts.noext === true) { + isExtglob = false; + isGlob = false; + } + + let base = str; + let prefix = ''; + let glob = ''; + + if (start > 0) { + prefix = str.slice(0, start); + str = str.slice(start); + lastIndex -= start; + } + + if (base && isGlob === true && lastIndex > 0) { + base = str.slice(0, lastIndex); + glob = str.slice(lastIndex); + } else if (isGlob === true) { + base = ''; + glob = str; + } else { + base = str; + } + + if (base && base !== '' && base !== '/' && base !== str) { + if (isPathSeparator(base.charCodeAt(base.length - 1))) { + base = base.slice(0, -1); + } + } + + if (opts.unescape === true) { + if (glob) glob = utils$3.removeBackslashes(glob); + + if (base && backslashes === true) { + base = utils$3.removeBackslashes(base); + } + } + + const state = { + prefix, + input, + start, + base, + glob, + isBrace, + isBracket, + isGlob, + isExtglob, + isGlobstar, + negated + }; + + if (opts.tokens === true) { + state.maxDepth = 0; + + if (!isPathSeparator(code)) { + tokens.push(token); + } + + state.tokens = tokens; + } + + if (opts.parts === true || opts.tokens === true) { + let prevIndex; + + for (let idx = 0; idx < slashes.length; idx++) { + const n = prevIndex ? prevIndex + 1 : start; + const i = slashes[idx]; + const value = input.slice(n, i); + + if (opts.tokens) { + if (idx === 0 && start !== 0) { + tokens[idx].isPrefix = true; + tokens[idx].value = prefix; + } else { + tokens[idx].value = value; + } + + depth(tokens[idx]); + state.maxDepth += tokens[idx].depth; + } + + if (idx !== 0 || value !== '') { + parts.push(value); + } + + prevIndex = i; + } + + if (prevIndex && prevIndex + 1 < input.length) { + const value = input.slice(prevIndex + 1); + parts.push(value); + + if (opts.tokens) { + tokens[tokens.length - 1].value = value; + depth(tokens[tokens.length - 1]); + state.maxDepth += tokens[tokens.length - 1].depth; + } + } + + state.slashes = slashes; + state.parts = parts; + } + + return state; +}; + +var scan_1 = scan; + +/** + * Constants + */ + + +const { + MAX_LENGTH: MAX_LENGTH$3, + POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1, + REGEX_NON_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_BACKREF, + REPLACEMENTS +} = constants$3; +/** + * Helpers + */ + +const expandRange = (args, options) => { + if (typeof options.expandRange === 'function') { + return options.expandRange(...args, options); + } + + args.sort(); + const value = `[${args.join('-')}]`; + + try { + /* eslint-disable-next-line no-new */ + new RegExp(value); + } catch (ex) { + return args.map(v => utils$3.escapeRegex(v)).join('..'); + } + + return value; +}; +/** + * Create the message for a syntax error + */ + + +const syntaxError = (type, char) => { + return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; +}; +/** + * Parse the given input string. + * @param {String} input + * @param {Object} options + * @return {Object} + */ + + +const parse$4 = (input, options) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + input = REPLACEMENTS[input] || input; + const opts = Object.assign({}, options); + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$3, opts.maxLength) : MAX_LENGTH$3; + let len = input.length; + + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + const bos = { + type: 'bos', + value: '', + output: opts.prepend || '' + }; + const tokens = [bos]; + const capture = opts.capture ? '' : '?:'; + const win32 = utils$3.isWindows(options); // create constants based on platform, for windows or posix + + const PLATFORM_CHARS = constants$3.globChars(win32); + const EXTGLOB_CHARS = constants$3.extglobChars(PLATFORM_CHARS); + const { + DOT_LITERAL, + PLUS_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK, + QMARK_NO_DOT, + STAR, + START_ANCHOR + } = PLATFORM_CHARS; + + const globstar = opts => { + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const nodot = opts.dot ? '' : NO_DOT; + const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; + let star = opts.bash === true ? globstar(opts) : STAR; + + if (opts.capture) { + star = `(${star})`; + } // minimatch options support + + + if (typeof opts.noext === 'boolean') { + opts.noextglob = opts.noext; + } + + const state = { + input, + index: -1, + start: 0, + dot: opts.dot === true, + consumed: '', + output: '', + prefix: '', + backtrack: false, + negated: false, + brackets: 0, + braces: 0, + parens: 0, + quotes: 0, + globstar: false, + tokens + }; + input = utils$3.removePrefix(input, state); + len = input.length; + const extglobs = []; + const braces = []; + const stack = []; + let prev = bos; + let value; + /** + * Tokenizing helpers + */ + + const eos = () => state.index === len - 1; + + const peek = state.peek = (n = 1) => input[state.index + n]; + + const advance = state.advance = () => input[++state.index]; + + const remaining = () => input.slice(state.index + 1); + + const consume = (value = '', num = 0) => { + state.consumed += value; + state.index += num; + }; + + const append = token => { + state.output += token.output != null ? token.output : token.value; + consume(token.value); + }; + + const negate = () => { + let count = 1; + + while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { + advance(); + state.start++; + count++; + } + + if (count % 2 === 0) { + return false; + } + + state.negated = true; + state.start++; + return true; + }; + + const increment = type => { + state[type]++; + stack.push(type); + }; + + const decrement = type => { + state[type]--; + stack.pop(); + }; + /** + * Push tokens onto the tokens array. This helper speeds up + * tokenizing by 1) helping us avoid backtracking as much as possible, + * and 2) helping us avoid creating extra tokens when consecutive + * characters are plain text. This improves performance and simplifies + * lookbehinds. + */ + + + const push = tok => { + if (prev.type === 'globstar') { + const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); + const isExtglob = tok.extglob === true || extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'); + + if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { + state.output = state.output.slice(0, -prev.output.length); + prev.type = 'star'; + prev.value = '*'; + prev.output = star; + state.output += prev.output; + } + } + + if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { + extglobs[extglobs.length - 1].inner += tok.value; + } + + if (tok.value || tok.output) append(tok); + + if (prev && prev.type === 'text' && tok.type === 'text') { + prev.value += tok.value; + prev.output = (prev.output || '') + tok.value; + return; + } + + tok.prev = prev; + tokens.push(tok); + prev = tok; + }; + + const extglobOpen = (type, value) => { + const token = Object.assign({}, EXTGLOB_CHARS[value], { + conditions: 1, + inner: '' + }); + token.prev = prev; + token.parens = state.parens; + token.output = state.output; + const output = (opts.capture ? '(' : '') + token.open; + increment('parens'); + push({ + type, + value, + output: state.output ? '' : ONE_CHAR + }); + push({ + type: 'paren', + extglob: true, + value: advance(), + output + }); + extglobs.push(token); + }; + + const extglobClose = token => { + let output = token.close + (opts.capture ? ')' : ''); + + if (token.type === 'negate') { + let extglobStar = star; + + if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { + extglobStar = globstar(opts); + } + + if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { + output = token.close = `)$))${extglobStar}`; + } + + if (token.prev.type === 'bos' && eos()) { + state.negatedExtglob = true; + } + } + + push({ + type: 'paren', + extglob: true, + value, + output + }); + decrement('parens'); + }; + /** + * Fast paths + */ + + + if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { + let backslashes = false; + let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { + if (first === '\\') { + backslashes = true; + return m; + } + + if (first === '?') { + if (esc) { + return esc + first + (rest ? QMARK.repeat(rest.length) : ''); + } + + if (index === 0) { + return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); + } + + return QMARK.repeat(chars.length); + } + + if (first === '.') { + return DOT_LITERAL.repeat(chars.length); + } + + if (first === '*') { + if (esc) { + return esc + first + (rest ? star : ''); + } + + return star; + } + + return esc ? m : `\\${m}`; + }); + + if (backslashes === true) { + if (opts.unescape === true) { + output = output.replace(/\\/g, ''); + } else { + output = output.replace(/\\+/g, m => { + return m.length % 2 === 0 ? '\\\\' : m ? '\\' : ''; + }); + } + } + + if (output === input && opts.contains === true) { + state.output = input; + return state; + } + + state.output = utils$3.wrapOutput(output, state, options); + return state; + } + /** + * Tokenize input until we reach end-of-string + */ + + + while (!eos()) { + value = advance(); + + if (value === '\u0000') { + continue; + } + /** + * Escaped characters + */ + + + if (value === '\\') { + const next = peek(); + + if (next === '/' && opts.bash !== true) { + continue; + } + + if (next === '.' || next === ';') { + continue; + } + + if (!next) { + value += '\\'; + push({ + type: 'text', + value + }); + continue; + } // collapse slashes to reduce potential for exploits + + + const match = /^\\+/.exec(remaining()); + let slashes = 0; + + if (match && match[0].length > 2) { + slashes = match[0].length; + state.index += slashes; + + if (slashes % 2 !== 0) { + value += '\\'; + } + } + + if (opts.unescape === true) { + value = advance() || ''; + } else { + value += advance() || ''; + } + + if (state.brackets === 0) { + push({ + type: 'text', + value + }); + continue; + } + } + /** + * If we're inside a regex character class, continue + * until we reach the closing bracket. + */ + + + if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { + if (opts.posix !== false && value === ':') { + const inner = prev.value.slice(1); + + if (inner.includes('[')) { + prev.posix = true; + + if (inner.includes(':')) { + const idx = prev.value.lastIndexOf('['); + const pre = prev.value.slice(0, idx); + const rest = prev.value.slice(idx + 2); + const posix = POSIX_REGEX_SOURCE$1[rest]; + + if (posix) { + prev.value = pre + posix; + state.backtrack = true; + advance(); + + if (!bos.output && tokens.indexOf(prev) === 1) { + bos.output = ONE_CHAR; + } + + continue; + } + } + } + } + + if (value === '[' && peek() !== ':' || value === '-' && peek() === ']') { + value = `\\${value}`; + } + + if (value === ']' && (prev.value === '[' || prev.value === '[^')) { + value = `\\${value}`; + } + + if (opts.posix === true && value === '!' && prev.value === '[') { + value = '^'; + } + + prev.value += value; + append({ + value + }); + continue; + } + /** + * If we're inside a quoted string, continue + * until we reach the closing double quote. + */ + + + if (state.quotes === 1 && value !== '"') { + value = utils$3.escapeRegex(value); + prev.value += value; + append({ + value + }); + continue; + } + /** + * Double quotes + */ + + + if (value === '"') { + state.quotes = state.quotes === 1 ? 0 : 1; + + if (opts.keepQuotes === true) { + push({ + type: 'text', + value + }); + } + + continue; + } + /** + * Parentheses + */ + + + if (value === '(') { + increment('parens'); + push({ + type: 'paren', + value + }); + continue; + } + + if (value === ')') { + if (state.parens === 0 && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '(')); + } + + const extglob = extglobs[extglobs.length - 1]; + + if (extglob && state.parens === extglob.parens + 1) { + extglobClose(extglobs.pop()); + continue; + } + + push({ + type: 'paren', + value, + output: state.parens ? ')' : '\\)' + }); + decrement('parens'); + continue; + } + /** + * Square brackets + */ + + + if (value === '[') { + if (opts.nobracket === true || !remaining().includes(']')) { + if (opts.nobracket !== true && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('closing', ']')); + } + + value = `\\${value}`; + } else { + increment('brackets'); + } + + push({ + type: 'bracket', + value + }); + continue; + } + + if (value === ']') { + if (opts.nobracket === true || prev && prev.type === 'bracket' && prev.value.length === 1) { + push({ + type: 'text', + value, + output: `\\${value}` + }); + continue; + } + + if (state.brackets === 0) { + if (opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '[')); + } + + push({ + type: 'text', + value, + output: `\\${value}` + }); + continue; + } + + decrement('brackets'); + const prevValue = prev.value.slice(1); + + if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { + value = `/${value}`; + } + + prev.value += value; + append({ + value + }); // when literal brackets are explicitly disabled + // assume we should match with a regex character class + + if (opts.literalBrackets === false || utils$3.hasRegexChars(prevValue)) { + continue; + } + + const escaped = utils$3.escapeRegex(prev.value); + state.output = state.output.slice(0, -prev.value.length); // when literal brackets are explicitly enabled + // assume we should escape the brackets to match literal characters + + if (opts.literalBrackets === true) { + state.output += escaped; + prev.value = escaped; + continue; + } // when the user specifies nothing, try to match both + + + prev.value = `(${capture}${escaped}|${prev.value})`; + state.output += prev.value; + continue; + } + /** + * Braces + */ + + + if (value === '{' && opts.nobrace !== true) { + increment('braces'); + const open = { + type: 'brace', + value, + output: '(', + outputIndex: state.output.length, + tokensIndex: state.tokens.length + }; + braces.push(open); + push(open); + continue; + } + + if (value === '}') { + const brace = braces[braces.length - 1]; + + if (opts.nobrace === true || !brace) { + push({ + type: 'text', + value, + output: value + }); + continue; + } + + let output = ')'; + + if (brace.dots === true) { + const arr = tokens.slice(); + const range = []; + + for (let i = arr.length - 1; i >= 0; i--) { + tokens.pop(); + + if (arr[i].type === 'brace') { + break; + } + + if (arr[i].type !== 'dots') { + range.unshift(arr[i].value); + } + } + + output = expandRange(range, opts); + state.backtrack = true; + } + + if (brace.comma !== true && brace.dots !== true) { + const out = state.output.slice(0, brace.outputIndex); + const toks = state.tokens.slice(brace.tokensIndex); + brace.value = brace.output = '\\{'; + value = output = `\\}`; + state.output = out; + + for (const t of toks) { + state.output += t.output || t.value; + } + } + + push({ + type: 'brace', + value, + output + }); + decrement('braces'); + braces.pop(); + continue; + } + /** + * Pipes + */ + + + if (value === '|') { + if (extglobs.length > 0) { + extglobs[extglobs.length - 1].conditions++; + } + + push({ + type: 'text', + value + }); + continue; + } + /** + * Commas + */ + + + if (value === ',') { + let output = value; + const brace = braces[braces.length - 1]; + + if (brace && stack[stack.length - 1] === 'braces') { + brace.comma = true; + output = '|'; + } + + push({ + type: 'comma', + value, + output + }); + continue; + } + /** + * Slashes + */ + + + if (value === '/') { + // if the beginning of the glob is "./", advance the start + // to the current index, and don't add the "./" characters + // to the state. This greatly simplifies lookbehinds when + // checking for BOS characters like "!" and "." (not "./") + if (prev.type === 'dot' && state.index === state.start + 1) { + state.start = state.index + 1; + state.consumed = ''; + state.output = ''; + tokens.pop(); + prev = bos; // reset "prev" to the first token + + continue; + } + + push({ + type: 'slash', + value, + output: SLASH_LITERAL + }); + continue; + } + /** + * Dots + */ + + + if (value === '.') { + if (state.braces > 0 && prev.type === 'dot') { + if (prev.value === '.') prev.output = DOT_LITERAL; + const brace = braces[braces.length - 1]; + prev.type = 'dots'; + prev.output += value; + prev.value += value; + brace.dots = true; + continue; + } + + if (state.braces + state.parens === 0 && prev.type !== 'bos' && prev.type !== 'slash') { + push({ + type: 'text', + value, + output: DOT_LITERAL + }); + continue; + } + + push({ + type: 'dot', + value, + output: DOT_LITERAL + }); + continue; + } + /** + * Question marks + */ + + + if (value === '?') { + const isGroup = prev && prev.value === '('; + + if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('qmark', value); + continue; + } + + if (prev && prev.type === 'paren') { + const next = peek(); + let output = value; + + if (next === '<' && !utils$3.supportsLookbehinds()) { + throw new Error('Node.js v10 or higher is required for regex lookbehinds'); + } + + if (prev.value === '(' && !/[!=<:]/.test(next) || next === '<' && !/<([!=]|\w+>)/.test(remaining())) { + output = `\\${value}`; + } + + push({ + type: 'text', + value, + output + }); + continue; + } + + if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { + push({ + type: 'qmark', + value, + output: QMARK_NO_DOT + }); + continue; + } + + push({ + type: 'qmark', + value, + output: QMARK + }); + continue; + } + /** + * Exclamation + */ + + + if (value === '!') { + if (opts.noextglob !== true && peek() === '(') { + if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { + extglobOpen('negate', value); + continue; + } + } + + if (opts.nonegate !== true && state.index === 0) { + negate(); + continue; + } + } + /** + * Plus + */ + + + if (value === '+') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('plus', value); + continue; + } + + if (prev && prev.value === '(' || opts.regex === false) { + push({ + type: 'plus', + value, + output: PLUS_LITERAL + }); + continue; + } + + if (prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace') || state.parens > 0) { + push({ + type: 'plus', + value + }); + continue; + } + + push({ + type: 'plus', + value: PLUS_LITERAL + }); + continue; + } + /** + * Plain text + */ + + + if (value === '@') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + push({ + type: 'at', + extglob: true, + value, + output: '' + }); + continue; + } + + push({ + type: 'text', + value + }); + continue; + } + /** + * Plain text + */ + + + if (value !== '*') { + if (value === '$' || value === '^') { + value = `\\${value}`; + } + + const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); + + if (match) { + value += match[0]; + state.index += match[0].length; + } + + push({ + type: 'text', + value + }); + continue; + } + /** + * Stars + */ + + + if (prev && (prev.type === 'globstar' || prev.star === true)) { + prev.type = 'star'; + prev.star = true; + prev.value += value; + prev.output = star; + state.backtrack = true; + state.globstar = true; + consume(value); + continue; + } + + let rest = remaining(); + + if (opts.noextglob !== true && /^\([^?]/.test(rest)) { + extglobOpen('star', value); + continue; + } + + if (prev.type === 'star') { + if (opts.noglobstar === true) { + consume(value); + continue; + } + + const prior = prev.prev; + const before = prior.prev; + const isStart = prior.type === 'slash' || prior.type === 'bos'; + const afterStar = before && (before.type === 'star' || before.type === 'globstar'); + + if (opts.bash === true && (!isStart || rest[0] && rest[0] !== '/')) { + push({ + type: 'star', + value, + output: '' + }); + continue; + } + + const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); + const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); + + if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { + push({ + type: 'star', + value, + output: '' + }); + continue; + } // strip consecutive `/**/` + + + while (rest.slice(0, 3) === '/**') { + const after = input[state.index + 4]; + + if (after && after !== '/') { + break; + } + + rest = rest.slice(3); + consume('/**', 3); + } + + if (prior.type === 'bos' && eos()) { + prev.type = 'globstar'; + prev.value += value; + prev.output = globstar(opts); + state.output = prev.output; + state.globstar = true; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + prev.type = 'globstar'; + prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); + prev.value += value; + state.globstar = true; + state.output += prior.output + prev.output; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { + const end = rest[1] !== void 0 ? '|$' : ''; + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + prev.type = 'globstar'; + prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; + prev.value += value; + state.output += prior.output + prev.output; + state.globstar = true; + consume(value + advance()); + push({ + type: 'slash', + value: '/', + output: '' + }); + continue; + } + + if (prior.type === 'bos' && rest[0] === '/') { + prev.type = 'globstar'; + prev.value += value; + prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; + state.output = prev.output; + state.globstar = true; + consume(value + advance()); + push({ + type: 'slash', + value: '/', + output: '' + }); + continue; + } // remove single star from output + + + state.output = state.output.slice(0, -prev.output.length); // reset previous token to globstar + + prev.type = 'globstar'; + prev.output = globstar(opts); + prev.value += value; // reset output with globstar + + state.output += prev.output; + state.globstar = true; + consume(value); + continue; + } + + const token = { + type: 'star', + value, + output: star + }; + + if (opts.bash === true) { + token.output = '.*?'; + + if (prev.type === 'bos' || prev.type === 'slash') { + token.output = nodot + token.output; + } + + push(token); + continue; + } + + if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { + token.output = value; + push(token); + continue; + } + + if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { + if (prev.type === 'dot') { + state.output += NO_DOT_SLASH; + prev.output += NO_DOT_SLASH; + } else if (opts.dot === true) { + state.output += NO_DOTS_SLASH; + prev.output += NO_DOTS_SLASH; + } else { + state.output += nodot; + prev.output += nodot; + } + + if (peek() !== '*') { + state.output += ONE_CHAR; + prev.output += ONE_CHAR; + } + } + + push(token); + } + + while (state.brackets > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); + state.output = utils$3.escapeLast(state.output, '['); + decrement('brackets'); + } + + while (state.parens > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); + state.output = utils$3.escapeLast(state.output, '('); + decrement('parens'); + } + + while (state.braces > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); + state.output = utils$3.escapeLast(state.output, '{'); + decrement('braces'); + } + + if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { + push({ + type: 'maybe_slash', + value: '', + output: `${SLASH_LITERAL}?` + }); + } // rebuild the output if we had to backtrack at any point + + + if (state.backtrack === true) { + state.output = ''; + + for (const token of state.tokens) { + state.output += token.output != null ? token.output : token.value; + + if (token.suffix) { + state.output += token.suffix; + } + } + } + + return state; +}; +/** + * Fast paths for creating regular expressions for common glob patterns. + * This can significantly speed up processing and has very little downside + * impact when none of the fast paths match. + */ + + +parse$4.fastpaths = (input, options) => { + const opts = Object.assign({}, options); + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$3, opts.maxLength) : MAX_LENGTH$3; + const len = input.length; + + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + input = REPLACEMENTS[input] || input; + const win32 = utils$3.isWindows(options); // create constants based on platform, for windows or posix + + const { + DOT_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOTS_SLASH, + STAR, + START_ANCHOR + } = constants$3.globChars(win32); + const nodot = opts.dot ? NO_DOTS : NO_DOT; + const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; + const capture = opts.capture ? '' : '?:'; + const state = { + negated: false, + prefix: '' + }; + let star = opts.bash === true ? '.*?' : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + const globstar = opts => { + if (opts.noglobstar === true) return star; + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const create = str => { + switch (str) { + case '*': + return `${nodot}${ONE_CHAR}${star}`; + + case '.*': + return `${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*.*': + return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*/*': + return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; + + case '**': + return nodot + globstar(opts); + + case '**/*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; + + case '**/*.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '**/.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; + + default: + { + const match = /^(.*?)\.(\w+)$/.exec(str); + if (!match) return; + const source = create(match[1]); + if (!source) return; + return source + DOT_LITERAL + match[2]; + } + } + }; + + const output = utils$3.removePrefix(input, state); + let source = create(output); + + if (source && opts.strictSlashes !== true) { + source += `${SLASH_LITERAL}?`; + } + + return source; +}; + +var parse_1$1 = parse$4; + +const isObject$2 = val => val && typeof val === 'object' && !Array.isArray(val); +/** + * Creates a matcher function from one or more glob patterns. The + * returned function takes a string to match as its first argument, + * and returns true if the string is a match. The returned matcher + * function also takes a boolean as the second argument that, when true, + * returns an object with additional information. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch(glob[, options]); + * + * const isMatch = picomatch('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * ``` + * @name picomatch + * @param {String|Array} `globs` One or more glob patterns. + * @param {Object=} `options` + * @return {Function=} Returns a matcher function. + * @api public + */ + + +const picomatch = (glob, options, returnState = false) => { + if (Array.isArray(glob)) { + const fns = glob.map(input => picomatch(input, options, returnState)); + + const arrayMatcher = str => { + for (const isMatch of fns) { + const state = isMatch(str); + if (state) return state; + } + + return false; + }; + + return arrayMatcher; + } + + const isState = isObject$2(glob) && glob.tokens && glob.input; + + if (glob === '' || typeof glob !== 'string' && !isState) { + throw new TypeError('Expected pattern to be a non-empty string'); + } + + const opts = options || {}; + const posix = utils$3.isWindows(options); + const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true); + const state = regex.state; + delete regex.state; + + let isIgnored = () => false; + + if (opts.ignore) { + const ignoreOpts = Object.assign({}, options, { + ignore: null, + onMatch: null, + onResult: null + }); + isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); + } + + const matcher = (input, returnObject = false) => { + const { + isMatch, + match, + output + } = picomatch.test(input, regex, options, { + glob, + posix + }); + const result = { + glob, + state, + regex, + posix, + input, + output, + match, + isMatch + }; + + if (typeof opts.onResult === 'function') { + opts.onResult(result); + } + + if (isMatch === false) { + result.isMatch = false; + return returnObject ? result : false; + } + + if (isIgnored(input)) { + if (typeof opts.onIgnore === 'function') { + opts.onIgnore(result); + } + + result.isMatch = false; + return returnObject ? result : false; + } + + if (typeof opts.onMatch === 'function') { + opts.onMatch(result); + } + + return returnObject ? result : true; + }; + + if (returnState) { + matcher.state = state; + } + + return matcher; +}; +/** + * Test `input` with the given `regex`. This is used by the main + * `picomatch()` function to test the input string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.test(input, regex[, options]); + * + * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); + * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } + * ``` + * @param {String} `input` String to test. + * @param {RegExp} `regex` + * @return {Object} Returns an object with matching info. + * @api public + */ + + +picomatch.test = (input, regex, options, { + glob, + posix +} = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected input to be a string'); + } + + if (input === '') { + return { + isMatch: false, + output: '' + }; + } + + const opts = options || {}; + const format = opts.format || (posix ? utils$3.toPosixSlashes : null); + let match = input === glob; + let output = match && format ? format(input) : input; + + if (match === false) { + output = format ? format(input) : input; + match = output === glob; + } + + if (match === false || opts.capture === true) { + if (opts.matchBase === true || opts.basename === true) { + match = picomatch.matchBase(input, regex, options, posix); + } else { + match = regex.exec(output); + } + } + + return { + isMatch: Boolean(match), + match, + output + }; +}; +/** + * Match the basename of a filepath. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.matchBase(input, glob[, options]); + * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true + * ``` + * @param {String} `input` String to test. + * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). + * @return {Boolean} + * @api public + */ + + +picomatch.matchBase = (input, glob, options, posix = utils$3.isWindows(options)) => { + const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); + return regex.test(path$2.basename(input)); +}; +/** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.isMatch(string, patterns[, options]); + * + * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false + * ``` + * @param {String|Array} str The string to test. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} [options] See available [options](#options). + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + + +picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); +/** + * Parse a glob pattern to create the source string for a regular + * expression. + * + * ```js + * const picomatch = require('picomatch'); + * const result = picomatch.parse(pattern[, options]); + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} Returns an object with useful properties and output to be used as a regex source string. + * @api public + */ + + +picomatch.parse = (pattern, options) => { + if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); + return parse_1$1(pattern, Object.assign({}, options, { + fastpaths: false + })); +}; +/** + * Scan a glob pattern to separate the pattern into segments. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.scan(input[, options]); + * + * const result = picomatch.scan('!./foo/*.js'); + * console.log(result); + * { prefix: '!./', + * input: '!./foo/*.js', + * start: 3, + * base: 'foo', + * glob: '*.js', + * isBrace: false, + * isBracket: false, + * isGlob: true, + * isExtglob: false, + * isGlobstar: false, + * negated: true } + * ``` + * @param {String} `input` Glob pattern to scan. + * @param {Object} `options` + * @return {Object} Returns an object with + * @api public + */ + + +picomatch.scan = (input, options) => scan_1(input, options); +/** + * Create a regular expression from a glob pattern. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.makeRe(input[, options]); + * + * console.log(picomatch.makeRe('*.js')); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `input` A glob pattern to convert to regex. + * @param {Object} `options` + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + + +picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => { + if (returnOutput === true) { + return parsed.output; + } + + const opts = options || {}; + const prepend = opts.contains ? '' : '^'; + const append = opts.contains ? '' : '$'; + let source = `${prepend}(?:${parsed.output})${append}`; + + if (parsed && parsed.negated === true) { + source = `^(?!${source}).*$`; + } + + const regex = picomatch.toRegex(source, options); + + if (returnState === true) { + regex.state = parsed; + } + + return regex; +}; + +picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => { + if (!input || typeof input !== 'string') { + throw new TypeError('Expected a non-empty string'); + } + + const opts = options || {}; + let parsed = { + negated: false, + fastpaths: true + }; + let prefix = ''; + let output; + + if (input.startsWith('./')) { + input = input.slice(2); + prefix = parsed.prefix = './'; + } + + if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { + output = parse_1$1.fastpaths(input, options); + } + + if (output === undefined) { + parsed = parse_1$1(input, options); + parsed.prefix = prefix + (parsed.prefix || ''); + } else { + parsed.output = output; + } + + return picomatch.compileRe(parsed, options, returnOutput, returnState); +}; +/** + * Create a regular expression from the given regex source string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.toRegex(source[, options]); + * + * const { output } = picomatch.parse('*.js'); + * console.log(picomatch.toRegex(output)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `source` Regular expression source string. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + + +picomatch.toRegex = (source, options) => { + try { + const opts = options || {}; + return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); + } catch (err) { + if (options && options.debug === true) throw err; + return /$^/; + } +}; +/** + * Picomatch constants. + * @return {Object} + */ + + +picomatch.constants = constants$3; +/** + * Expose "picomatch" + */ + +var picomatch_1 = picomatch; + +var picomatch$1 = picomatch_1; + +const isEmptyString = val => typeof val === 'string' && (val === '' || val === './'); +/** + * Returns an array of strings that match one or more glob patterns. + * + * ```js + * const mm = require('micromatch'); + * // mm(list, patterns[, options]); + * + * console.log(mm(['a.js', 'a.txt'], ['*.js'])); + * //=> [ 'a.js' ] + * ``` + * @param {String|Array} list List of strings to match. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} options See available [options](#options) + * @return {Array} Returns an array of matches + * @summary false + * @api public + */ + + +const micromatch = (list, patterns, options) => { + patterns = [].concat(patterns); + list = [].concat(list); + let omit = new Set(); + let keep = new Set(); + let items = new Set(); + let negatives = 0; + + let onResult = state => { + items.add(state.output); + + if (options && options.onResult) { + options.onResult(state); + } + }; + + for (let i = 0; i < patterns.length; i++) { + let isMatch = picomatch$1(String(patterns[i]), Object.assign({}, options, { + onResult + }), true); + let negated = isMatch.state.negated || isMatch.state.negatedExtglob; + if (negated) negatives++; + + for (let item of list) { + let matched = isMatch(item, true); + let match = negated ? !matched.isMatch : matched.isMatch; + if (!match) continue; + + if (negated) { + omit.add(matched.output); + } else { + omit.delete(matched.output); + keep.add(matched.output); + } + } + } + + let result = negatives === patterns.length ? [...items] : [...keep]; + let matches = result.filter(item => !omit.has(item)); + + if (options && matches.length === 0) { + if (options.failglob === true) { + throw new Error(`No matches found for "${patterns.join(', ')}"`); + } + + if (options.nonull === true || options.nullglob === true) { + return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns; + } + } + + return matches; +}; +/** + * Backwards compatibility + */ + + +micromatch.match = micromatch; +/** + * Returns a matcher function from the given glob `pattern` and `options`. + * The returned function takes a string to match as its only argument and returns + * true if the string is a match. + * + * ```js + * const mm = require('micromatch'); + * // mm.matcher(pattern[, options]); + * + * const isMatch = mm.matcher('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * ``` + * @param {String} `pattern` Glob pattern + * @param {Object} `options` + * @return {Function} Returns a matcher function. + * @api public + */ + +micromatch.matcher = (pattern, options) => picomatch$1(pattern, options); +/** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * ```js + * const mm = require('micromatch'); + * // mm.isMatch(string, patterns[, options]); + * + * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(mm.isMatch('a.a', 'b.*')); //=> false + * ``` + * @param {String} str The string to test. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} [options] See available [options](#options). + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + + +micromatch.isMatch = (str, patterns, options) => picomatch$1(patterns, options)(str); +/** + * Backwards compatibility + */ + + +micromatch.any = micromatch.isMatch; +/** + * Returns a list of strings that _**do not match any**_ of the given `patterns`. + * + * ```js + * const mm = require('micromatch'); + * // mm.not(list, patterns[, options]); + * + * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); + * //=> ['b.b', 'c.c'] + * ``` + * @param {Array} `list` Array of strings to match. + * @param {String|Array} `patterns` One or more glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of strings that **do not match** the given patterns. + * @api public + */ + +micromatch.not = (list, patterns, options = {}) => { + patterns = [].concat(patterns).map(String); + let result = new Set(); + let items = []; + + let onResult = state => { + if (options.onResult) options.onResult(state); + items.push(state.output); + }; + + let matches = micromatch(list, patterns, Object.assign({}, options, { + onResult + })); + + for (let item of items) { + if (!matches.includes(item)) { + result.add(item); + } + } + + return [...result]; +}; +/** + * Returns true if the given `string` contains the given pattern. Similar + * to [.isMatch](#isMatch) but the pattern can match any part of the string. + * + * ```js + * var mm = require('micromatch'); + * // mm.contains(string, pattern[, options]); + * + * console.log(mm.contains('aa/bb/cc', '*b')); + * //=> true + * console.log(mm.contains('aa/bb/cc', '*d')); + * //=> false + * ``` + * @param {String} `str` The string to match. + * @param {String|Array} `patterns` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if the patter matches any part of `str`. + * @api public + */ + + +micromatch.contains = (str, pattern, options) => { + if (typeof str !== 'string') { + throw new TypeError(`Expected a string: "${util$4.inspect(str)}"`); + } + + if (Array.isArray(pattern)) { + return pattern.some(p => micromatch.contains(str, p, options)); + } + + if (typeof pattern === 'string') { + if (isEmptyString(str) || isEmptyString(pattern)) { + return false; + } + + if (str.includes(pattern) || str.startsWith('./') && str.slice(2).includes(pattern)) { + return true; + } + } + + return micromatch.isMatch(str, pattern, Object.assign({}, options, { + contains: true + })); +}; +/** + * Filter the keys of the given object with the given `glob` pattern + * and `options`. Does not attempt to match nested keys. If you need this feature, + * use [glob-object][] instead. + * + * ```js + * const mm = require('micromatch'); + * // mm.matchKeys(object, patterns[, options]); + * + * const obj = { aa: 'a', ab: 'b', ac: 'c' }; + * console.log(mm.matchKeys(obj, '*b')); + * //=> { ab: 'b' } + * ``` + * @param {Object} `object` The object with keys to filter. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Object} Returns an object with only keys that match the given patterns. + * @api public + */ + + +micromatch.matchKeys = (obj, patterns, options) => { + if (!utils$3.isObject(obj)) { + throw new TypeError('Expected the first argument to be an object'); + } + + let keys = micromatch(Object.keys(obj), patterns, options); + let res = {}; + + for (let key of keys) res[key] = obj[key]; + + return res; +}; +/** + * Returns true if some of the strings in the given `list` match any of the given glob `patterns`. + * + * ```js + * const mm = require('micromatch'); + * // mm.some(list, patterns[, options]); + * + * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // true + * console.log(mm.some(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + + +micromatch.some = (list, patterns, options) => { + let items = [].concat(list); + + for (let pattern of [].concat(patterns)) { + let isMatch = picomatch$1(String(pattern), options); + + if (items.some(item => isMatch(item))) { + return true; + } + } + + return false; +}; +/** + * Returns true if every string in the given `list` matches + * any of the given glob `patterns`. + * + * ```js + * const mm = require('micromatch'); + * // mm.every(list, patterns[, options]); + * + * console.log(mm.every('foo.js', ['foo.js'])); + * // true + * console.log(mm.every(['foo.js', 'bar.js'], ['*.js'])); + * // true + * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // false + * console.log(mm.every(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + + +micromatch.every = (list, patterns, options) => { + let items = [].concat(list); + + for (let pattern of [].concat(patterns)) { + let isMatch = picomatch$1(String(pattern), options); + + if (!items.every(item => isMatch(item))) { + return false; + } + } + + return true; +}; +/** + * Returns true if **all** of the given `patterns` match + * the specified string. + * + * ```js + * const mm = require('micromatch'); + * // mm.all(string, patterns[, options]); + * + * console.log(mm.all('foo.js', ['foo.js'])); + * // true + * + * console.log(mm.all('foo.js', ['*.js', '!foo.js'])); + * // false + * + * console.log(mm.all('foo.js', ['*.js', 'foo.js'])); + * // true + * + * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); + * // true + * ``` + * @param {String|Array} `str` The string to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + + +micromatch.all = (str, patterns, options) => { + if (typeof str !== 'string') { + throw new TypeError(`Expected a string: "${util$4.inspect(str)}"`); + } + + return [].concat(patterns).every(p => picomatch$1(p, options)(str)); +}; +/** + * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match. + * + * ```js + * const mm = require('micromatch'); + * // mm.capture(pattern, string[, options]); + * + * console.log(mm.capture('test/*.js', 'test/foo.js')); + * //=> ['foo'] + * console.log(mm.capture('test/*.js', 'foo/bar.css')); + * //=> null + * ``` + * @param {String} `glob` Glob pattern to use for matching. + * @param {String} `input` String to match + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns an array of captures if the input matches the glob pattern, otherwise `null`. + * @api public + */ + + +micromatch.capture = (glob, input, options) => { + let posix = utils$3.isWindows(options); + let regex = picomatch$1.makeRe(String(glob), Object.assign({}, options, { + capture: true + })); + let match = regex.exec(posix ? utils$3.toPosixSlashes(input) : input); + + if (match) { + return match.slice(1).map(v => v === void 0 ? '' : v); + } +}; +/** + * Create a regular expression from the given glob `pattern`. + * + * ```js + * const mm = require('micromatch'); + * // mm.makeRe(pattern[, options]); + * + * console.log(mm.makeRe('*.js')); + * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ + * ``` + * @param {String} `pattern` A glob pattern to convert to regex. + * @param {Object} `options` + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + + +micromatch.makeRe = (...args) => picomatch$1.makeRe(...args); +/** + * Scan a glob pattern to separate the pattern into segments. Used + * by the [split](#split) method. + * + * ```js + * const mm = require('micromatch'); + * const state = mm.scan(pattern[, options]); + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} Returns an object with + * @api public + */ + + +micromatch.scan = (...args) => picomatch$1.scan(...args); +/** + * Parse a glob pattern to create the source string for a regular + * expression. + * + * ```js + * const mm = require('micromatch'); + * const state = mm(pattern[, options]); + * ``` + * @param {String} `glob` + * @param {Object} `options` + * @return {Object} Returns an object with useful properties and output to be used as regex source string. + * @api public + */ + + +micromatch.parse = (patterns, options) => { + let res = []; + + for (let pattern of [].concat(patterns || [])) { + for (let str of braces_1(String(pattern), options)) { + res.push(picomatch$1.parse(str, options)); + } + } + + return res; +}; +/** + * Process the given brace `pattern`. + * + * ```js + * const { braces } = require('micromatch'); + * console.log(braces('foo/{a,b,c}/bar')); + * //=> [ 'foo/(a|b|c)/bar' ] + * + * console.log(braces('foo/{a,b,c}/bar', { expand: true })); + * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ] + * ``` + * @param {String} `pattern` String with brace pattern to process. + * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options. + * @return {Array} + * @api public + */ + + +micromatch.braces = (pattern, options) => { + if (typeof pattern !== 'string') throw new TypeError('Expected a string'); + + if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) { + return [pattern]; + } + + return braces_1(pattern, options); +}; +/** + * Expand braces + */ + + +micromatch.braceExpand = (pattern, options) => { + if (typeof pattern !== 'string') throw new TypeError('Expected a string'); + return micromatch.braces(pattern, Object.assign({}, options, { + expand: true + })); +}; +/** + * Expose micromatch + */ + + +var micromatch_1 = micromatch; + +var pattern = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + const GLOBSTAR = '**'; + const ESCAPE_SYMBOL = '\\'; + const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; + const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/; + const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\(.*\|.*\)/; + const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/; + const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/; + + function isStaticPattern(pattern, options = {}) { + return !isDynamicPattern(pattern, options); + } + + exports.isStaticPattern = isStaticPattern; + + function isDynamicPattern(pattern, options = {}) { + /** + * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check + * filepath directly (without read directory). + */ + if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) { + return true; + } + + if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) { + return true; + } + + if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) { + return true; + } + + if (options.braceExpansion !== false && BRACE_EXPANSIONS_SYMBOLS_RE.test(pattern)) { + return true; + } + + return false; + } + + exports.isDynamicPattern = isDynamicPattern; + + function convertToPositivePattern(pattern) { + return isNegativePattern(pattern) ? pattern.slice(1) : pattern; + } + + exports.convertToPositivePattern = convertToPositivePattern; + + function convertToNegativePattern(pattern) { + return '!' + pattern; + } + + exports.convertToNegativePattern = convertToNegativePattern; + + function isNegativePattern(pattern) { + return pattern.startsWith('!') && pattern[1] !== '('; + } + + exports.isNegativePattern = isNegativePattern; + + function isPositivePattern(pattern) { + return !isNegativePattern(pattern); + } + + exports.isPositivePattern = isPositivePattern; + + function getNegativePatterns(patterns) { + return patterns.filter(isNegativePattern); + } + + exports.getNegativePatterns = getNegativePatterns; + + function getPositivePatterns(patterns) { + return patterns.filter(isPositivePattern); + } + + exports.getPositivePatterns = getPositivePatterns; + + function getBaseDirectory(pattern) { + return globParent(pattern, { + flipBackslashes: false + }); + } + + exports.getBaseDirectory = getBaseDirectory; + + function hasGlobStar(pattern) { + return pattern.includes(GLOBSTAR); + } + + exports.hasGlobStar = hasGlobStar; + + function endsWithSlashGlobStar(pattern) { + return pattern.endsWith('/' + GLOBSTAR); + } + + exports.endsWithSlashGlobStar = endsWithSlashGlobStar; + + function isAffectDepthOfReadingPattern(pattern) { + const basename = path$2.basename(pattern); + return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); + } + + exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; + + function expandPatternsWithBraceExpansion(patterns) { + return patterns.reduce((collection, pattern) => { + return collection.concat(expandBraceExpansion(pattern)); + }, []); + } + + exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion; + + function expandBraceExpansion(pattern) { + return micromatch_1.braces(pattern, { + expand: true, + nodupes: true + }); + } + + exports.expandBraceExpansion = expandBraceExpansion; + + function getPatternParts(pattern, options) { + const info = picomatch$1.scan(pattern, Object.assign(Object.assign({}, options), { + parts: true + })); // See micromatch/picomatch#58 for more details + + if (info.parts.length === 0) { + return [pattern]; + } + + return info.parts; + } + + exports.getPatternParts = getPatternParts; + + function makeRe(pattern, options) { + return micromatch_1.makeRe(pattern, options); + } + + exports.makeRe = makeRe; + + function convertPatternsToRe(patterns, options) { + return patterns.map(pattern => makeRe(pattern, options)); + } + + exports.convertPatternsToRe = convertPatternsToRe; + + function matchAny(entry, patternsRe) { + return patternsRe.some(patternRe => patternRe.test(entry)); + } + + exports.matchAny = matchAny; +}); +unwrapExports(pattern); +var pattern_1 = pattern.isStaticPattern; +var pattern_2 = pattern.isDynamicPattern; +var pattern_3 = pattern.convertToPositivePattern; +var pattern_4 = pattern.convertToNegativePattern; +var pattern_5 = pattern.isNegativePattern; +var pattern_6 = pattern.isPositivePattern; +var pattern_7 = pattern.getNegativePatterns; +var pattern_8 = pattern.getPositivePatterns; +var pattern_9 = pattern.getBaseDirectory; +var pattern_10 = pattern.hasGlobStar; +var pattern_11 = pattern.endsWithSlashGlobStar; +var pattern_12 = pattern.isAffectDepthOfReadingPattern; +var pattern_13 = pattern.expandPatternsWithBraceExpansion; +var pattern_14 = pattern.expandBraceExpansion; +var pattern_15 = pattern.getPatternParts; +var pattern_16 = pattern.makeRe; +var pattern_17 = pattern.convertPatternsToRe; +var pattern_18 = pattern.matchAny; + +var stream$1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function merge(streams) { + const mergedStream = merge2_1(streams); + streams.forEach(stream => { + stream.once('error', error => mergedStream.emit('error', error)); + }); + mergedStream.once('close', () => propagateCloseEventToSources(streams)); + mergedStream.once('end', () => propagateCloseEventToSources(streams)); + return mergedStream; + } + + exports.merge = merge; + + function propagateCloseEventToSources(streams) { + streams.forEach(stream => stream.emit('close')); + } +}); +unwrapExports(stream$1); +var stream_1 = stream$1.merge; + +var string$1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function isString(input) { + return typeof input === 'string'; + } + + exports.isString = isString; + + function isEmpty(input) { + return input === ''; + } + + exports.isEmpty = isEmpty; +}); +unwrapExports(string$1); +var string_1$1 = string$1.isString; +var string_2 = string$1.isEmpty; + +var utils$4 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.array = array$2; + exports.errno = errno; + exports.fs = fs$1; + exports.path = path_1; + exports.pattern = pattern; + exports.stream = stream$1; + exports.string = string$1; +}); +unwrapExports(utils$4); +var utils_1$4 = utils$4.array; +var utils_2$4 = utils$4.errno; +var utils_3$4 = utils$4.fs; +var utils_4$3 = utils$4.path; +var utils_5$3 = utils$4.pattern; +var utils_6$3 = utils$4.stream; +var utils_7$3 = utils$4.string; + +var tasks = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function generate(patterns, settings) { + const positivePatterns = getPositivePatterns(patterns); + const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore); + const staticPatterns = positivePatterns.filter(pattern => utils$4.pattern.isStaticPattern(pattern, settings)); + const dynamicPatterns = positivePatterns.filter(pattern => utils$4.pattern.isDynamicPattern(pattern, settings)); + const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, + /* dynamic */ + false); + const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, + /* dynamic */ + true); + return staticTasks.concat(dynamicTasks); + } + + exports.generate = generate; + + function convertPatternsToTasks(positive, negative, dynamic) { + const positivePatternsGroup = groupPatternsByBaseDirectory(positive); // When we have a global group – there is no reason to divide the patterns into independent tasks. + // In this case, the global task covers the rest. + + if ('.' in positivePatternsGroup) { + const task = convertPatternGroupToTask('.', positive, negative, dynamic); + return [task]; + } + + return convertPatternGroupsToTasks(positivePatternsGroup, negative, dynamic); + } + + exports.convertPatternsToTasks = convertPatternsToTasks; + + function getPositivePatterns(patterns) { + return utils$4.pattern.getPositivePatterns(patterns); + } + + exports.getPositivePatterns = getPositivePatterns; + + function getNegativePatternsAsPositive(patterns, ignore) { + const negative = utils$4.pattern.getNegativePatterns(patterns).concat(ignore); + const positive = negative.map(utils$4.pattern.convertToPositivePattern); + return positive; + } + + exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; + + function groupPatternsByBaseDirectory(patterns) { + const group = {}; + return patterns.reduce((collection, pattern) => { + const base = utils$4.pattern.getBaseDirectory(pattern); + + if (base in collection) { + collection[base].push(pattern); + } else { + collection[base] = [pattern]; + } + + return collection; + }, group); + } + + exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; + + function convertPatternGroupsToTasks(positive, negative, dynamic) { + return Object.keys(positive).map(base => { + return convertPatternGroupToTask(base, positive[base], negative, dynamic); + }); + } + + exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; + + function convertPatternGroupToTask(base, positive, negative, dynamic) { + return { + dynamic, + positive, + negative, + base, + patterns: [].concat(positive, negative.map(utils$4.pattern.convertToNegativePattern)) + }; + } + + exports.convertPatternGroupToTask = convertPatternGroupToTask; +}); +unwrapExports(tasks); +var tasks_1 = tasks.generate; +var tasks_2 = tasks.convertPatternsToTasks; +var tasks_3 = tasks.getPositivePatterns; +var tasks_4 = tasks.getNegativePatternsAsPositive; +var tasks_5 = tasks.groupPatternsByBaseDirectory; +var tasks_6 = tasks.convertPatternGroupsToTasks; +var tasks_7 = tasks.convertPatternGroupToTask; + +var async$1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function read(path, settings, callback) { + settings.fs.lstat(path, (lstatError, lstat) => { + if (lstatError !== null) { + return callFailureCallback(callback, lstatError); + } + + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + return callSuccessCallback(callback, lstat); + } + + settings.fs.stat(path, (statError, stat) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + return callFailureCallback(callback, statError); + } + + return callSuccessCallback(callback, lstat); + } + + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + + callSuccessCallback(callback, stat); + }); + }); + } + + exports.read = read; + + function callFailureCallback(callback, error) { + callback(error); + } + + function callSuccessCallback(callback, result) { + callback(null, result); + } +}); +unwrapExports(async$1); +var async_1 = async$1.read; + +var sync$1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function read(path, settings) { + const lstat = settings.fs.lstatSync(path); + + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + return lstat; + } + + try { + const stat = settings.fs.statSync(path); + + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + + return stat; + } catch (error) { + if (!settings.throwErrorOnBrokenSymbolicLink) { + return lstat; + } + + throw error; + } + } + + exports.read = read; +}); +unwrapExports(sync$1); +var sync_1 = sync$1.read; + +var fs_1$1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.FILE_SYSTEM_ADAPTER = { + lstat: fs$3.lstat, + stat: fs$3.stat, + lstatSync: fs$3.lstatSync, + statSync: fs$3.statSync + }; + + function createFileSystemAdapter(fsMethods) { + if (fsMethods === undefined) { + return exports.FILE_SYSTEM_ADAPTER; + } + + return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); + } + + exports.createFileSystemAdapter = createFileSystemAdapter; +}); +unwrapExports(fs_1$1); +var fs_2 = fs_1$1.FILE_SYSTEM_ADAPTER; +var fs_3 = fs_1$1.createFileSystemAdapter; + +var settings = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class Settings { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true); + this.fs = fs_1$1.createFileSystemAdapter(this._options.fs); + this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + } + + _getValue(option, value) { + return option === undefined ? value : option; + } + + } + + exports.default = Settings; +}); +unwrapExports(settings); + +var out = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Settings = settings.default; + + function stat(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + return async$1.read(path, getSettings(), optionsOrSettingsOrCallback); + } + + async$1.read(path, getSettings(optionsOrSettingsOrCallback), callback); + } + + exports.stat = stat; + + function statSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync$1.read(path, settings); + } + + exports.statSync = statSync; + + function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings.default) { + return settingsOrOptions; + } + + return new settings.default(settingsOrOptions); + } +}); +unwrapExports(out); +var out_1 = out.Settings; +var out_2 = out.stat; +var out_3 = out.statSync; + +var runParallel_1 = runParallel; + +function runParallel(tasks, cb) { + var results, pending, keys; + var isSync = true; + + if (Array.isArray(tasks)) { + results = []; + pending = tasks.length; + } else { + keys = Object.keys(tasks); + results = {}; + pending = keys.length; + } + + function done(err) { + function end() { + if (cb) cb(err, results); + cb = null; + } + + if (isSync) process.nextTick(end);else end(); + } + + function each(i, err, result) { + results[i] = result; + + if (--pending === 0 || err) { + done(err); + } + } + + if (!pending) { + // empty + done(null); + } else if (keys) { + // object + keys.forEach(function (key) { + tasks[key](function (err, result) { + each(key, err, result); + }); + }); + } else { + // array + tasks.forEach(function (task, i) { + task(function (err, result) { + each(i, err, result); + }); + }); + } + + isSync = false; +} + +var constants$4 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); + const MAJOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); + const MINOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); + const SUPPORTED_MAJOR_VERSION = 10; + const SUPPORTED_MINOR_VERSION = 10; + const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; + const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; + /** + * IS `true` for Node.js 10.10 and greater. + */ + + exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; +}); +unwrapExports(constants$4); +var constants_1 = constants$4.IS_SUPPORT_READDIR_WITH_FILE_TYPES; + +var fs$2 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } + + } + + function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); + } + + exports.createDirentFromStats = createDirentFromStats; +}); +unwrapExports(fs$2); +var fs_1$2 = fs$2.createDirentFromStats; + +var utils$5 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.fs = fs$2; +}); +unwrapExports(utils$5); +var utils_1$5 = utils$5.fs; + +var async$2 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function read(directory, settings, callback) { + if (!settings.stats && constants$4.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + return readdirWithFileTypes(directory, settings, callback); + } + + return readdir(directory, settings, callback); + } + + exports.read = read; + + function readdirWithFileTypes(directory, settings, callback) { + settings.fs.readdir(directory, { + withFileTypes: true + }, (readdirError, dirents) => { + if (readdirError !== null) { + return callFailureCallback(callback, readdirError); + } + + const entries = dirents.map(dirent => ({ + dirent, + name: dirent.name, + path: `${directory}${settings.pathSegmentSeparator}${dirent.name}` + })); + + if (!settings.followSymbolicLinks) { + return callSuccessCallback(callback, entries); + } + + const tasks = entries.map(entry => makeRplTaskEntry(entry, settings)); + runParallel_1(tasks, (rplError, rplEntries) => { + if (rplError !== null) { + return callFailureCallback(callback, rplError); + } + + callSuccessCallback(callback, rplEntries); + }); + }); + } + + exports.readdirWithFileTypes = readdirWithFileTypes; + + function makeRplTaskEntry(entry, settings) { + return done => { + if (!entry.dirent.isSymbolicLink()) { + return done(null, entry); + } + + settings.fs.stat(entry.path, (statError, stats) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + return done(statError); + } + + return done(null, entry); + } + + entry.dirent = utils$5.fs.createDirentFromStats(entry.name, stats); + return done(null, entry); + }); + }; + } + + function readdir(directory, settings, callback) { + settings.fs.readdir(directory, (readdirError, names) => { + if (readdirError !== null) { + return callFailureCallback(callback, readdirError); + } + + const filepaths = names.map(name => `${directory}${settings.pathSegmentSeparator}${name}`); + const tasks = filepaths.map(filepath => { + return done => out.stat(filepath, settings.fsStatSettings, done); + }); + runParallel_1(tasks, (rplError, results) => { + if (rplError !== null) { + return callFailureCallback(callback, rplError); + } + + const entries = []; + names.forEach((name, index) => { + const stats = results[index]; + const entry = { + name, + path: filepaths[index], + dirent: utils$5.fs.createDirentFromStats(name, stats) + }; + + if (settings.stats) { + entry.stats = stats; + } + + entries.push(entry); + }); + callSuccessCallback(callback, entries); + }); + }); + } + + exports.readdir = readdir; + + function callFailureCallback(callback, error) { + callback(error); + } + + function callSuccessCallback(callback, result) { + callback(null, result); + } +}); +unwrapExports(async$2); +var async_1$1 = async$2.read; +var async_2 = async$2.readdirWithFileTypes; +var async_3 = async$2.readdir; + +var sync$2 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function read(directory, settings) { + if (!settings.stats && constants$4.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + return readdirWithFileTypes(directory, settings); + } + + return readdir(directory, settings); + } + + exports.read = read; + + function readdirWithFileTypes(directory, settings) { + const dirents = settings.fs.readdirSync(directory, { + withFileTypes: true + }); + return dirents.map(dirent => { + const entry = { + dirent, + name: dirent.name, + path: `${directory}${settings.pathSegmentSeparator}${dirent.name}` + }; + + if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { + try { + const stats = settings.fs.statSync(entry.path); + entry.dirent = utils$5.fs.createDirentFromStats(entry.name, stats); + } catch (error) { + if (settings.throwErrorOnBrokenSymbolicLink) { + throw error; + } + } + } + + return entry; + }); + } + + exports.readdirWithFileTypes = readdirWithFileTypes; + + function readdir(directory, settings) { + const names = settings.fs.readdirSync(directory); + return names.map(name => { + const entryPath = `${directory}${settings.pathSegmentSeparator}${name}`; + const stats = out.statSync(entryPath, settings.fsStatSettings); + const entry = { + name, + path: entryPath, + dirent: utils$5.fs.createDirentFromStats(name, stats) + }; + + if (settings.stats) { + entry.stats = stats; + } + + return entry; + }); + } + + exports.readdir = readdir; +}); +unwrapExports(sync$2); +var sync_1$1 = sync$2.read; +var sync_2 = sync$2.readdirWithFileTypes; +var sync_3 = sync$2.readdir; + +var fs_1$3 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.FILE_SYSTEM_ADAPTER = { + lstat: fs$3.lstat, + stat: fs$3.stat, + lstatSync: fs$3.lstatSync, + statSync: fs$3.statSync, + readdir: fs$3.readdir, + readdirSync: fs$3.readdirSync + }; + + function createFileSystemAdapter(fsMethods) { + if (fsMethods === undefined) { + return exports.FILE_SYSTEM_ADAPTER; + } + + return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); + } + + exports.createFileSystemAdapter = createFileSystemAdapter; +}); +unwrapExports(fs_1$3); +var fs_2$1 = fs_1$3.FILE_SYSTEM_ADAPTER; +var fs_3$1 = fs_1$3.createFileSystemAdapter; + +var settings$1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class Settings { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); + this.fs = fs_1$3.createFileSystemAdapter(this._options.fs); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$2.sep); + this.stats = this._getValue(this._options.stats, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + this.fsStatSettings = new out.Settings({ + followSymbolicLink: this.followSymbolicLinks, + fs: this.fs, + throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink + }); + } + + _getValue(option, value) { + return option === undefined ? value : option; + } + + } + + exports.default = Settings; +}); +unwrapExports(settings$1); + +var out$1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Settings = settings$1.default; + + function scandir(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + return async$2.read(path, getSettings(), optionsOrSettingsOrCallback); + } + + async$2.read(path, getSettings(optionsOrSettingsOrCallback), callback); + } + + exports.scandir = scandir; + + function scandirSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync$2.read(path, settings); + } + + exports.scandirSync = scandirSync; + + function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings$1.default) { + return settingsOrOptions; + } + + return new settings$1.default(settingsOrOptions); + } +}); +unwrapExports(out$1); +var out_1$1 = out$1.Settings; +var out_2$1 = out$1.scandir; +var out_3$1 = out$1.scandirSync; + +function reusify(Constructor) { + var head = new Constructor(); + var tail = head; + + function get() { + var current = head; + + if (current.next) { + head = current.next; + } else { + head = new Constructor(); + tail = head; + } + + current.next = null; + return current; + } + + function release(obj) { + tail.next = obj; + tail = obj; + } + + return { + get: get, + release: release + }; +} + +var reusify_1 = reusify; + +function fastqueue(context, worker, concurrency) { + if (typeof context === 'function') { + concurrency = worker; + worker = context; + context = null; + } + + var cache = reusify_1(Task); + var queueHead = null; + var queueTail = null; + var _running = 0; + var self = { + push: push, + drain: noop$1, + saturated: noop$1, + pause: pause, + paused: false, + concurrency: concurrency, + running: running, + resume: resume, + idle: idle, + length: length, + unshift: unshift, + empty: noop$1, + kill: kill, + killAndDrain: killAndDrain + }; + return self; + + function running() { + return _running; + } + + function pause() { + self.paused = true; + } + + function length() { + var current = queueHead; + var counter = 0; + + while (current) { + current = current.next; + counter++; + } + + return counter; + } + + function resume() { + if (!self.paused) return; + self.paused = false; + + for (var i = 0; i < self.concurrency; i++) { + _running++; + release(); + } + } + + function idle() { + return _running === 0 && self.length() === 0; + } + + function push(value, done) { + var current = cache.get(); + current.context = context; + current.release = release; + current.value = value; + current.callback = done || noop$1; + + if (_running === self.concurrency || self.paused) { + if (queueTail) { + queueTail.next = current; + queueTail = current; + } else { + queueHead = current; + queueTail = current; + self.saturated(); + } + } else { + _running++; + worker.call(context, current.value, current.worked); + } + } + + function unshift(value, done) { + var current = cache.get(); + current.context = context; + current.release = release; + current.value = value; + current.callback = done || noop$1; + + if (_running === self.concurrency || self.paused) { + if (queueHead) { + current.next = queueHead; + queueHead = current; + } else { + queueHead = current; + queueTail = current; + self.saturated(); + } + } else { + _running++; + worker.call(context, current.value, current.worked); + } + } + + function release(holder) { + if (holder) { + cache.release(holder); + } + + var next = queueHead; + + if (next) { + if (!self.paused) { + if (queueTail === queueHead) { + queueTail = null; + } + + queueHead = next.next; + next.next = null; + worker.call(context, next.value, next.worked); + + if (queueTail === null) { + self.empty(); + } + } else { + _running--; + } + } else if (--_running === 0) { + self.drain(); + } + } + + function kill() { + queueHead = null; + queueTail = null; + self.drain = noop$1; + } + + function killAndDrain() { + queueHead = null; + queueTail = null; + self.drain(); + self.drain = noop$1; + } +} + +function noop$1() {} + +function Task() { + this.value = null; + this.callback = noop$1; + this.next = null; + this.release = noop$1; + this.context = null; + var self = this; + + this.worked = function worked(err, result) { + var callback = self.callback; + self.value = null; + self.callback = noop$1; + callback.call(self.context, err, result); + self.release(self); + }; +} + +var queue = fastqueue; + +var common$2 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function isFatalError(settings, error) { + if (settings.errorFilter === null) { + return true; + } + + return !settings.errorFilter(error); + } + + exports.isFatalError = isFatalError; + + function isAppliedFilter(filter, value) { + return filter === null || filter(value); + } + + exports.isAppliedFilter = isAppliedFilter; + + function replacePathSegmentSeparator(filepath, separator) { + return filepath.split(/[\\/]/).join(separator); + } + + exports.replacePathSegmentSeparator = replacePathSegmentSeparator; + + function joinPathSegments(a, b, separator) { + if (a === '') { + return b; + } + + return a + separator + b; + } + + exports.joinPathSegments = joinPathSegments; +}); +unwrapExports(common$2); +var common_1$2 = common$2.isFatalError; +var common_2 = common$2.isAppliedFilter; +var common_3 = common$2.replacePathSegmentSeparator; +var common_4 = common$2.joinPathSegments; + +var reader = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class Reader { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._root = common$2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); + } + + } + + exports.default = Reader; +}); +unwrapExports(reader); + +var async$3 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class AsyncReader extends reader.default { + constructor(_root, _settings) { + super(_root, _settings); + this._settings = _settings; + this._scandir = out$1.scandir; + this._emitter = new events$1.EventEmitter(); + this._queue = queue(this._worker.bind(this), this._settings.concurrency); + this._isFatalError = false; + this._isDestroyed = false; + + this._queue.drain = () => { + if (!this._isFatalError) { + this._emitter.emit('end'); + } + }; + } + + read() { + this._isFatalError = false; + this._isDestroyed = false; + setImmediate(() => { + this._pushToQueue(this._root, this._settings.basePath); + }); + return this._emitter; + } + + destroy() { + if (this._isDestroyed) { + throw new Error('The reader is already destroyed'); + } + + this._isDestroyed = true; + + this._queue.killAndDrain(); + } + + onEntry(callback) { + this._emitter.on('entry', callback); + } + + onError(callback) { + this._emitter.once('error', callback); + } + + onEnd(callback) { + this._emitter.once('end', callback); + } + + _pushToQueue(directory, base) { + const queueItem = { + directory, + base + }; + + this._queue.push(queueItem, error => { + if (error !== null) { + this._handleError(error); + } + }); + } + + _worker(item, done) { + this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { + if (error !== null) { + return done(error, undefined); + } + + for (const entry of entries) { + this._handleEntry(entry, item.base); + } + + done(null, undefined); + }); + } + + _handleError(error) { + if (!common$2.isFatalError(this._settings, error)) { + return; + } + + this._isFatalError = true; + this._isDestroyed = true; + + this._emitter.emit('error', error); + } + + _handleEntry(entry, base) { + if (this._isDestroyed || this._isFatalError) { + return; + } + + const fullpath = entry.path; + + if (base !== undefined) { + entry.path = common$2.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + + if (common$2.isAppliedFilter(this._settings.entryFilter, entry)) { + this._emitEntry(entry); + } + + if (entry.dirent.isDirectory() && common$2.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, entry.path); + } + } + + _emitEntry(entry) { + this._emitter.emit('entry', entry); + } + + } + + exports.default = AsyncReader; +}); +unwrapExports(async$3); + +var async$4 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class AsyncProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new async$3.default(this._root, this._settings); + this._storage = new Set(); + } + + read(callback) { + this._reader.onError(error => { + callFailureCallback(callback, error); + }); + + this._reader.onEntry(entry => { + this._storage.add(entry); + }); + + this._reader.onEnd(() => { + callSuccessCallback(callback, [...this._storage]); + }); + + this._reader.read(); + } + + } + + exports.default = AsyncProvider; + + function callFailureCallback(callback, error) { + callback(error); + } + + function callSuccessCallback(callback, entries) { + callback(null, entries); + } +}); +unwrapExports(async$4); + +var stream$2 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class StreamProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new async$3.default(this._root, this._settings); + this._stream = new stream$6.Readable({ + objectMode: true, + read: () => {}, + destroy: this._reader.destroy.bind(this._reader) + }); + } + + read() { + this._reader.onError(error => { + this._stream.emit('error', error); + }); + + this._reader.onEntry(entry => { + this._stream.push(entry); + }); + + this._reader.onEnd(() => { + this._stream.push(null); + }); + + this._reader.read(); + + return this._stream; + } + + } + + exports.default = StreamProvider; +}); +unwrapExports(stream$2); + +var sync$3 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class SyncReader extends reader.default { + constructor() { + super(...arguments); + this._scandir = out$1.scandirSync; + this._storage = new Set(); + this._queue = new Set(); + } + + read() { + this._pushToQueue(this._root, this._settings.basePath); + + this._handleQueue(); + + return [...this._storage]; + } + + _pushToQueue(directory, base) { + this._queue.add({ + directory, + base + }); + } + + _handleQueue() { + for (const item of this._queue.values()) { + this._handleDirectory(item.directory, item.base); + } + } + + _handleDirectory(directory, base) { + try { + const entries = this._scandir(directory, this._settings.fsScandirSettings); + + for (const entry of entries) { + this._handleEntry(entry, base); + } + } catch (error) { + this._handleError(error); + } + } + + _handleError(error) { + if (!common$2.isFatalError(this._settings, error)) { + return; + } + + throw error; + } + + _handleEntry(entry, base) { + const fullpath = entry.path; + + if (base !== undefined) { + entry.path = common$2.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + + if (common$2.isAppliedFilter(this._settings.entryFilter, entry)) { + this._pushToStorage(entry); + } + + if (entry.dirent.isDirectory() && common$2.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, entry.path); + } + } + + _pushToStorage(entry) { + this._storage.add(entry); + } + + } + + exports.default = SyncReader; +}); +unwrapExports(sync$3); + +var sync$4 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class SyncProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new sync$3.default(this._root, this._settings); + } + + read() { + return this._reader.read(); + } + + } + + exports.default = SyncProvider; +}); +unwrapExports(sync$4); + +var settings$2 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class Settings { + constructor(_options = {}) { + this._options = _options; + this.basePath = this._getValue(this._options.basePath, undefined); + this.concurrency = this._getValue(this._options.concurrency, Infinity); + this.deepFilter = this._getValue(this._options.deepFilter, null); + this.entryFilter = this._getValue(this._options.entryFilter, null); + this.errorFilter = this._getValue(this._options.errorFilter, null); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$2.sep); + this.fsScandirSettings = new out$1.Settings({ + followSymbolicLinks: this._options.followSymbolicLinks, + fs: this._options.fs, + pathSegmentSeparator: this._options.pathSegmentSeparator, + stats: this._options.stats, + throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink + }); + } + + _getValue(option, value) { + return option === undefined ? value : option; + } + + } + + exports.default = Settings; +}); +unwrapExports(settings$2); + +var out$2 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Settings = settings$2.default; + + function walk(directory, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + return new async$4.default(directory, getSettings()).read(optionsOrSettingsOrCallback); + } + + new async$4.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback); + } + + exports.walk = walk; + + function walkSync(directory, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + const provider = new sync$4.default(directory, settings); + return provider.read(); + } + + exports.walkSync = walkSync; + + function walkStream(directory, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + const provider = new stream$2.default(directory, settings); + return provider.read(); + } + + exports.walkStream = walkStream; + + function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings$2.default) { + return settingsOrOptions; + } + + return new settings$2.default(settingsOrOptions); + } +}); +unwrapExports(out$2); +var out_1$2 = out$2.Settings; +var out_2$2 = out$2.walk; +var out_3$2 = out$2.walkSync; +var out_4 = out$2.walkStream; + +var reader$1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class Reader { + constructor(_settings) { + this._settings = _settings; + this._fsStatSettings = new out.Settings({ + followSymbolicLink: this._settings.followSymbolicLinks, + fs: this._settings.fs, + throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks + }); + } + + _getFullEntryPath(filepath) { + return path$2.resolve(this._settings.cwd, filepath); + } + + _makeEntry(stats, pattern) { + const entry = { + name: pattern, + path: pattern, + dirent: utils$4.fs.createDirentFromStats(pattern, stats) + }; + + if (this._settings.stats) { + entry.stats = stats; + } + + return entry; + } + + _isFatalError(error) { + return !utils$4.errno.isEnoentCodeError(error) && !this._settings.suppressErrors; + } + + } + + exports.default = Reader; +}); +unwrapExports(reader$1); + +var stream$3 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class ReaderStream extends reader$1.default { + constructor() { + super(...arguments); + this._walkStream = out$2.walkStream; + this._stat = out.stat; + } + + dynamic(root, options) { + return this._walkStream(root, options); + } + + static(patterns, options) { + const filepaths = patterns.map(this._getFullEntryPath, this); + const stream = new stream$6.PassThrough({ + objectMode: true + }); + + stream._write = (index, _enc, done) => { + return this._getEntry(filepaths[index], patterns[index], options).then(entry => { + if (entry !== null && options.entryFilter(entry)) { + stream.push(entry); + } + + if (index === filepaths.length - 1) { + stream.end(); + } + + done(); + }).catch(done); + }; + + for (let i = 0; i < filepaths.length; i++) { + stream.write(i); + } + + return stream; + } + + _getEntry(filepath, pattern, options) { + return this._getStat(filepath).then(stats => this._makeEntry(stats, pattern)).catch(error => { + if (options.errorFilter(error)) { + return null; + } + + throw error; + }); + } + + _getStat(filepath) { + return new Promise((resolve, reject) => { + this._stat(filepath, this._fsStatSettings, (error, stats) => { + return error === null ? resolve(stats) : reject(error); + }); + }); + } + + } + + exports.default = ReaderStream; +}); +unwrapExports(stream$3); + +var matcher = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class Matcher { + constructor(_patterns, _settings, _micromatchOptions) { + this._patterns = _patterns; + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this._storage = []; + + this._fillStorage(); + } + + _fillStorage() { + /** + * The original pattern may include `{,*,**,a/*}`, which will lead to problems with matching (unresolved level). + * So, before expand patterns with brace expansion into separated patterns. + */ + const patterns = utils$4.pattern.expandPatternsWithBraceExpansion(this._patterns); + + for (const pattern of patterns) { + const segments = this._getPatternSegments(pattern); + + const sections = this._splitSegmentsIntoSections(segments); + + this._storage.push({ + complete: sections.length <= 1, + pattern, + segments, + sections + }); + } + } + + _getPatternSegments(pattern) { + const parts = utils$4.pattern.getPatternParts(pattern, this._micromatchOptions); + return parts.map(part => { + const dynamic = utils$4.pattern.isDynamicPattern(part, this._settings); + + if (!dynamic) { + return { + dynamic: false, + pattern: part + }; + } + + return { + dynamic: true, + pattern: part, + patternRe: utils$4.pattern.makeRe(part, this._micromatchOptions) + }; + }); + } + + _splitSegmentsIntoSections(segments) { + return utils$4.array.splitWhen(segments, segment => segment.dynamic && utils$4.pattern.hasGlobStar(segment.pattern)); + } + + } + + exports.default = Matcher; +}); +unwrapExports(matcher); + +var partial = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class PartialMatcher extends matcher.default { + match(filepath) { + const parts = filepath.split('/'); + const levels = parts.length; + + const patterns = this._storage.filter(info => !info.complete || info.segments.length > levels); + + for (const pattern of patterns) { + const section = pattern.sections[0]; + /** + * In this case, the pattern has a globstar and we must read all directories unconditionally, + * but only if the level has reached the end of the first group. + * + * fixtures/{a,b}/** + * ^ true/false ^ always true + */ + + if (!pattern.complete && levels > section.length) { + return true; + } + + const match = parts.every((part, index) => { + const segment = pattern.segments[index]; + + if (segment.dynamic && segment.patternRe.test(part)) { + return true; + } + + if (!segment.dynamic && segment.pattern === part) { + return true; + } + + return false; + }); + + if (match) { + return true; + } + } + + return false; + } + + } + + exports.default = PartialMatcher; +}); +unwrapExports(partial); + +var deep = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class DeepFilter { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + } + + getFilter(basePath, positive, negative) { + const matcher = this._getMatcher(positive); + + const negativeRe = this._getNegativePatternsRe(negative); + + return entry => this._filter(basePath, entry, matcher, negativeRe); + } + + _getMatcher(patterns) { + return new partial.default(patterns, this._settings, this._micromatchOptions); + } + + _getNegativePatternsRe(patterns) { + const affectDepthOfReadingPatterns = patterns.filter(utils$4.pattern.isAffectDepthOfReadingPattern); + return utils$4.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions); + } + + _filter(basePath, entry, matcher, negativeRe) { + const depth = this._getEntryLevel(basePath, entry.path); + + if (this._isSkippedByDeep(depth)) { + return false; + } + + if (this._isSkippedSymbolicLink(entry)) { + return false; + } + + const filepath = utils$4.path.removeLeadingDotSegment(entry.path); + + if (this._isSkippedByPositivePatterns(filepath, matcher)) { + return false; + } + + return this._isSkippedByNegativePatterns(filepath, negativeRe); + } + + _isSkippedByDeep(entryDepth) { + return entryDepth >= this._settings.deep; + } + + _isSkippedSymbolicLink(entry) { + return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); + } + + _getEntryLevel(basePath, entryPath) { + const basePathDepth = basePath.split('/').length; + const entryPathDepth = entryPath.split('/').length; + return entryPathDepth - (basePath === '' ? 0 : basePathDepth); + } + + _isSkippedByPositivePatterns(entryPath, matcher) { + return !this._settings.baseNameMatch && !matcher.match(entryPath); + } + + _isSkippedByNegativePatterns(entryPath, negativeRe) { + return !utils$4.pattern.matchAny(entryPath, negativeRe); + } + + } + + exports.default = DeepFilter; +}); +unwrapExports(deep); + +var entry = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class EntryFilter { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this.index = new Map(); + } + + getFilter(positive, negative) { + const positiveRe = utils$4.pattern.convertPatternsToRe(positive, this._micromatchOptions); + const negativeRe = utils$4.pattern.convertPatternsToRe(negative, this._micromatchOptions); + return entry => this._filter(entry, positiveRe, negativeRe); + } + + _filter(entry, positiveRe, negativeRe) { + if (this._settings.unique) { + if (this._isDuplicateEntry(entry)) { + return false; + } + + this._createIndexRecord(entry); + } + + if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { + return false; + } + + if (this._isSkippedByAbsoluteNegativePatterns(entry, negativeRe)) { + return false; + } + + const filepath = this._settings.baseNameMatch ? entry.name : entry.path; + return this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe); + } + + _isDuplicateEntry(entry) { + return this.index.has(entry.path); + } + + _createIndexRecord(entry) { + this.index.set(entry.path, undefined); + } + + _onlyFileFilter(entry) { + return this._settings.onlyFiles && !entry.dirent.isFile(); + } + + _onlyDirectoryFilter(entry) { + return this._settings.onlyDirectories && !entry.dirent.isDirectory(); + } + + _isSkippedByAbsoluteNegativePatterns(entry, negativeRe) { + if (!this._settings.absolute) { + return false; + } + + const fullpath = utils$4.path.makeAbsolute(this._settings.cwd, entry.path); + return this._isMatchToPatterns(fullpath, negativeRe); + } + + _isMatchToPatterns(entryPath, patternsRe) { + const filepath = utils$4.path.removeLeadingDotSegment(entryPath); + return utils$4.pattern.matchAny(filepath, patternsRe); + } + + } + + exports.default = EntryFilter; +}); +unwrapExports(entry); + +var error = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class ErrorFilter { + constructor(_settings) { + this._settings = _settings; + } + + getFilter() { + return error => this._isNonFatalError(error); + } + + _isNonFatalError(error) { + return utils$4.errno.isEnoentCodeError(error) || this._settings.suppressErrors; + } + + } + + exports.default = ErrorFilter; +}); +unwrapExports(error); + +var entry$1 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class EntryTransformer { + constructor(_settings) { + this._settings = _settings; + } + + getTransformer() { + return entry => this._transform(entry); + } + + _transform(entry) { + let filepath = entry.path; + + if (this._settings.absolute) { + filepath = utils$4.path.makeAbsolute(this._settings.cwd, filepath); + filepath = utils$4.path.unixify(filepath); + } + + if (this._settings.markDirectories && entry.dirent.isDirectory()) { + filepath += '/'; + } + + if (!this._settings.objectMode) { + return filepath; + } + + return Object.assign(Object.assign({}, entry), { + path: filepath + }); + } + + } + + exports.default = EntryTransformer; +}); +unwrapExports(entry$1); + +var provider = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class Provider { + constructor(_settings) { + this._settings = _settings; + this.errorFilter = new error.default(this._settings); + this.entryFilter = new entry.default(this._settings, this._getMicromatchOptions()); + this.deepFilter = new deep.default(this._settings, this._getMicromatchOptions()); + this.entryTransformer = new entry$1.default(this._settings); + } + + _getRootDirectory(task) { + return path$2.resolve(this._settings.cwd, task.base); + } + + _getReaderOptions(task) { + const basePath = task.base === '.' ? '' : task.base; + return { + basePath, + pathSegmentSeparator: '/', + concurrency: this._settings.concurrency, + deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative), + entryFilter: this.entryFilter.getFilter(task.positive, task.negative), + errorFilter: this.errorFilter.getFilter(), + followSymbolicLinks: this._settings.followSymbolicLinks, + fs: this._settings.fs, + stats: this._settings.stats, + throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink, + transform: this.entryTransformer.getTransformer() + }; + } + + _getMicromatchOptions() { + return { + dot: this._settings.dot, + matchBase: this._settings.baseNameMatch, + nobrace: !this._settings.braceExpansion, + nocase: !this._settings.caseSensitiveMatch, + noext: !this._settings.extglob, + noglobstar: !this._settings.globstar, + posix: true, + strictSlashes: false + }; + } + + } + + exports.default = Provider; +}); +unwrapExports(provider); + +var async$5 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class ProviderAsync extends provider.default { + constructor() { + super(...arguments); + this._reader = new stream$3.default(this._settings); + } + + read(task) { + const root = this._getRootDirectory(task); + + const options = this._getReaderOptions(task); + + const entries = []; + return new Promise((resolve, reject) => { + const stream = this.api(root, task, options); + stream.once('error', reject); + stream.on('data', entry => entries.push(options.transform(entry))); + stream.once('end', () => resolve(entries)); + }); + } + + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + + return this._reader.static(task.patterns, options); + } + + } + + exports.default = ProviderAsync; +}); +unwrapExports(async$5); + +var stream$4 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class ProviderStream extends provider.default { + constructor() { + super(...arguments); + this._reader = new stream$3.default(this._settings); + } + + read(task) { + const root = this._getRootDirectory(task); + + const options = this._getReaderOptions(task); + + const source = this.api(root, task, options); + const destination = new stream$6.Readable({ + objectMode: true, + read: () => {} + }); + source.once('error', error => destination.emit('error', error)).on('data', entry => destination.emit('data', options.transform(entry))).once('end', () => destination.emit('end')); + destination.once('close', () => source.destroy()); + return destination; + } + + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + + return this._reader.static(task.patterns, options); + } + + } + + exports.default = ProviderStream; +}); +unwrapExports(stream$4); + +var sync$5 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class ReaderSync extends reader$1.default { + constructor() { + super(...arguments); + this._walkSync = out$2.walkSync; + this._statSync = out.statSync; + } + + dynamic(root, options) { + return this._walkSync(root, options); + } + + static(patterns, options) { + const entries = []; + + for (const pattern of patterns) { + const filepath = this._getFullEntryPath(pattern); + + const entry = this._getEntry(filepath, pattern, options); + + if (entry === null || !options.entryFilter(entry)) { + continue; + } + + entries.push(entry); + } + + return entries; + } + + _getEntry(filepath, pattern, options) { + try { + const stats = this._getStat(filepath); + + return this._makeEntry(stats, pattern); + } catch (error) { + if (options.errorFilter(error)) { + return null; + } + + throw error; + } + } + + _getStat(filepath) { + return this._statSync(filepath, this._fsStatSettings); + } + + } + + exports.default = ReaderSync; +}); +unwrapExports(sync$5); + +var sync$6 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + class ProviderSync extends provider.default { + constructor() { + super(...arguments); + this._reader = new sync$5.default(this._settings); + } + + read(task) { + const root = this._getRootDirectory(task); + + const options = this._getReaderOptions(task); + + const entries = this.api(root, task, options); + return entries.map(options.transform); + } + + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + + return this._reader.static(task.patterns, options); + } + + } + + exports.default = ProviderSync; +}); +unwrapExports(sync$6); + +var settings$3 = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + const CPU_COUNT = os$1.cpus().length; + exports.DEFAULT_FILE_SYSTEM_ADAPTER = { + lstat: fs$3.lstat, + lstatSync: fs$3.lstatSync, + stat: fs$3.stat, + statSync: fs$3.statSync, + readdir: fs$3.readdir, + readdirSync: fs$3.readdirSync + }; + + class Settings { + constructor(_options = {}) { + this._options = _options; + this.absolute = this._getValue(this._options.absolute, false); + this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); + this.braceExpansion = this._getValue(this._options.braceExpansion, true); + this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); + this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); + this.cwd = this._getValue(this._options.cwd, process.cwd()); + this.deep = this._getValue(this._options.deep, Infinity); + this.dot = this._getValue(this._options.dot, false); + this.extglob = this._getValue(this._options.extglob, true); + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); + this.fs = this._getFileSystemMethods(this._options.fs); + this.globstar = this._getValue(this._options.globstar, true); + this.ignore = this._getValue(this._options.ignore, []); + this.markDirectories = this._getValue(this._options.markDirectories, false); + this.objectMode = this._getValue(this._options.objectMode, false); + this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); + this.onlyFiles = this._getValue(this._options.onlyFiles, true); + this.stats = this._getValue(this._options.stats, false); + this.suppressErrors = this._getValue(this._options.suppressErrors, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); + this.unique = this._getValue(this._options.unique, true); + + if (this.onlyDirectories) { + this.onlyFiles = false; + } + + if (this.stats) { + this.objectMode = true; + } + } + + _getValue(option, value) { + return option === undefined ? value : option; + } + + _getFileSystemMethods(methods = {}) { + return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); + } + + } + + exports.default = Settings; +}); +unwrapExports(settings$3); +var settings_1 = settings$3.DEFAULT_FILE_SYSTEM_ADAPTER; + +async function FastGlob(source, options) { + assertPatternsInput(source); + const works = getWorks(source, async$5.default, options); + const result = await Promise.all(works); + return utils$4.array.flatten(result); +} // https://github.com/typescript-eslint/typescript-eslint/issues/60 +// eslint-disable-next-line no-redeclare + + +(function (FastGlob) { + function sync(source, options) { + assertPatternsInput(source); + const works = getWorks(source, sync$6.default, options); + return utils$4.array.flatten(works); + } + + FastGlob.sync = sync; + + function stream(source, options) { + assertPatternsInput(source); + const works = getWorks(source, stream$4.default, options); + /** + * The stream returned by the provider cannot work with an asynchronous iterator. + * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. + * This affects performance (+25%). I don't see best solution right now. + */ + + return utils$4.stream.merge(works); + } + + FastGlob.stream = stream; + + function generateTasks(source, options) { + assertPatternsInput(source); + const patterns = [].concat(source); + const settings = new settings$3.default(options); + return tasks.generate(patterns, settings); + } + + FastGlob.generateTasks = generateTasks; + + function isDynamicPattern(source, options) { + assertPatternsInput(source); + const settings = new settings$3.default(options); + return utils$4.pattern.isDynamicPattern(source, settings); + } + + FastGlob.isDynamicPattern = isDynamicPattern; + + function escapePath(source) { + assertPatternsInput(source); + return utils$4.path.escape(source); + } + + FastGlob.escapePath = escapePath; +})(FastGlob || (FastGlob = {})); + +function getWorks(source, _Provider, options) { + const patterns = [].concat(source); + const settings = new settings$3.default(options); + const tasks$1 = tasks.generate(patterns, settings); + const provider = new _Provider(settings); + return tasks$1.map(provider.read, provider); +} + +function assertPatternsInput(input) { + const source = [].concat(input); + const isValidSource = source.every(item => utils$4.string.isString(item) && !utils$4.string.isEmpty(item)); + + if (!isValidSource) { + throw new TypeError('Patterns must be a string (non empty) or an array of strings'); + } +} + +var out$3 = FastGlob; + +const { + promisify +} = util$4; + +async function isType(fsStatType, statsMethodName, filePath) { + if (typeof filePath !== 'string') { + throw new TypeError(`Expected a string, got ${typeof filePath}`); + } + + try { + const stats = await promisify(fs$3[fsStatType])(filePath); + return stats[statsMethodName](); + } catch (error) { + if (error.code === 'ENOENT') { + return false; + } + + throw error; + } +} + +function isTypeSync(fsStatType, statsMethodName, filePath) { + if (typeof filePath !== 'string') { + throw new TypeError(`Expected a string, got ${typeof filePath}`); + } + + try { + return fs$3[fsStatType](filePath)[statsMethodName](); + } catch (error) { + if (error.code === 'ENOENT') { + return false; + } + + throw error; + } +} + +var isFile = isType.bind(null, 'stat', 'isFile'); +var isDirectory = isType.bind(null, 'stat', 'isDirectory'); +var isSymlink = isType.bind(null, 'lstat', 'isSymbolicLink'); +var isFileSync = isTypeSync.bind(null, 'statSync', 'isFile'); +var isDirectorySync = isTypeSync.bind(null, 'statSync', 'isDirectory'); +var isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink'); +var pathType = { + isFile: isFile, + isDirectory: isDirectory, + isSymlink: isSymlink, + isFileSync: isFileSync, + isDirectorySync: isDirectorySync, + isSymlinkSync: isSymlinkSync +}; + +const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0]; + +const getPath = (filepath, cwd) => { + const pth = filepath[0] === '!' ? filepath.slice(1) : filepath; + return path$2.isAbsolute(pth) ? pth : path$2.join(cwd, pth); +}; + +const addExtensions = (file, extensions) => { + if (path$2.extname(file)) { + return `**/${file}`; + } + + return `**/${file}.${getExtensions(extensions)}`; +}; + +const getGlob = (directory, options) => { + if (options.files && !Array.isArray(options.files)) { + throw new TypeError(`Expected \`files\` to be of type \`Array\` but received type \`${typeof options.files}\``); + } + + if (options.extensions && !Array.isArray(options.extensions)) { + throw new TypeError(`Expected \`extensions\` to be of type \`Array\` but received type \`${typeof options.extensions}\``); + } + + if (options.files && options.extensions) { + return options.files.map(x => path$2.posix.join(directory, addExtensions(x, options.extensions))); + } + + if (options.files) { + return options.files.map(x => path$2.posix.join(directory, `**/${x}`)); + } + + if (options.extensions) { + return [path$2.posix.join(directory, `**/*.${getExtensions(options.extensions)}`)]; + } + + return [path$2.posix.join(directory, '**')]; +}; + +var dirGlob = async (input, options) => { + options = Object.assign({ + cwd: process.cwd() + }, options); + + if (typeof options.cwd !== 'string') { + throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``); + } + + const globs = await Promise.all([].concat(input).map(async x => { + const isDirectory = await pathType.isDirectory(getPath(x, options.cwd)); + return isDirectory ? getGlob(x, options) : x; + })); + return [].concat.apply([], globs); // eslint-disable-line prefer-spread +}; + +var sync$7 = (input, options) => { + options = Object.assign({ + cwd: process.cwd() + }, options); + + if (typeof options.cwd !== 'string') { + throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``); + } + + const globs = [].concat(input).map(x => pathType.isDirectorySync(getPath(x, options.cwd)) ? getGlob(x, options) : x); + return [].concat.apply([], globs); // eslint-disable-line prefer-spread +}; +dirGlob.sync = sync$7; + +// A simple implementation of make-array +function makeArray(subject) { + return Array.isArray(subject) ? subject : [subject]; +} + +const REGEX_TEST_BLANK_LINE = /^\s+$/; +const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/; +const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/; +const REGEX_SPLITALL_CRLF = /\r?\n/g; // /foo, +// ./foo, +// ../foo, +// . +// .. + +const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/; +const SLASH$1 = '/'; +const KEY_IGNORE$1 = typeof Symbol !== 'undefined' ? Symbol.for('node-ignore') +/* istanbul ignore next */ +: 'node-ignore'; + +const define$1 = (object, key, value) => Object.defineProperty(object, key, { + value +}); + +const REGEX_REGEXP_RANGE$1 = /([0-z])-([0-z])/g; // Sanitize the range of a regular expression +// The cases are complicated, see test cases for details + +const sanitizeRange$1 = range => range.replace(REGEX_REGEXP_RANGE$1, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match // Invalid range (out of order) which is ok for gitignore rules but +// fatal for JavaScript regular expression, so eliminate it. +: ''); // > If the pattern ends with a slash, +// > it is removed for the purpose of the following description, +// > but it would only find a match with a directory. +// > In other words, foo/ will match a directory foo and paths underneath it, +// > but will not match a regular file or a symbolic link foo +// > (this is consistent with the way how pathspec works in general in Git). +// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' +// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call +// you could use option `mark: true` with `glob` +// '`foo/`' should not continue with the '`..`' + + +const REPLACERS = [// > Trailing spaces are ignored unless they are quoted with backslash ("\") +[// (a\ ) -> (a ) +// (a ) -> (a) +// (a \ ) -> (a ) +/\\?\s+$/, match => match.indexOf('\\') === 0 ? ' ' : ''], // replace (\ ) with ' ' +[/\\\s/g, () => ' '], // Escape metacharacters +// which is written down by users but means special for regular expressions. +// > There are 12 characters with special meanings: +// > - the backslash \, +// > - the caret ^, +// > - the dollar sign $, +// > - the period or dot ., +// > - the vertical bar or pipe symbol |, +// > - the question mark ?, +// > - the asterisk or star *, +// > - the plus sign +, +// > - the opening parenthesis (, +// > - the closing parenthesis ), +// > - and the opening square bracket [, +// > - the opening curly brace {, +// > These special characters are often called "metacharacters". +[/[\\^$.|*+(){]/g, match => `\\${match}`], [// > [abc] matches any character inside the brackets +// > (in this case a, b, or c); +/\[([^\]/]*)($|\])/g, (match, p1, p2) => p2 === ']' ? `[${sanitizeRange$1(p1)}]` : `\\${match}`], [// > a question mark (?) matches a single character +/(?!\\)\?/g, () => '[^/]'], // leading slash +[// > A leading slash matches the beginning of the pathname. +// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". +// A leading slash matches the beginning of the pathname +/^\//, () => '^'], // replace special metacharacter slash after the leading slash +[/\//g, () => '\\/'], [// > A leading "**" followed by a slash means match in all directories. +// > For example, "**/foo" matches file or directory "foo" anywhere, +// > the same as pattern "foo". +// > "**/foo/bar" matches file or directory "bar" anywhere that is directly +// > under directory "foo". +// Notice that the '*'s have been replaced as '\\*' +/^\^*\\\*\\\*\\\//, // '**/foo' <-> 'foo' +() => '^(?:.*\\/)?'], // ending +[// 'js' will not match 'js.' +// 'ab' will not match 'abc' +/(?:[^*])$/, // WTF! +// https://git-scm.com/docs/gitignore +// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1) +// which re-fixes #24, #38 +// > If there is a separator at the end of the pattern then the pattern +// > will only match directories, otherwise the pattern can match both +// > files and directories. +// 'js*' will not match 'a.js' +// 'js/' will not match 'a.js' +// 'js' will match 'a.js' and 'a.js/' +match => /\/$/.test(match) // foo/ will not match 'foo' +? `${match}$` // foo matches 'foo' and 'foo/' +: `${match}(?=$|\\/$)`], // starting +[// there will be no leading '/' +// (which has been replaced by section "leading slash") +// If starts with '**', adding a '^' to the regular expression also works +/^(?=[^^])/, function startingReplacer() { + // If has a slash `/` at the beginning or middle + return !/\/(?!$)/.test(this) // > Prior to 2.22.1 + // > If the pattern does not contain a slash /, + // > Git treats it as a shell glob pattern + // Actually, if there is only a trailing slash, + // git also treats it as a shell glob pattern + // After 2.22.1 (compatible but clearer) + // > If there is a separator at the beginning or middle (or both) + // > of the pattern, then the pattern is relative to the directory + // > level of the particular .gitignore file itself. + // > Otherwise the pattern may also match at any level below + // > the .gitignore level. + ? '(?:^|\\/)' // > Otherwise, Git treats the pattern as a shell glob suitable for + // > consumption by fnmatch(3) + : '^'; +}], // two globstars +[// Use lookahead assertions so that we could match more than one `'/**'` +/\\\/\\\*\\\*(?=\\\/|$)/g, // Zero, one or several directories +// should not use '*', or it will be replaced by the next replacer +// Check if it is not the last `'/**'` +(_, index, str) => index + 6 < str.length // case: /**/ +// > A slash followed by two consecutive asterisks then a slash matches +// > zero or more directories. +// > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. +// '/**/' +? '(?:\\/[^\\/]+)*' // case: /** +// > A trailing `"/**"` matches everything inside. +// #21: everything inside but it should not include the current folder +: '\\/.+'], // intermediate wildcards +[// Never replace escaped '*' +// ignore rule '\*' will match the path '*' +// 'abc.*/' -> go +// 'abc.*' -> skip this rule +/(^|[^\\]+)\\\*(?=.+)/g, // '*.js' matches '.js' +// '*.js' doesn't match 'abc' +(_, p1) => `${p1}[^\\/]*`], // trailing wildcard +[/(\^|\\\/)?\\\*$/, (_, p1) => { + const prefix = p1 // '\^': + // '/*' does not match '' + // '/*' does not match everything + // '\\\/': + // 'abc/*' does not match 'abc/' + ? `${p1}[^/]+` // 'a*' matches 'a' + // 'a*' matches 'aa' + : '[^/]*'; + return `${prefix}(?=$|\\/$)`; +}], [// unescape +/\\\\\\/g, () => '\\']]; // A simple cache, because an ignore rule only has only one certain meaning + +const regexCache = Object.create(null); // @param {pattern} + +const makeRegex = (pattern, negative, ignorecase) => { + const r = regexCache[pattern]; + + if (r) { + return r; + } // const replacers = negative + // ? NEGATIVE_REPLACERS + // : POSITIVE_REPLACERS + + + const source = REPLACERS.reduce((prev, current) => prev.replace(current[0], current[1].bind(pattern)), pattern); + return regexCache[pattern] = ignorecase ? new RegExp(source, 'i') : new RegExp(source); +}; + +const isString = subject => typeof subject === 'string'; // > A blank line matches no files, so it can serve as a separator for readability. + + +const checkPattern$1 = pattern => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) // > A line starting with # serves as a comment. +&& pattern.indexOf('#') !== 0; + +const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF); + +class IgnoreRule { + constructor(origin, pattern, negative, regex) { + this.origin = origin; + this.pattern = pattern; + this.negative = negative; + this.regex = regex; + } + +} + +const createRule$1 = (pattern, ignorecase) => { + const origin = pattern; + let negative = false; // > An optional prefix "!" which negates the pattern; + + if (pattern.indexOf('!') === 0) { + negative = true; + pattern = pattern.substr(1); + } + + pattern = pattern // > Put a backslash ("\") in front of the first "!" for patterns that + // > begin with a literal "!", for example, `"\!important!.txt"`. + .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!') // > Put a backslash ("\") in front of the first hash for patterns that + // > begin with a hash. + .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#'); + const regex = makeRegex(pattern, negative, ignorecase); + return new IgnoreRule(origin, pattern, negative, regex); +}; + +const throwError = (message, Ctor) => { + throw new Ctor(message); +}; + +const checkPath = (path, originalPath, doThrow) => { + if (!isString(path)) { + return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError); + } // We don't know if we should ignore '', so throw + + + if (!path) { + return doThrow(`path must not be empty`, TypeError); + } // Check if it is a relative path + + + if (checkPath.isNotRelative(path)) { + const r = '`path.relative()`d'; + return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError); + } + + return true; +}; + +const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path); + +checkPath.isNotRelative = isNotRelative; + +checkPath.convert = p => p; + +class Ignore { + constructor({ + ignorecase = true + } = {}) { + this._rules = []; + this._ignorecase = ignorecase; + define$1(this, KEY_IGNORE$1, true); + + this._initCache(); + } + + _initCache() { + this._ignoreCache = Object.create(null); + this._testCache = Object.create(null); + } + + _addPattern(pattern) { + // #32 + if (pattern && pattern[KEY_IGNORE$1]) { + this._rules = this._rules.concat(pattern._rules); + this._added = true; + return; + } + + if (checkPattern$1(pattern)) { + const rule = createRule$1(pattern, this._ignorecase); + this._added = true; + + this._rules.push(rule); + } + } // @param {Array | string | Ignore} pattern + + + add(pattern) { + this._added = false; + makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this); // Some rules have just added to the ignore, + // making the behavior changed. + + if (this._added) { + this._initCache(); + } + + return this; + } // legacy + + + addPattern(pattern) { + return this.add(pattern); + } // | ignored : unignored + // negative | 0:0 | 0:1 | 1:0 | 1:1 + // -------- | ------- | ------- | ------- | -------- + // 0 | TEST | TEST | SKIP | X + // 1 | TESTIF | SKIP | TEST | X + // - SKIP: always skip + // - TEST: always test + // - TESTIF: only test if checkUnignored + // - X: that never happen + // @param {boolean} whether should check if the path is unignored, + // setting `checkUnignored` to `false` could reduce additional + // path matching. + // @returns {TestResult} true if a file is ignored + + + _testOne(path, checkUnignored) { + let ignored = false; + let unignored = false; + + this._rules.forEach(rule => { + const { + negative + } = rule; + + if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) { + return; + } + + const matched = rule.regex.test(path); + + if (matched) { + ignored = !negative; + unignored = negative; + } + }); + + return { + ignored, + unignored + }; + } // @returns {TestResult} + + + _test(originalPath, cache, checkUnignored, slices) { + const path = originalPath // Supports nullable path + && checkPath.convert(originalPath); + checkPath(path, originalPath, throwError); + return this._t(path, cache, checkUnignored, slices); + } + + _t(path, cache, checkUnignored, slices) { + if (path in cache) { + return cache[path]; + } + + if (!slices) { + // path/to/a.js + // ['path', 'to', 'a.js'] + slices = path.split(SLASH$1); + } + + slices.pop(); // If the path has no parent directory, just test it + + if (!slices.length) { + return cache[path] = this._testOne(path, checkUnignored); + } + + const parent = this._t(slices.join(SLASH$1) + SLASH$1, cache, checkUnignored, slices); // If the path contains a parent directory, check the parent first + + + return cache[path] = parent.ignored // > It is not possible to re-include a file if a parent directory of + // > that file is excluded. + ? parent : this._testOne(path, checkUnignored); + } + + ignores(path) { + return this._test(path, this._ignoreCache, false).ignored; + } + + createFilter() { + return path => !this.ignores(path); + } + + filter(paths) { + return makeArray(paths).filter(this.createFilter()); + } // @returns {TestResult} + + + test(path) { + return this._test(path, this._testCache, true); + } + +} + +const factory = options => new Ignore(options); + +const returnFalse = () => false; + +const isPathValid = path => checkPath(path && checkPath.convert(path), path, returnFalse); + +factory.isPathValid = isPathValid; // Fixes typescript + +factory.default = factory; +var ignore$1 = factory; // Windows +// -------------------------------------------------------------- + +/* istanbul ignore if */ + +if ( // Detect `process` so that it can run in browsers. +typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === 'win32')) { + /* eslint no-control-regex: "off" */ + const makePosix = str => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, '/'); + + checkPath.convert = makePosix; // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/' + // 'd:\\foo' + + const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i; + + checkPath.isNotRelative = path => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path); +} + +var slash$1 = path => { + const isExtendedLengthPath = /^\\\\\?\\/.test(path); + const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex + + if (isExtendedLengthPath || hasNonAscii) { + return path; + } + + return path.replace(/\\/g, '/'); +}; + +const { + promisify: promisify$1 +} = util$4; +const DEFAULT_IGNORE = ['**/node_modules/**', '**/flow-typed/**', '**/coverage/**', '**/.git']; +const readFileP = promisify$1(fs$3.readFile); + +const mapGitIgnorePatternTo = base => ignore => { + if (ignore.startsWith('!')) { + return '!' + path$2.posix.join(base, ignore.slice(1)); + } + + return path$2.posix.join(base, ignore); +}; + +const parseGitIgnore = (content, options) => { + const base = slash$1(path$2.relative(options.cwd, path$2.dirname(options.fileName))); + return content.split(/\r?\n/).filter(Boolean).filter(line => !line.startsWith('#')).map(mapGitIgnorePatternTo(base)); +}; + +const reduceIgnore = files => { + return files.reduce((ignores, file) => { + ignores.add(parseGitIgnore(file.content, { + cwd: file.cwd, + fileName: file.filePath + })); + return ignores; + }, ignore$1()); +}; + +const ensureAbsolutePathForCwd = (cwd, p) => { + if (path$2.isAbsolute(p)) { + if (p.startsWith(cwd)) { + return p; + } + + throw new Error(`Path ${p} is not in cwd ${cwd}`); + } + + return path$2.join(cwd, p); +}; + +const getIsIgnoredPredecate = (ignores, cwd) => { + return p => ignores.ignores(slash$1(path$2.relative(cwd, ensureAbsolutePathForCwd(cwd, p)))); +}; + +const getFile = async (file, cwd) => { + const filePath = path$2.join(cwd, file); + const content = await readFileP(filePath, 'utf8'); + return { + cwd, + filePath, + content + }; +}; + +const getFileSync = (file, cwd) => { + const filePath = path$2.join(cwd, file); + const content = fs$3.readFileSync(filePath, 'utf8'); + return { + cwd, + filePath, + content + }; +}; + +const normalizeOptions$3 = ({ + ignore = [], + cwd = slash$1(process.cwd()) +} = {}) => { + return { + ignore, + cwd + }; +}; + +var gitignore = async options => { + options = normalizeOptions$3(options); + const paths = await out$3('**/.gitignore', { + ignore: DEFAULT_IGNORE.concat(options.ignore), + cwd: options.cwd + }); + const files = await Promise.all(paths.map(file => getFile(file, options.cwd))); + const ignores = reduceIgnore(files); + return getIsIgnoredPredecate(ignores, options.cwd); +}; + +var sync$8 = options => { + options = normalizeOptions$3(options); + const paths = out$3.sync('**/.gitignore', { + ignore: DEFAULT_IGNORE.concat(options.ignore), + cwd: options.cwd + }); + const files = paths.map(file => getFileSync(file, options.cwd)); + const ignores = reduceIgnore(files); + return getIsIgnoredPredecate(ignores, options.cwd); +}; +gitignore.sync = sync$8; + +const { + Transform +} = stream$6; + +class ObjectTransform extends Transform { + constructor() { + super({ + objectMode: true + }); + } + +} + +class FilterStream extends ObjectTransform { + constructor(filter) { + super(); + this._filter = filter; + } + + _transform(data, encoding, callback) { + if (this._filter(data)) { + this.push(data); + } + + callback(); + } + +} + +class UniqueStream extends ObjectTransform { + constructor() { + super(); + this._pushed = new Set(); + } + + _transform(data, encoding, callback) { + if (!this._pushed.has(data)) { + this.push(data); + + this._pushed.add(data); + } + + callback(); + } + +} + +var streamUtils = { + FilterStream, + UniqueStream +}; + +const { + FilterStream: FilterStream$1, + UniqueStream: UniqueStream$1 +} = streamUtils; + +const DEFAULT_FILTER = () => false; + +const isNegative = pattern => pattern[0] === '!'; + +const assertPatternsInput$1 = patterns => { + if (!patterns.every(pattern => typeof pattern === 'string')) { + throw new TypeError('Patterns must be a string or an array of strings'); + } +}; + +const checkCwdOption = (options = {}) => { + if (!options.cwd) { + return; + } + + let stat; + + try { + stat = fs$3.statSync(options.cwd); + } catch (_) { + return; + } + + if (!stat.isDirectory()) { + throw new Error('The `cwd` option must be a path to a directory'); + } +}; + +const getPathString = p => p.stats instanceof fs$3.Stats ? p.path : p; + +const generateGlobTasks = (patterns, taskOptions) => { + patterns = arrayUnion([].concat(patterns)); + assertPatternsInput$1(patterns); + checkCwdOption(taskOptions); + const globTasks = []; + taskOptions = Object.assign({ + ignore: [], + expandDirectories: true + }, taskOptions); + + for (const [index, pattern] of patterns.entries()) { + if (isNegative(pattern)) { + continue; + } + + const ignore = patterns.slice(index).filter(isNegative).map(pattern => pattern.slice(1)); + const options = Object.assign({}, taskOptions, { + ignore: taskOptions.ignore.concat(ignore) + }); + globTasks.push({ + pattern, + options + }); + } + + return globTasks; +}; + +const globDirs = (task, fn) => { + let options = {}; + + if (task.options.cwd) { + options.cwd = task.options.cwd; + } + + if (Array.isArray(task.options.expandDirectories)) { + options = Object.assign({}, options, { + files: task.options.expandDirectories + }); + } else if (typeof task.options.expandDirectories === 'object') { + options = Object.assign({}, options, {}, task.options.expandDirectories); + } + + return fn(task.pattern, options); +}; + +const getPattern = (task, fn) => task.options.expandDirectories ? globDirs(task, fn) : [task.pattern]; + +const getFilterSync = options => { + return options && options.gitignore ? gitignore.sync({ + cwd: options.cwd, + ignore: options.ignore + }) : DEFAULT_FILTER; +}; + +const globToTask = task => glob => { + const { + options + } = task; + + if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) { + options.ignore = dirGlob.sync(options.ignore); + } + + return { + pattern: glob, + options + }; +}; + +var globby$1 = async (patterns, options) => { + const globTasks = generateGlobTasks(patterns, options); + + const getFilter = async () => { + return options && options.gitignore ? gitignore({ + cwd: options.cwd, + ignore: options.ignore + }) : DEFAULT_FILTER; + }; + + const getTasks = async () => { + const tasks = await Promise.all(globTasks.map(async task => { + const globs = await getPattern(task, dirGlob); + return Promise.all(globs.map(globToTask(task))); + })); + return arrayUnion(...tasks); + }; + + const [filter, tasks] = await Promise.all([getFilter(), getTasks()]); + const paths = await Promise.all(tasks.map(task => out$3(task.pattern, task.options))); + return arrayUnion(...paths).filter(path_ => !filter(getPathString(path_))); +}; + +var sync$9 = (patterns, options) => { + const globTasks = generateGlobTasks(patterns, options); + const tasks = globTasks.reduce((tasks, task) => { + const newTask = getPattern(task, dirGlob.sync).map(globToTask(task)); + return tasks.concat(newTask); + }, []); + const filter = getFilterSync(options); + return tasks.reduce((matches, task) => arrayUnion(matches, out$3.sync(task.pattern, task.options)), []).filter(path_ => !filter(path_)); +}; + +var stream$5 = (patterns, options) => { + const globTasks = generateGlobTasks(patterns, options); + const tasks = globTasks.reduce((tasks, task) => { + const newTask = getPattern(task, dirGlob.sync).map(globToTask(task)); + return tasks.concat(newTask); + }, []); + const filter = getFilterSync(options); + const filterStream = new FilterStream$1(p => !filter(p)); + const uniqueStream = new UniqueStream$1(); + return merge2_1(tasks.map(task => out$3.stream(task.pattern, task.options))).pipe(filterStream).pipe(uniqueStream); +}; + +var generateGlobTasks_1 = generateGlobTasks; + +var hasMagic = (patterns, options) => [].concat(patterns).some(pattern => out$3.isDynamicPattern(pattern, options)); + +var gitignore_1 = gitignore; +globby$1.sync = sync$9; +globby$1.stream = stream$5; +globby$1.generateGlobTasks = generateGlobTasks_1; +globby$1.hasMagic = hasMagic; +globby$1.gitignore = gitignore_1; + +const { + addLeadingComment: addLeadingComment$3, + addTrailingComment: addTrailingComment$3, + addDanglingComment: addDanglingComment$3, + getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$2 +} = utilShared; + +function handleOwnLineComment(comment, text, options, ast, isLastComment) { + const { + precedingNode, + enclosingNode, + followingNode + } = comment; + return handleLastFunctionArgComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleMemberExpressionComments(enclosingNode, followingNode, comment) || handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleTryStatementComments(enclosingNode, precedingNode, followingNode, comment) || handleClassComments(enclosingNode, precedingNode, followingNode, comment) || handleImportSpecifierComments(enclosingNode, comment) || handleForComments(enclosingNode, precedingNode, comment) || handleUnionTypeComments(precedingNode, enclosingNode, followingNode, comment) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || handleImportDeclarationComments(text, enclosingNode, precedingNode, comment, options) || handleAssignmentPatternComments(enclosingNode, comment) || handleMethodNameComments(text, enclosingNode, precedingNode, comment, options) || handleLabeledStatementComments(enclosingNode, comment); +} + +function handleEndOfLineComment(comment, text, options, ast, isLastComment) { + const { + precedingNode, + enclosingNode, + followingNode + } = comment; + return handleClosureTypeCastComments(followingNode, comment) || handleLastFunctionArgComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleConditionalExpressionComments(enclosingNode, precedingNode, followingNode, comment, text, options) || handleImportSpecifierComments(enclosingNode, comment) || handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleTryStatementComments(enclosingNode, precedingNode, followingNode, comment) || handleClassComments(enclosingNode, precedingNode, followingNode, comment) || handleLabeledStatementComments(enclosingNode, comment) || handleCallExpressionComments(precedingNode, enclosingNode, comment) || handlePropertyComments(enclosingNode, comment) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || handleTypeAliasComments(enclosingNode, followingNode, comment) || handleVariableDeclaratorComments(enclosingNode, followingNode, comment); +} + +function handleRemainingComment(comment, text, options, ast, isLastComment) { + const { + precedingNode, + enclosingNode, + followingNode + } = comment; + + if (handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleObjectPropertyAssignment(enclosingNode, precedingNode, comment) || handleCommentInEmptyParens(text, enclosingNode, comment, options) || handleMethodNameComments(text, enclosingNode, precedingNode, comment, options) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || handleCommentAfterArrowParams(text, enclosingNode, comment, options) || handleFunctionNameComments(text, enclosingNode, precedingNode, comment, options) || handleTSMappedTypeComments(text, enclosingNode, precedingNode, followingNode, comment) || handleBreakAndContinueStatementComments(enclosingNode, comment) || handleTSFunctionTrailingComments(text, enclosingNode, followingNode, comment, options)) { + return true; + } + + return false; +} + +function addBlockStatementFirstComment(node, comment) { + const body = node.body.filter(n => n.type !== "EmptyStatement"); + + if (body.length === 0) { + addDanglingComment$3(node, comment); + } else { + addLeadingComment$3(body[0], comment); + } +} + +function addBlockOrNotComment(node, comment) { + if (node.type === "BlockStatement") { + addBlockStatementFirstComment(node, comment); + } else { + addLeadingComment$3(node, comment); + } +} + +function handleClosureTypeCastComments(followingNode, comment) { + if (followingNode && isTypeCastComment(comment)) { + addLeadingComment$3(followingNode, comment); + return true; + } + + return false; +} // There are often comments before the else clause of if statements like +// +// if (1) { ... } +// // comment +// else { ... } +// +// They are being attached as leading comments of the BlockExpression which +// is not well printed. What we want is to instead move the comment inside +// of the block and make it leadingComment of the first element of the block +// or dangling comment of the block if there is nothing inside +// +// if (1) { ... } +// else { +// // comment +// ... +// } + + +function handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) { + if (!enclosingNode || enclosingNode.type !== "IfStatement" || !followingNode) { + return false; + } // We unfortunately have no way using the AST or location of nodes to know + // if the comment is positioned before the condition parenthesis: + // if (a /* comment */) {} + // The only workaround I found is to look at the next character to see if + // it is a ). + + + const nextCharacter = util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd); + + if (nextCharacter === ")") { + addTrailingComment$3(precedingNode, comment); + return true; + } // Comments before `else`: + // - treat as trailing comments of the consequent, if it's a BlockStatement + // - treat as a dangling comment otherwise + + + if (precedingNode === enclosingNode.consequent && followingNode === enclosingNode.alternate) { + if (precedingNode.type === "BlockStatement") { + addTrailingComment$3(precedingNode, comment); + } else { + addDanglingComment$3(enclosingNode, comment); + } + + return true; + } + + if (followingNode.type === "BlockStatement") { + addBlockStatementFirstComment(followingNode, comment); + return true; + } + + if (followingNode.type === "IfStatement") { + addBlockOrNotComment(followingNode.consequent, comment); + return true; + } // For comments positioned after the condition parenthesis in an if statement + // before the consequent without brackets on, such as + // if (a) /* comment */ true, + // we look at the next character to see if the following node + // is the consequent for the if statement + + + if (enclosingNode.consequent === followingNode) { + addLeadingComment$3(followingNode, comment); + return true; + } + + return false; +} + +function handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) { + if (!enclosingNode || enclosingNode.type !== "WhileStatement" || !followingNode) { + return false; + } // We unfortunately have no way using the AST or location of nodes to know + // if the comment is positioned before the condition parenthesis: + // while (a /* comment */) {} + // The only workaround I found is to look at the next character to see if + // it is a ). + + + const nextCharacter = util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd); + + if (nextCharacter === ")") { + addTrailingComment$3(precedingNode, comment); + return true; + } + + if (followingNode.type === "BlockStatement") { + addBlockStatementFirstComment(followingNode, comment); + return true; + } + + return false; +} // Same as IfStatement but for TryStatement + + +function handleTryStatementComments(enclosingNode, precedingNode, followingNode, comment) { + if (!enclosingNode || enclosingNode.type !== "TryStatement" && enclosingNode.type !== "CatchClause" || !followingNode) { + return false; + } + + if (enclosingNode.type === "CatchClause" && precedingNode) { + addTrailingComment$3(precedingNode, comment); + return true; + } + + if (followingNode.type === "BlockStatement") { + addBlockStatementFirstComment(followingNode, comment); + return true; + } + + if (followingNode.type === "TryStatement") { + addBlockOrNotComment(followingNode.finalizer, comment); + return true; + } + + if (followingNode.type === "CatchClause") { + addBlockOrNotComment(followingNode.body, comment); + return true; + } + + return false; +} + +function handleMemberExpressionComments(enclosingNode, followingNode, comment) { + if (enclosingNode && (enclosingNode.type === "MemberExpression" || enclosingNode.type === "OptionalMemberExpression") && followingNode && followingNode.type === "Identifier") { + addLeadingComment$3(enclosingNode, comment); + return true; + } + + return false; +} + +function handleConditionalExpressionComments(enclosingNode, precedingNode, followingNode, comment, text, options) { + const isSameLineAsPrecedingNode = precedingNode && !util$1.hasNewlineInRange(text, options.locEnd(precedingNode), options.locStart(comment)); + + if ((!precedingNode || !isSameLineAsPrecedingNode) && enclosingNode && enclosingNode.type === "ConditionalExpression" && followingNode) { + addLeadingComment$3(followingNode, comment); + return true; + } + + return false; +} + +function handleObjectPropertyAssignment(enclosingNode, precedingNode, comment) { + if (enclosingNode && (enclosingNode.type === "ObjectProperty" || enclosingNode.type === "Property") && enclosingNode.shorthand && enclosingNode.key === precedingNode && enclosingNode.value.type === "AssignmentPattern") { + addTrailingComment$3(enclosingNode.value.left, comment); + return true; + } + + return false; +} + +function handleClassComments(enclosingNode, precedingNode, followingNode, comment) { + if (enclosingNode && (enclosingNode.type === "ClassDeclaration" || enclosingNode.type === "ClassExpression") && enclosingNode.decorators && enclosingNode.decorators.length > 0 && !(followingNode && followingNode.type === "Decorator")) { + if (!enclosingNode.decorators || enclosingNode.decorators.length === 0) { + addLeadingComment$3(enclosingNode, comment); + } else { + addTrailingComment$3(enclosingNode.decorators[enclosingNode.decorators.length - 1], comment); + } + + return true; + } + + return false; +} + +function handleMethodNameComments(text, enclosingNode, precedingNode, comment, options) { + // This is only needed for estree parsers (flow, typescript) to attach + // after a method name: + // obj = { fn /*comment*/() {} }; + if (enclosingNode && precedingNode && ( // "MethodDefinition" is handled in getCommentChildNodes + enclosingNode.type === "Property" || enclosingNode.type === "TSDeclareMethod" || enclosingNode.type === "TSAbstractMethodDefinition") && precedingNode.type === "Identifier" && enclosingNode.key === precedingNode && // special Property case: { key: /*comment*/(value) }; + // comment should be attached to value instead of key + util$1.getNextNonSpaceNonCommentCharacter(text, precedingNode, options.locEnd) !== ":") { + addTrailingComment$3(precedingNode, comment); + return true; + } // Print comments between decorators and class methods as a trailing comment + // on the decorator node instead of the method node + + + if (precedingNode && enclosingNode && precedingNode.type === "Decorator" && (enclosingNode.type === "ClassMethod" || enclosingNode.type === "ClassProperty" || enclosingNode.type === "TSAbstractClassProperty" || enclosingNode.type === "TSAbstractMethodDefinition" || enclosingNode.type === "TSDeclareMethod" || enclosingNode.type === "MethodDefinition")) { + addTrailingComment$3(precedingNode, comment); + return true; + } + + return false; +} + +function handleFunctionNameComments(text, enclosingNode, precedingNode, comment, options) { + if (util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) !== "(") { + return false; + } + + if (precedingNode && enclosingNode && (enclosingNode.type === "FunctionDeclaration" || enclosingNode.type === "FunctionExpression" || enclosingNode.type === "ClassMethod" || enclosingNode.type === "MethodDefinition" || enclosingNode.type === "ObjectMethod")) { + addTrailingComment$3(precedingNode, comment); + return true; + } + + return false; +} + +function handleCommentAfterArrowParams(text, enclosingNode, comment, options) { + if (!(enclosingNode && enclosingNode.type === "ArrowFunctionExpression")) { + return false; + } + + const index = getNextNonSpaceNonCommentCharacterIndex$2(text, comment, options.locEnd); + + if (text.slice(index, index + 2) === "=>") { + addDanglingComment$3(enclosingNode, comment); + return true; + } + + return false; +} + +function handleCommentInEmptyParens(text, enclosingNode, comment, options) { + if (util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) !== ")") { + return false; + } // Only add dangling comments to fix the case when no params are present, + // i.e. a function without any argument. + + + if (enclosingNode && (isRealFunctionLikeNode(enclosingNode) && // `params` vs `parameters` - see https://github.com/babel/babel/issues/9231 + (enclosingNode.params || enclosingNode.parameters).length === 0 || (enclosingNode.type === "CallExpression" || enclosingNode.type === "OptionalCallExpression" || enclosingNode.type === "NewExpression") && enclosingNode.arguments.length === 0)) { + addDanglingComment$3(enclosingNode, comment); + return true; + } + + if (enclosingNode && enclosingNode.type === "MethodDefinition" && enclosingNode.value.params.length === 0) { + addDanglingComment$3(enclosingNode.value, comment); + return true; + } + + return false; +} + +function handleLastFunctionArgComments(text, precedingNode, enclosingNode, followingNode, comment, options) { + // Flow function type definitions + if (precedingNode && precedingNode.type === "FunctionTypeParam" && enclosingNode && enclosingNode.type === "FunctionTypeAnnotation" && followingNode && followingNode.type !== "FunctionTypeParam") { + addTrailingComment$3(precedingNode, comment); + return true; + } // Real functions and TypeScript function type definitions + + + if (precedingNode && (precedingNode.type === "Identifier" || precedingNode.type === "AssignmentPattern") && enclosingNode && isRealFunctionLikeNode(enclosingNode) && util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) === ")") { + addTrailingComment$3(precedingNode, comment); + return true; + } + + if (enclosingNode && enclosingNode.type === "FunctionDeclaration" && followingNode && followingNode.type === "BlockStatement") { + const functionParamRightParenIndex = (() => { + if ((enclosingNode.params || enclosingNode.parameters).length !== 0) { + return util$1.getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, options.locEnd(util$1.getLast(enclosingNode.params || enclosingNode.parameters))); + } + + const functionParamLeftParenIndex = util$1.getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, options.locEnd(enclosingNode.id)); + return util$1.getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, functionParamLeftParenIndex + 1); + })(); + + if (options.locStart(comment) > functionParamRightParenIndex) { + addBlockStatementFirstComment(followingNode, comment); + return true; + } + } + + return false; +} + +function handleImportSpecifierComments(enclosingNode, comment) { + if (enclosingNode && enclosingNode.type === "ImportSpecifier") { + addLeadingComment$3(enclosingNode, comment); + return true; + } + + return false; +} + +function handleLabeledStatementComments(enclosingNode, comment) { + if (enclosingNode && enclosingNode.type === "LabeledStatement") { + addLeadingComment$3(enclosingNode, comment); + return true; + } + + return false; +} + +function handleBreakAndContinueStatementComments(enclosingNode, comment) { + if (enclosingNode && (enclosingNode.type === "ContinueStatement" || enclosingNode.type === "BreakStatement") && !enclosingNode.label) { + addTrailingComment$3(enclosingNode, comment); + return true; + } + + return false; +} + +function handleCallExpressionComments(precedingNode, enclosingNode, comment) { + if (enclosingNode && (enclosingNode.type === "CallExpression" || enclosingNode.type === "OptionalCallExpression") && precedingNode && enclosingNode.callee === precedingNode && enclosingNode.arguments.length > 0) { + addLeadingComment$3(enclosingNode.arguments[0], comment); + return true; + } + + return false; +} + +function handleUnionTypeComments(precedingNode, enclosingNode, followingNode, comment) { + if (enclosingNode && (enclosingNode.type === "UnionTypeAnnotation" || enclosingNode.type === "TSUnionType")) { + if (util$1.isNodeIgnoreComment(comment)) { + followingNode.prettierIgnore = true; + comment.unignore = true; + } + + if (precedingNode) { + addTrailingComment$3(precedingNode, comment); + return true; + } + + return false; + } + + if (followingNode && (followingNode.type === "UnionTypeAnnotation" || followingNode.type === "TSUnionType") && util$1.isNodeIgnoreComment(comment)) { + followingNode.types[0].prettierIgnore = true; + comment.unignore = true; + } + + return false; +} + +function handlePropertyComments(enclosingNode, comment) { + if (enclosingNode && (enclosingNode.type === "Property" || enclosingNode.type === "ObjectProperty")) { + addLeadingComment$3(enclosingNode, comment); + return true; + } + + return false; +} + +function handleOnlyComments(enclosingNode, ast, comment, isLastComment) { + // With Flow the enclosingNode is undefined so use the AST instead. + if (ast && ast.body && ast.body.length === 0) { + if (isLastComment) { + addDanglingComment$3(ast, comment); + } else { + addLeadingComment$3(ast, comment); + } + + return true; + } else if (enclosingNode && enclosingNode.type === "Program" && enclosingNode.body.length === 0 && enclosingNode.directives && enclosingNode.directives.length === 0) { + if (isLastComment) { + addDanglingComment$3(enclosingNode, comment); + } else { + addLeadingComment$3(enclosingNode, comment); + } + + return true; + } + + return false; +} + +function handleForComments(enclosingNode, precedingNode, comment) { + if (enclosingNode && (enclosingNode.type === "ForInStatement" || enclosingNode.type === "ForOfStatement")) { + addLeadingComment$3(enclosingNode, comment); + return true; + } + + return false; +} + +function handleImportDeclarationComments(text, enclosingNode, precedingNode, comment, options) { + if (precedingNode && precedingNode.type === "ImportSpecifier" && enclosingNode && enclosingNode.type === "ImportDeclaration" && util$1.hasNewline(text, options.locEnd(comment))) { + addTrailingComment$3(precedingNode, comment); + return true; + } + + return false; +} + +function handleAssignmentPatternComments(enclosingNode, comment) { + if (enclosingNode && enclosingNode.type === "AssignmentPattern") { + addLeadingComment$3(enclosingNode, comment); + return true; + } + + return false; +} + +function handleTypeAliasComments(enclosingNode, followingNode, comment) { + if (enclosingNode && enclosingNode.type === "TypeAlias") { + addLeadingComment$3(enclosingNode, comment); + return true; + } + + return false; +} + +function handleVariableDeclaratorComments(enclosingNode, followingNode, comment) { + if (enclosingNode && (enclosingNode.type === "VariableDeclarator" || enclosingNode.type === "AssignmentExpression") && followingNode && (followingNode.type === "ObjectExpression" || followingNode.type === "ArrayExpression" || followingNode.type === "TemplateLiteral" || followingNode.type === "TaggedTemplateExpression" || isBlockComment(comment))) { + addLeadingComment$3(followingNode, comment); + return true; + } + + return false; +} + +function handleTSFunctionTrailingComments(text, enclosingNode, followingNode, comment, options) { + if (!followingNode && enclosingNode && (enclosingNode.type === "TSMethodSignature" || enclosingNode.type === "TSDeclareFunction" || enclosingNode.type === "TSAbstractMethodDefinition") && util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) === ";") { + addTrailingComment$3(enclosingNode, comment); + return true; + } + + return false; +} + +function handleTSMappedTypeComments(text, enclosingNode, precedingNode, followingNode, comment) { + if (!enclosingNode || enclosingNode.type !== "TSMappedType") { + return false; + } + + if (followingNode && followingNode.type === "TSTypeParameter" && followingNode.name) { + addLeadingComment$3(followingNode.name, comment); + return true; + } + + if (precedingNode && precedingNode.type === "TSTypeParameter" && precedingNode.constraint) { + addTrailingComment$3(precedingNode.constraint, comment); + return true; + } + + return false; +} + +function isBlockComment(comment) { + return comment.type === "Block" || comment.type === "CommentBlock"; +} + +function hasLeadingComment(node, fn = () => true) { + if (node.leadingComments) { + return node.leadingComments.some(fn); + } + + if (node.comments) { + return node.comments.some(comment => comment.leading && fn(comment)); + } + + return false; +} + +function isRealFunctionLikeNode(node) { + return node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression" || node.type === "FunctionDeclaration" || node.type === "ObjectMethod" || node.type === "ClassMethod" || node.type === "TSDeclareFunction" || node.type === "TSCallSignatureDeclaration" || node.type === "TSConstructSignatureDeclaration" || node.type === "TSConstructSignatureDeclaration" || node.type === "TSMethodSignature" || node.type === "TSConstructorType" || node.type === "TSFunctionType" || node.type === "TSDeclareMethod"; +} + +function getGapRegex(enclosingNode) { + if (enclosingNode && enclosingNode.type !== "BinaryExpression" && enclosingNode.type !== "LogicalExpression") { + // Support degenerate single-element unions and intersections. + // E.g.: `type A = /* 1 */ & B` + return /^[\s(&|]*$/; + } +} + +function getCommentChildNodes(node, options) { + // Prevent attaching comments to FunctionExpression in this case: + // class Foo { + // bar() // comment + // { + // baz(); + // } + // } + if ((options.parser === "typescript" || options.parser === "flow") && node.type === "MethodDefinition" && node.value && node.value.type === "FunctionExpression" && node.value.params.length === 0 && !node.value.returnType && (!node.value.typeParameters || node.value.typeParameters.length === 0) && node.value.body) { + return [...(node.decorators || []), node.key, node.value.body]; + } +} + +function isTypeCastComment(comment) { + return isBlockComment(comment) && comment.value[0] === "*" && // TypeScript expects the type to be enclosed in curly brackets, however + // Closure Compiler accepts types in parens and even without any delimiters at all. + // That's why we just search for "@type". + /@type\b/.test(comment.value); +} + +var comments$1 = { + handleOwnLineComment, + handleEndOfLineComment, + handleRemainingComment, + hasLeadingComment, + isBlockComment, + isTypeCastComment, + getGapRegex, + getCommentChildNodes +}; + +const { + isBlockComment: isBlockComment$1, + hasLeadingComment: hasLeadingComment$1 +} = comments$1; +const { + builders: { + indent: indent$2, + join: join$2, + line: line$2, + hardline: hardline$3, + softline: softline$1, + literalline: literalline$1, + concat: concat$4, + group: group$1, + dedentToRoot: dedentToRoot$1 + }, + utils: { + mapDoc: mapDoc$1, + stripTrailingHardline: stripTrailingHardline$1 + } +} = document; + +function embed(path, print, textToDoc, options) { + const node = path.getValue(); + const parent = path.getParentNode(); + const parentParent = path.getParentNode(1); + + switch (node.type) { + case "TemplateLiteral": + { + const isCss = [isStyledJsx, isStyledComponents, isCssProp, isAngularComponentStyles].some(isIt => isIt(path)); + + if (isCss) { + // Get full template literal with expressions replaced by placeholders + const rawQuasis = node.quasis.map(q => q.value.raw); + let placeholderID = 0; + const text = rawQuasis.reduce((prevVal, currVal, idx) => { + return idx === 0 ? currVal : prevVal + "@prettier-placeholder-" + placeholderID++ + "-id" + currVal; + }, ""); + const doc = textToDoc(text, { + parser: "scss" + }); + return transformCssDoc(doc, path, print); + } + /* + * react-relay and graphql-tag + * graphql`...` + * graphql.experimental`...` + * gql`...` + * + * This intentionally excludes Relay Classic tags, as Prettier does not + * support Relay Classic formatting. + */ + + + if (isGraphQL(path)) { + const expressionDocs = node.expressions ? path.map(print, "expressions") : []; + const numQuasis = node.quasis.length; + + if (numQuasis === 1 && node.quasis[0].value.raw.trim() === "") { + return "``"; + } + + const parts = []; + + for (let i = 0; i < numQuasis; i++) { + const templateElement = node.quasis[i]; + const isFirst = i === 0; + const isLast = i === numQuasis - 1; + const text = templateElement.value.cooked; // Bail out if any of the quasis have an invalid escape sequence + // (which would make the `cooked` value be `null` or `undefined`) + + if (typeof text !== "string") { + return null; + } + + const lines = text.split("\n"); + const numLines = lines.length; + const expressionDoc = expressionDocs[i]; + const startsWithBlankLine = numLines > 2 && lines[0].trim() === "" && lines[1].trim() === ""; + const endsWithBlankLine = numLines > 2 && lines[numLines - 1].trim() === "" && lines[numLines - 2].trim() === ""; + const commentsAndWhitespaceOnly = lines.every(line => /^\s*(?:#[^\r\n]*)?$/.test(line)); // Bail out if an interpolation occurs within a comment. + + if (!isLast && /#[^\r\n]*$/.test(lines[numLines - 1])) { + return null; + } + + let doc = null; + + if (commentsAndWhitespaceOnly) { + doc = printGraphqlComments(lines); + } else { + doc = stripTrailingHardline$1(textToDoc(text, { + parser: "graphql" + })); + } + + if (doc) { + doc = escapeTemplateCharacters(doc, false); + + if (!isFirst && startsWithBlankLine) { + parts.push(""); + } + + parts.push(doc); + + if (!isLast && endsWithBlankLine) { + parts.push(""); + } + } else if (!isFirst && !isLast && startsWithBlankLine) { + parts.push(""); + } + + if (expressionDoc) { + parts.push(concat$4(["${", expressionDoc, "}"])); + } + } + + return concat$4(["`", indent$2(concat$4([hardline$3, join$2(hardline$3, parts)])), hardline$3, "`"]); + } + + const htmlParser = isHtml(path) ? "html" : isAngularComponentTemplate(path) ? "angular" : undefined; + + if (htmlParser) { + return printHtmlTemplateLiteral(path, print, textToDoc, htmlParser, options); + } + + break; + } + + case "TemplateElement": + { + /** + * md`...` + * markdown`...` + */ + if (parentParent && parentParent.type === "TaggedTemplateExpression" && parent.quasis.length === 1 && parentParent.tag.type === "Identifier" && (parentParent.tag.name === "md" || parentParent.tag.name === "markdown")) { + const text = parent.quasis[0].value.raw.replace(/((?:\\\\)*)\\`/g, (_, backslashes) => "\\".repeat(backslashes.length / 2) + "`"); + const indentation = getIndentation(text); + const hasIndent = indentation !== ""; + return concat$4([hasIndent ? indent$2(concat$4([softline$1, printMarkdown(text.replace(new RegExp(`^${indentation}`, "gm"), ""))])) : concat$4([literalline$1, dedentToRoot$1(printMarkdown(text))]), softline$1]); + } + + break; + } + } + + function printMarkdown(text) { + const doc = textToDoc(text, { + parser: "markdown", + __inJsTemplate: true + }); + return stripTrailingHardline$1(escapeTemplateCharacters(doc, true)); + } +} + +function getIndentation(str) { + const firstMatchedIndent = str.match(/^([^\S\n]*)\S/m); + return firstMatchedIndent === null ? "" : firstMatchedIndent[1]; +} + +function uncook(cookedValue) { + return cookedValue.replace(/([\\`]|\$\{)/g, "\\$1"); +} + +function escapeTemplateCharacters(doc, raw) { + return mapDoc$1(doc, currentDoc => { + if (!currentDoc.parts) { + return currentDoc; + } + + const parts = []; + currentDoc.parts.forEach(part => { + if (typeof part === "string") { + parts.push(raw ? part.replace(/(\\*)`/g, "$1$1\\`") : uncook(part)); + } else { + parts.push(part); + } + }); + return Object.assign({}, currentDoc, { + parts + }); + }); +} + +function transformCssDoc(quasisDoc, path, print) { + const parentNode = path.getValue(); + const isEmpty = parentNode.quasis.length === 1 && !parentNode.quasis[0].value.raw.trim(); + + if (isEmpty) { + return "``"; + } + + const expressionDocs = parentNode.expressions ? path.map(print, "expressions") : []; + const newDoc = replacePlaceholders(quasisDoc, expressionDocs); + /* istanbul ignore if */ + + if (!newDoc) { + throw new Error("Couldn't insert all the expressions"); + } + + return concat$4(["`", indent$2(concat$4([hardline$3, stripTrailingHardline$1(newDoc)])), softline$1, "`"]); +} // Search all the placeholders in the quasisDoc tree +// and replace them with the expression docs one by one +// returns a new doc with all the placeholders replaced, +// or null if it couldn't replace any expression + + +function replacePlaceholders(quasisDoc, expressionDocs) { + if (!expressionDocs || !expressionDocs.length) { + return quasisDoc; + } + + const expressions = expressionDocs.slice(); + let replaceCounter = 0; + const newDoc = mapDoc$1(quasisDoc, doc => { + if (!doc || !doc.parts || !doc.parts.length) { + return doc; + } + + let { + parts + } = doc; + const atIndex = parts.indexOf("@"); + const placeholderIndex = atIndex + 1; + + if (atIndex > -1 && typeof parts[placeholderIndex] === "string" && parts[placeholderIndex].startsWith("prettier-placeholder")) { + // If placeholder is split, join it + const at = parts[atIndex]; + const placeholder = parts[placeholderIndex]; + const rest = parts.slice(placeholderIndex + 1); + parts = parts.slice(0, atIndex).concat([at + placeholder]).concat(rest); + } + + const atPlaceholderIndex = parts.findIndex(part => typeof part === "string" && part.startsWith("@prettier-placeholder")); + + if (atPlaceholderIndex > -1) { + const placeholder = parts[atPlaceholderIndex]; + const rest = parts.slice(atPlaceholderIndex + 1); + const placeholderMatch = placeholder.match(/@prettier-placeholder-(.+)-id([\s\S]*)/); + const placeholderID = placeholderMatch[1]; // When the expression has a suffix appended, like: + // animation: linear ${time}s ease-out; + + const suffix = placeholderMatch[2]; + const expression = expressions[placeholderID]; + replaceCounter++; + parts = parts.slice(0, atPlaceholderIndex).concat(["${", expression, "}" + suffix]).concat(rest); + } + + return Object.assign({}, doc, { + parts + }); + }); + return expressions.length === replaceCounter ? newDoc : null; +} + +function printGraphqlComments(lines) { + const parts = []; + let seenComment = false; + lines.map(textLine => textLine.trim()).forEach((textLine, i, array) => { + // Lines are either whitespace only, or a comment (with potential whitespace + // around it). Drop whitespace-only lines. + if (textLine === "") { + return; + } + + if (array[i - 1] === "" && seenComment) { + // If a non-first comment is preceded by a blank (whitespace only) line, + // add in a blank line. + parts.push(concat$4([hardline$3, textLine])); + } else { + parts.push(textLine); + } + + seenComment = true; + }); // If `lines` was whitespace only, return `null`. + + return parts.length === 0 ? null : join$2(hardline$3, parts); +} +/** + * Template literal in these contexts: + * + * css`` + * css.global`` + * css.resolve`` + */ + + +function isStyledJsx(path) { + const node = path.getValue(); + const parent = path.getParentNode(); + const parentParent = path.getParentNode(1); + return parentParent && node.quasis && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXElement" && parentParent.openingElement.name.name === "style" && parentParent.openingElement.attributes.some(attribute => attribute.name.name === "jsx") || parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "Identifier" && parent.tag.name === "css" || parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "MemberExpression" && parent.tag.object.name === "css" && (parent.tag.property.name === "global" || parent.tag.property.name === "resolve"); +} +/** + * Angular Components can have: + * - Inline HTML template + * - Inline CSS styles + * + * ...which are both within template literals somewhere + * inside of the Component decorator factory. + * + * E.g. + * @Component({ + * template: `
...
`, + * styles: [`h1 { color: blue; }`] + * }) + */ + + +function isAngularComponentStyles(path) { + return path.match(node => node.type === "TemplateLiteral", (node, name) => node.type === "ArrayExpression" && name === "elements", (node, name) => (node.type === "Property" || node.type === "ObjectProperty") && node.key.type === "Identifier" && node.key.name === "styles" && name === "value", ...angularComponentObjectExpressionPredicates); +} + +function isAngularComponentTemplate(path) { + return path.match(node => node.type === "TemplateLiteral", (node, name) => (node.type === "Property" || node.type === "ObjectProperty") && node.key.type === "Identifier" && node.key.name === "template" && name === "value", ...angularComponentObjectExpressionPredicates); +} + +const angularComponentObjectExpressionPredicates = [(node, name) => node.type === "ObjectExpression" && name === "properties", (node, name) => node.type === "CallExpression" && node.callee.type === "Identifier" && node.callee.name === "Component" && name === "arguments", (node, name) => node.type === "Decorator" && name === "expression"]; +/** + * styled-components template literals + */ + +function isStyledComponents(path) { + const parent = path.getParentNode(); + + if (!parent || parent.type !== "TaggedTemplateExpression") { + return false; + } + + const { + tag + } = parent; + + switch (tag.type) { + case "MemberExpression": + return (// styled.foo`` + isStyledIdentifier(tag.object) || // Component.extend`` + isStyledExtend(tag) + ); + + case "CallExpression": + return (// styled(Component)`` + isStyledIdentifier(tag.callee) || tag.callee.type === "MemberExpression" && (tag.callee.object.type === "MemberExpression" && ( // styled.foo.attrs({})`` + isStyledIdentifier(tag.callee.object.object) || // Component.extend.attrs({})`` + isStyledExtend(tag.callee.object)) || // styled(Component).attrs({})`` + tag.callee.object.type === "CallExpression" && isStyledIdentifier(tag.callee.object.callee)) + ); + + case "Identifier": + // css`` + return tag.name === "css"; + + default: + return false; + } +} +/** + * JSX element with CSS prop + */ + + +function isCssProp(path) { + const parent = path.getParentNode(); + const parentParent = path.getParentNode(1); + return parentParent && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" && parentParent.name.type === "JSXIdentifier" && parentParent.name.name === "css"; +} + +function isStyledIdentifier(node) { + return node.type === "Identifier" && node.name === "styled"; +} + +function isStyledExtend(node) { + return /^[A-Z]/.test(node.object.name) && node.property.name === "extend"; +} +/* + * react-relay and graphql-tag + * graphql`...` + * graphql.experimental`...` + * gql`...` + * GraphQL comment block + * + * This intentionally excludes Relay Classic tags, as Prettier does not + * support Relay Classic formatting. + */ + + +function isGraphQL(path) { + const node = path.getValue(); + const parent = path.getParentNode(); + return hasLanguageComment(node, "GraphQL") || parent && (parent.type === "TaggedTemplateExpression" && (parent.tag.type === "MemberExpression" && parent.tag.object.name === "graphql" && parent.tag.property.name === "experimental" || parent.tag.type === "Identifier" && (parent.tag.name === "gql" || parent.tag.name === "graphql")) || parent.type === "CallExpression" && parent.callee.type === "Identifier" && parent.callee.name === "graphql"); +} + +function hasLanguageComment(node, languageName) { + // This checks for a leading comment that is exactly `/* GraphQL */` + // In order to be in line with other implementations of this comment tag + // we will not trim the comment value and we will expect exactly one space on + // either side of the GraphQL string + // Also see ./clean.js + return hasLeadingComment$1(node, comment => isBlockComment$1(comment) && comment.value === ` ${languageName} `); +} +/** + * - html`...` + * - HTML comment block + */ + + +function isHtml(path) { + return hasLanguageComment(path.getValue(), "HTML") || path.match(node => node.type === "TemplateLiteral", (node, name) => node.type === "TaggedTemplateExpression" && node.tag.type === "Identifier" && node.tag.name === "html" && name === "quasi"); +} // The counter is needed to distinguish nested embeds. + + +let htmlTemplateLiteralCounter = 0; + +function printHtmlTemplateLiteral(path, print, textToDoc, parser, options) { + const node = path.getValue(); + const counter = htmlTemplateLiteralCounter; + htmlTemplateLiteralCounter = htmlTemplateLiteralCounter + 1 >>> 0; + + const composePlaceholder = index => `PRETTIER_HTML_PLACEHOLDER_${index}_${counter}_IN_JS`; + + const text = node.quasis.map((quasi, index, quasis) => index === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index)).join(""); + const expressionDocs = path.map(print, "expressions"); + + if (expressionDocs.length === 0 && text.trim().length === 0) { + return "``"; + } + + const placeholderRegex = new RegExp(composePlaceholder("(\\d+)"), "g"); + let topLevelCount = 0; + const contentDoc = mapDoc$1(stripTrailingHardline$1(textToDoc(text, { + parser, + + __onHtmlRoot(root) { + topLevelCount = root.children.length; + } + + })), doc => { + if (typeof doc !== "string") { + return doc; + } + + const parts = []; + const components = doc.split(placeholderRegex); + + for (let i = 0; i < components.length; i++) { + let component = components[i]; + + if (i % 2 === 0) { + if (component) { + component = uncook(component); + + if (options.embeddedInHtml) { + component = component.replace(/<\/(script)\b/gi, "<\\/$1"); + } + + parts.push(component); + } + + continue; + } + + const placeholderIndex = +component; + parts.push(concat$4(["${", group$1(expressionDocs[placeholderIndex]), "}"])); + } + + return concat$4(parts); + }); + const leadingWhitespace = /^\s/.test(text) ? " " : ""; + const trailingWhitespace = /\s$/.test(text) ? " " : ""; + const linebreak = options.htmlWhitespaceSensitivity === "ignore" ? hardline$3 : leadingWhitespace && trailingWhitespace ? line$2 : null; + + if (linebreak) { + return group$1(concat$4(["`", indent$2(concat$4([linebreak, group$1(contentDoc)])), linebreak, "`"])); + } + + return group$1(concat$4(["`", leadingWhitespace, topLevelCount > 1 ? indent$2(group$1(contentDoc)) : group$1(contentDoc), trailingWhitespace, "`"])); +} + +var embed_1 = embed; + +function clean(ast, newObj, parent) { + ["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "flags", "errors"].forEach(name => { + delete newObj[name]; + }); + + if (ast.loc && ast.loc.source === null) { + delete newObj.loc.source; + } + + if (ast.type === "BigIntLiteral") { + newObj.value = newObj.value.toLowerCase(); + } // We remove extra `;` and add them when needed + + + if (ast.type === "EmptyStatement") { + return null; + } // We move text around, including whitespaces and add {" "} + + + if (ast.type === "JSXText") { + return null; + } + + if (ast.type === "JSXExpressionContainer" && ast.expression.type === "Literal" && ast.expression.value === " ") { + return null; + } // (TypeScript) Ignore `static` in `constructor(static p) {}` + // and `export` in `constructor(export p) {}` + + + if (ast.type === "TSParameterProperty" && ast.accessibility === null && !ast.readonly) { + return { + type: "Identifier", + name: ast.parameter.name, + typeAnnotation: newObj.parameter.typeAnnotation, + decorators: newObj.decorators + }; + } // (TypeScript) ignore empty `specifiers` array + + + if (ast.type === "TSNamespaceExportDeclaration" && ast.specifiers && ast.specifiers.length === 0) { + delete newObj.specifiers; + } // We convert
to
+ + + if (ast.type === "JSXOpeningElement") { + delete newObj.selfClosing; + } + + if (ast.type === "JSXElement") { + delete newObj.closingElement; + } // We change {'key': value} into {key: value} + + + if ((ast.type === "Property" || ast.type === "ObjectProperty" || ast.type === "MethodDefinition" || ast.type === "ClassProperty" || ast.type === "TSPropertySignature" || ast.type === "ObjectTypeProperty") && typeof ast.key === "object" && ast.key && (ast.key.type === "Literal" || ast.key.type === "StringLiteral" || ast.key.type === "Identifier")) { + delete newObj.key; + } + + if (ast.type === "OptionalMemberExpression" && ast.optional === false) { + newObj.type = "MemberExpression"; + delete newObj.optional; + } // Remove raw and cooked values from TemplateElement when it's CSS + // styled-jsx + + + if (ast.type === "JSXElement" && ast.openingElement.name.name === "style" && ast.openingElement.attributes.some(attr => attr.name.name === "jsx")) { + const templateLiterals = newObj.children.filter(child => child.type === "JSXExpressionContainer" && child.expression.type === "TemplateLiteral").map(container => container.expression); + const quasis = templateLiterals.reduce((quasis, templateLiteral) => quasis.concat(templateLiteral.quasis), []); + quasis.forEach(q => delete q.value); + } // CSS template literals in css prop + + + if (ast.type === "JSXAttribute" && ast.name.name === "css" && ast.value.type === "JSXExpressionContainer" && ast.value.expression.type === "TemplateLiteral") { + newObj.value.expression.quasis.forEach(q => delete q.value); + } // Angular Components: Inline HTML template and Inline CSS styles + + + const expression = ast.expression || ast.callee; + + if (ast.type === "Decorator" && expression.type === "CallExpression" && expression.callee.name === "Component" && expression.arguments.length === 1) { + const astProps = ast.expression.arguments[0].properties; + newObj.expression.arguments[0].properties.forEach((prop, index) => { + let templateLiteral = null; + + switch (astProps[index].key.name) { + case "styles": + if (prop.value.type === "ArrayExpression") { + templateLiteral = prop.value.elements[0]; + } + + break; + + case "template": + if (prop.value.type === "TemplateLiteral") { + templateLiteral = prop.value; + } + + break; + } + + if (templateLiteral) { + templateLiteral.quasis.forEach(q => delete q.value); + } + }); + } // styled-components, graphql, markdown + + + if (ast.type === "TaggedTemplateExpression" && (ast.tag.type === "MemberExpression" || ast.tag.type === "Identifier" && (ast.tag.name === "gql" || ast.tag.name === "graphql" || ast.tag.name === "css" || ast.tag.name === "md" || ast.tag.name === "markdown" || ast.tag.name === "html") || ast.tag.type === "CallExpression")) { + newObj.quasi.quasis.forEach(quasi => delete quasi.value); + } + + if (ast.type === "TemplateLiteral") { + // This checks for a leading comment that is exactly `/* GraphQL */` + // In order to be in line with other implementations of this comment tag + // we will not trim the comment value and we will expect exactly one space on + // either side of the GraphQL string + // Also see ./embed.js + const hasLanguageComment = ast.leadingComments && ast.leadingComments.some(comment => comment.type === "CommentBlock" && ["GraphQL", "HTML"].some(languageName => comment.value === ` ${languageName} `)); + + if (hasLanguageComment || parent.type === "CallExpression" && parent.callee.name === "graphql") { + newObj.quasis.forEach(quasi => delete quasi.value); + } + } +} + +var clean_1 = clean; + +const detectNewline = string => { + if (typeof string !== 'string') { + throw new TypeError('Expected a string'); + } + + const newlines = string.match(/(?:\r?\n)/g) || []; + + if (newlines.length === 0) { + return; + } + + const crlf = newlines.filter(newline => newline === '\r\n').length; + const lf = newlines.length - crlf; + return crlf > lf ? '\r\n' : '\n'; +}; + +var detectNewline_1 = detectNewline; + +var graceful = string => typeof string === 'string' && detectNewline(string) || '\n'; +detectNewline_1.graceful = graceful; + +var build = createCommonjsModule(function (module, exports) { + + Object.defineProperty(exports, '__esModule', { + value: true + }); + exports.extract = extract; + exports.strip = strip; + exports.parse = parse; + exports.parseWithComments = parseWithComments; + exports.print = print; + + function _os() { + const data = os$1; + + _os = function () { + return data; + }; + + return data; + } + + function _detectNewline() { + const data = _interopRequireDefault(detectNewline_1); + + _detectNewline = function () { + return data; + }; + + return data; + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + /** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + const commentEndRe = /\*\/$/; + const commentStartRe = /^\/\*\*/; + const docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/; + const lineCommentRe = /(^|\s+)\/\/([^\r\n]*)/g; + const ltrimNewlineRe = /^(\r?\n)+/; + const multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g; + const propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g; + const stringStartRe = /(\r?\n|^) *\* ?/g; + + function extract(contents) { + const match = contents.match(docblockRe); + return match ? match[0].trimLeft() : ''; + } + + function strip(contents) { + const match = contents.match(docblockRe); + return match && match[0] ? contents.substring(match[0].length) : contents; + } + + function parse(docblock) { + return parseWithComments(docblock).pragmas; + } + + function parseWithComments(docblock) { + const line = (0, _detectNewline().default)(docblock) || _os().EOL; + + docblock = docblock.replace(commentStartRe, '').replace(commentEndRe, '').replace(stringStartRe, '$1'); // Normalize multi-line directives + + let prev = ''; + + while (prev !== docblock) { + prev = docblock; + docblock = docblock.replace(multilineRe, `${line}$1 $2${line}`); + } + + docblock = docblock.replace(ltrimNewlineRe, '').trimRight(); + const result = Object.create(null); + const comments = docblock.replace(propertyRe, '').replace(ltrimNewlineRe, '').trimRight(); + let match; + + while (match = propertyRe.exec(docblock)) { + // strip linecomments from pragmas + const nextPragma = match[2].replace(lineCommentRe, ''); + + if (typeof result[match[1]] === 'string' || Array.isArray(result[match[1]])) { + result[match[1]] = [].concat(result[match[1]], nextPragma); + } else { + result[match[1]] = nextPragma; + } + } + + return { + comments, + pragmas: result + }; + } + + function print({ + comments = '', + pragmas = {} + }) { + const line = (0, _detectNewline().default)(comments) || _os().EOL; + + const head = '/**'; + const start = ' *'; + const tail = ' */'; + const keys = Object.keys(pragmas); + const printedObject = keys.map(key => printKeyValues(key, pragmas[key])).reduce((arr, next) => arr.concat(next), []).map(keyValue => start + ' ' + keyValue + line).join(''); + + if (!comments) { + if (keys.length === 0) { + return ''; + } + + if (keys.length === 1 && !Array.isArray(pragmas[keys[0]])) { + const value = pragmas[keys[0]]; + return `${head} ${printKeyValues(keys[0], value)[0]}${tail}`; + } + } + + const printedComments = comments.split(line).map(textLine => `${start} ${textLine}`).join(line) + line; + return head + line + (comments ? printedComments : '') + (comments && keys.length ? start + line : '') + printedObject + tail; + } + + function printKeyValues(key, valueOrArray) { + return [].concat(valueOrArray).map(value => `@${key} ${value}`.trim()); + } +}); +unwrapExports(build); +var build_1 = build.extract; +var build_2 = build.strip; +var build_3 = build.parse; +var build_4 = build.parseWithComments; +var build_5 = build.print; + +function hasPragma(text) { + const pragmas = Object.keys(build.parse(build.extract(text))); + return pragmas.includes("prettier") || pragmas.includes("format"); +} + +function insertPragma(text) { + const parsedDocblock = build.parseWithComments(build.extract(text)); + const pragmas = Object.assign({ + format: "" + }, parsedDocblock.pragmas); + const newDocblock = build.print({ + pragmas, + comments: parsedDocblock.comments.replace(/^(\s+?\r?\n)+/, "") // remove leading newlines + + }).replace(/(\r\n|\r)/g, "\n"); // normalise newlines (mitigate use of os.EOL by jest-docblock) + + const strippedText = build.strip(text); + const separatingNewlines = strippedText.startsWith("\n") ? "\n" : "\n\n"; + return newDocblock + separatingNewlines + strippedText; +} + +var pragma = { + hasPragma, + insertPragma +}; + +const { + getLast: getLast$1, + hasNewline: hasNewline$3, + hasNewlineInRange: hasNewlineInRange$2, + hasIgnoreComment: hasIgnoreComment$1, + hasNodeIgnoreComment: hasNodeIgnoreComment$1, + skipWhitespace: skipWhitespace$2 +} = util$1; +const isIdentifierName = utils$1.keyword.isIdentifierNameES5; // We match any whitespace except line terminators because +// Flow annotation comments cannot be split across lines. For example: +// +// (this /* +// : any */).foo = 5; +// +// is not picked up by Flow (see https://github.com/facebook/flow/issues/7050), so +// removing the newline would create a type annotation that the user did not intend +// to create. + +const NON_LINE_TERMINATING_WHITE_SPACE = "(?:(?=.)\\s)"; +const FLOW_SHORTHAND_ANNOTATION = new RegExp(`^${NON_LINE_TERMINATING_WHITE_SPACE}*:`); +const FLOW_ANNOTATION = new RegExp(`^${NON_LINE_TERMINATING_WHITE_SPACE}*::`); + +function hasFlowShorthandAnnotationComment(node) { + // https://flow.org/en/docs/types/comments/ + // Syntax example: const r = new (window.Request /*: Class */)(""); + return node.extra && node.extra.parenthesized && node.trailingComments && node.trailingComments[0].value.match(FLOW_SHORTHAND_ANNOTATION); +} + +function hasFlowAnnotationComment(comments) { + return comments && comments[0].value.match(FLOW_ANNOTATION); +} + +function hasNode(node, fn) { + if (!node || typeof node !== "object") { + return false; + } + + if (Array.isArray(node)) { + return node.some(value => hasNode(value, fn)); + } + + const result = fn(node); + return typeof result === "boolean" ? result : Object.keys(node).some(key => hasNode(node[key], fn)); +} + +function hasNakedLeftSide(node) { + return node.type === "AssignmentExpression" || node.type === "BinaryExpression" || node.type === "LogicalExpression" || node.type === "NGPipeExpression" || node.type === "ConditionalExpression" || node.type === "CallExpression" || node.type === "OptionalCallExpression" || node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "BindExpression" || node.type === "UpdateExpression" && !node.prefix || node.type === "TSAsExpression" || node.type === "TSNonNullExpression"; +} + +function getLeftSide(node) { + if (node.expressions) { + return node.expressions[0]; + } + + return node.left || node.test || node.callee || node.object || node.tag || node.argument || node.expression; +} + +function getLeftSidePathName(path, node) { + if (node.expressions) { + return ["expressions", 0]; + } + + if (node.left) { + return ["left"]; + } + + if (node.test) { + return ["test"]; + } + + if (node.object) { + return ["object"]; + } + + if (node.callee) { + return ["callee"]; + } + + if (node.tag) { + return ["tag"]; + } + + if (node.argument) { + return ["argument"]; + } + + if (node.expression) { + return ["expression"]; + } + + throw new Error("Unexpected node has no left side", node); +} + +const exportDeclarationTypes = new Set(["ExportDefaultDeclaration", "ExportDefaultSpecifier", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration"]); + +function isExportDeclaration(node) { + return node && exportDeclarationTypes.has(node.type); +} + +function getParentExportDeclaration(path) { + const parentNode = path.getParentNode(); + + if (path.getName() === "declaration" && isExportDeclaration(parentNode)) { + return parentNode; + } + + return null; +} + +function isLiteral(node) { + return node.type === "BooleanLiteral" || node.type === "DirectiveLiteral" || node.type === "Literal" || node.type === "NullLiteral" || node.type === "NumericLiteral" || node.type === "RegExpLiteral" || node.type === "StringLiteral" || node.type === "TemplateLiteral" || node.type === "TSTypeLiteral" || node.type === "JSXText"; +} + +function isNumericLiteral(node) { + return node.type === "NumericLiteral" || node.type === "Literal" && typeof node.value === "number"; +} + +function isStringLiteral(node) { + return node.type === "StringLiteral" || node.type === "Literal" && typeof node.value === "string"; +} + +function isObjectType(n) { + return n.type === "ObjectTypeAnnotation" || n.type === "TSTypeLiteral"; +} + +function isFunctionOrArrowExpression(node) { + return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression"; +} + +function isFunctionOrArrowExpressionWithBody(node) { + return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement"; +} + +function isTemplateLiteral(node) { + return node.type === "TemplateLiteral"; +} // `inject` is used in AngularJS 1.x, `async` in Angular 2+ +// example: https://docs.angularjs.org/guide/unit-testing#using-beforeall- + + +function isAngularTestWrapper(node) { + return (node.type === "CallExpression" || node.type === "OptionalCallExpression") && node.callee.type === "Identifier" && (node.callee.name === "async" || node.callee.name === "inject" || node.callee.name === "fakeAsync"); +} + +function isJSXNode(node) { + return node.type === "JSXElement" || node.type === "JSXFragment"; +} + +function isTheOnlyJSXElementInMarkdown(options, path) { + if (options.parentParser !== "markdown" && options.parentParser !== "mdx") { + return false; + } + + const node = path.getNode(); + + if (!node.expression || !isJSXNode(node.expression)) { + return false; + } + + const parent = path.getParentNode(); + return parent.type === "Program" && parent.body.length === 1; +} // Detect an expression node representing `{" "}` + + +function isJSXWhitespaceExpression(node) { + return node.type === "JSXExpressionContainer" && isLiteral(node.expression) && node.expression.value === " " && !node.expression.comments; +} + +function isMemberExpressionChain(node) { + if (node.type !== "MemberExpression" && node.type !== "OptionalMemberExpression") { + return false; + } + + if (node.object.type === "Identifier") { + return true; + } + + return isMemberExpressionChain(node.object); +} + +function isGetterOrSetter(node) { + return node.kind === "get" || node.kind === "set"; +} + +function sameLocStart(nodeA, nodeB, options) { + return options.locStart(nodeA) === options.locStart(nodeB); +} // TODO: This is a bad hack and we need a better way to distinguish between +// arrow functions and otherwise + + +function isFunctionNotation(node, options) { + return isGetterOrSetter(node) || sameLocStart(node, node.value, options); +} // Hack to differentiate between the following two which have the same ast +// type T = { method: () => void }; +// type T = { method(): void }; + + +function isObjectTypePropertyAFunction(node, options) { + return (node.type === "ObjectTypeProperty" || node.type === "ObjectTypeInternalSlot") && node.value.type === "FunctionTypeAnnotation" && !node.static && !isFunctionNotation(node, options); +} // Hack to differentiate between the following two which have the same ast +// declare function f(a): void; +// var f: (a) => void; + + +function isTypeAnnotationAFunction(node, options) { + return (node.type === "TypeAnnotation" || node.type === "TSTypeAnnotation") && node.typeAnnotation.type === "FunctionTypeAnnotation" && !node.static && !sameLocStart(node, node.typeAnnotation, options); +} + +const binaryishNodeTypes = new Set(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]); + +function isBinaryish(node) { + return binaryishNodeTypes.has(node.type); +} + +function isMemberish(node) { + return node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "BindExpression" && node.object; +} + +function isSimpleFlowType(node) { + const flowTypeAnnotations = ["AnyTypeAnnotation", "NullLiteralTypeAnnotation", "GenericTypeAnnotation", "ThisTypeAnnotation", "NumberTypeAnnotation", "VoidTypeAnnotation", "EmptyTypeAnnotation", "MixedTypeAnnotation", "BooleanTypeAnnotation", "BooleanLiteralTypeAnnotation", "StringTypeAnnotation"]; + return node && flowTypeAnnotations.includes(node.type) && !(node.type === "GenericTypeAnnotation" && node.typeParameters); +} + +const unitTestRe = /^(skip|[fx]?(it|describe|test))$/; + +function isSkipOrOnlyBlock(node) { + return (node.callee.type === "MemberExpression" || node.callee.type === "OptionalMemberExpression") && node.callee.object.type === "Identifier" && node.callee.property.type === "Identifier" && unitTestRe.test(node.callee.object.name) && (node.callee.property.name === "only" || node.callee.property.name === "skip"); +} + +function isUnitTestSetUp(n) { + const unitTestSetUpRe = /^(before|after)(Each|All)$/; + return n.callee.type === "Identifier" && unitTestSetUpRe.test(n.callee.name) && n.arguments.length === 1; +} // eg; `describe("some string", (done) => {})` + + +function isTestCall(n, parent) { + if (n.type !== "CallExpression") { + return false; + } + + if (n.arguments.length === 1) { + if (isAngularTestWrapper(n) && parent && isTestCall(parent)) { + return isFunctionOrArrowExpression(n.arguments[0]); + } + + if (isUnitTestSetUp(n)) { + return isAngularTestWrapper(n.arguments[0]); + } + } else if (n.arguments.length === 2 || n.arguments.length === 3) { + if ((n.callee.type === "Identifier" && unitTestRe.test(n.callee.name) || isSkipOrOnlyBlock(n)) && (isTemplateLiteral(n.arguments[0]) || isStringLiteral(n.arguments[0]))) { + // it("name", () => { ... }, 2500) + if (n.arguments[2] && !isNumericLiteral(n.arguments[2])) { + return false; + } + + return (n.arguments.length === 2 ? isFunctionOrArrowExpression(n.arguments[1]) : isFunctionOrArrowExpressionWithBody(n.arguments[1]) && n.arguments[1].params.length <= 1) || isAngularTestWrapper(n.arguments[1]); + } + } + + return false; +} + +function hasLeadingComment$2(node) { + return node.comments && node.comments.some(comment => comment.leading); +} + +function hasTrailingComment(node) { + return node.comments && node.comments.some(comment => comment.trailing); +} + +function isCallOrOptionalCallExpression(node) { + return node.type === "CallExpression" || node.type === "OptionalCallExpression"; +} + +function hasDanglingComments(node) { + return node.comments && node.comments.some(comment => !comment.leading && !comment.trailing); +} +/** identify if an angular expression seems to have side effects */ + + +function hasNgSideEffect(path) { + return hasNode(path.getValue(), node => { + switch (node.type) { + case undefined: + return false; + + case "CallExpression": + case "OptionalCallExpression": + case "AssignmentExpression": + return true; + } + }); +} + +function isNgForOf(node, index, parentNode) { + return node.type === "NGMicrosyntaxKeyedExpression" && node.key.name === "of" && index === 1 && parentNode.body[0].type === "NGMicrosyntaxLet" && parentNode.body[0].value === null; +} +/** @param node {import("estree").TemplateLiteral} */ + + +function isSimpleTemplateLiteral(node) { + if (node.expressions.length === 0) { + return false; + } + + return node.expressions.every(expr => { + // Disallow comments since printDocToString can't print them here + if (expr.comments) { + return false; + } // Allow `x` and `this` + + + if (expr.type === "Identifier" || expr.type === "ThisExpression") { + return true; + } // Allow `a.b.c`, `a.b[c]`, and `this.x.y` + + + if (expr.type === "MemberExpression" || expr.type === "OptionalMemberExpression") { + let head = expr; + + while (head.type === "MemberExpression" || head.type === "OptionalMemberExpression") { + if (head.property.type !== "Identifier" && head.property.type !== "Literal" && head.property.type !== "StringLiteral" && head.property.type !== "NumericLiteral") { + return false; + } + + head = head.object; + + if (head.comments) { + return false; + } + } + + if (head.type === "Identifier" || head.type === "ThisExpression") { + return true; + } + + return false; + } + + return false; + }); +} + +function getFlowVariance(path) { + if (!path.variance) { + return null; + } // Babel 7.0 currently uses variance node type, and flow should + // follow suit soon: + // https://github.com/babel/babel/issues/4722 + + + const variance = path.variance.kind || path.variance; + + switch (variance) { + case "plus": + return "+"; + + case "minus": + return "-"; + + default: + /* istanbul ignore next */ + return variance; + } +} + +function classPropMayCauseASIProblems(path) { + const node = path.getNode(); + + if (node.type !== "ClassProperty") { + return false; + } + + const name = node.key && node.key.name; // this isn't actually possible yet with most parsers available today + // so isn't properly tested yet. + + if ((name === "static" || name === "get" || name === "set") && !node.value && !node.typeAnnotation) { + return true; + } +} + +function classChildNeedsASIProtection(node) { + if (!node) { + return; + } + + if (node.static || node.accessibility // TypeScript + ) { + return false; + } + + if (!node.computed) { + const name = node.key && node.key.name; + + if (name === "in" || name === "instanceof") { + return true; + } + } + + switch (node.type) { + case "ClassProperty": + case "TSAbstractClassProperty": + return node.computed; + + case "MethodDefinition": // Flow + + case "TSAbstractMethodDefinition": // TypeScript + + case "ClassMethod": + case "ClassPrivateMethod": + { + // Babel + const isAsync = node.value ? node.value.async : node.async; + const isGenerator = node.value ? node.value.generator : node.generator; + + if (isAsync || node.kind === "get" || node.kind === "set") { + return false; + } + + if (node.computed || isGenerator) { + return true; + } + + return false; + } + + case "TSIndexSignature": + return true; + + default: + /* istanbul ignore next */ + return false; + } +} + +function getTypeScriptMappedTypeModifier(tokenNode, keyword) { + if (tokenNode === "+") { + return "+" + keyword; + } else if (tokenNode === "-") { + return "-" + keyword; + } + + return keyword; +} + +function hasNewlineBetweenOrAfterDecorators(node, options) { + return hasNewlineInRange$2(options.originalText, options.locStart(node.decorators[0]), options.locEnd(getLast$1(node.decorators))) || hasNewline$3(options.originalText, options.locEnd(getLast$1(node.decorators))); +} // Only space, newline, carriage return, and tab are treated as whitespace +// inside JSX. + + +const jsxWhitespaceChars = " \n\r\t"; +const matchJsxWhitespaceRegex = new RegExp("([" + jsxWhitespaceChars + "]+)"); +const containsNonJsxWhitespaceRegex = new RegExp("[^" + jsxWhitespaceChars + "]"); // Meaningful if it contains non-whitespace characters, +// or it contains whitespace without a new line. + +function isMeaningfulJSXText(node) { + return isLiteral(node) && (containsNonJsxWhitespaceRegex.test(rawText(node)) || !/\n/.test(rawText(node))); +} + +function hasJsxIgnoreComment(path) { + const node = path.getValue(); + const parent = path.getParentNode(); + + if (!parent || !node || !isJSXNode(node) || !isJSXNode(parent)) { + return false; + } // Lookup the previous sibling, ignoring any empty JSXText elements + + + const index = parent.children.indexOf(node); + let prevSibling = null; + + for (let i = index; i > 0; i--) { + const candidate = parent.children[i - 1]; + + if (candidate.type === "JSXText" && !isMeaningfulJSXText(candidate)) { + continue; + } + + prevSibling = candidate; + break; + } + + return prevSibling && prevSibling.type === "JSXExpressionContainer" && prevSibling.expression.type === "JSXEmptyExpression" && prevSibling.expression.comments && prevSibling.expression.comments.find(comment => comment.value.trim() === "prettier-ignore"); +} + +function isEmptyJSXElement(node) { + if (node.children.length === 0) { + return true; + } + + if (node.children.length > 1) { + return false; + } // if there is one text child and does not contain any meaningful text + // we can treat the element as empty. + + + const child = node.children[0]; + return isLiteral(child) && !isMeaningfulJSXText(child); +} + +function hasPrettierIgnore(path) { + return hasIgnoreComment$1(path) || hasJsxIgnoreComment(path); +} + +function isLastStatement(path) { + const parent = path.getParentNode(); + + if (!parent) { + return true; + } + + const node = path.getValue(); + const body = (parent.body || parent.consequent).filter(stmt => stmt.type !== "EmptyStatement"); + return body && body[body.length - 1] === node; +} + +function isFlowAnnotationComment(text, typeAnnotation, options) { + const start = options.locStart(typeAnnotation); + const end = skipWhitespace$2(text, options.locEnd(typeAnnotation)); + return text.slice(start, start + 2) === "/*" && text.slice(end, end + 2) === "*/"; +} + +function hasLeadingOwnLineComment(text, node, options) { + if (isJSXNode(node)) { + return hasNodeIgnoreComment$1(node); + } + + const res = node.comments && node.comments.some(comment => comment.leading && hasNewline$3(text, options.locEnd(comment))); + return res; +} // This recurses the return argument, looking for the first token +// (the leftmost leaf node) and, if it (or its parents) has any +// leadingComments, returns true (so it can be wrapped in parens). + + +function returnArgumentHasLeadingComment(options, argument) { + if (hasLeadingOwnLineComment(options.originalText, argument, options)) { + return true; + } + + if (hasNakedLeftSide(argument)) { + let leftMost = argument; + let newLeftMost; + + while (newLeftMost = getLeftSide(leftMost)) { + leftMost = newLeftMost; + + if (hasLeadingOwnLineComment(options.originalText, leftMost, options)) { + return true; + } + } + } + + return false; +} + +function isStringPropSafeToCoerceToIdentifier(node, options) { + return isStringLiteral(node.key) && isIdentifierName(node.key.value) && options.parser !== "json" && // With `--strictPropertyInitialization`, TS treats properties with quoted names differently than unquoted ones. + // See https://github.com/microsoft/TypeScript/pull/20075 + !((options.parser === "typescript" || options.parser === "babel-ts") && node.type === "ClassProperty"); +} + +function isJestEachTemplateLiteral(node, parentNode) { + /** + * describe.each`table`(name, fn) + * describe.only.each`table`(name, fn) + * describe.skip.each`table`(name, fn) + * test.each`table`(name, fn) + * test.only.each`table`(name, fn) + * test.skip.each`table`(name, fn) + * + * Ref: https://github.com/facebook/jest/pull/6102 + */ + const jestEachTriggerRegex = /^[xf]?(describe|it|test)$/; + return parentNode.type === "TaggedTemplateExpression" && parentNode.quasi === node && parentNode.tag.type === "MemberExpression" && parentNode.tag.property.type === "Identifier" && parentNode.tag.property.name === "each" && (parentNode.tag.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.name) || parentNode.tag.object.type === "MemberExpression" && parentNode.tag.object.property.type === "Identifier" && (parentNode.tag.object.property.name === "only" || parentNode.tag.object.property.name === "skip") && parentNode.tag.object.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.object.name)); +} + +function templateLiteralHasNewLines(template) { + return template.quasis.some(quasi => quasi.value.raw.includes("\n")); +} + +function isTemplateOnItsOwnLine(n, text, options) { + return (n.type === "TemplateLiteral" && templateLiteralHasNewLines(n) || n.type === "TaggedTemplateExpression" && templateLiteralHasNewLines(n.quasi)) && !hasNewline$3(text, options.locStart(n), { + backwards: true + }); +} + +function needsHardlineAfterDanglingComment(node) { + if (!node.comments) { + return false; + } + + const lastDanglingComment = getLast$1(node.comments.filter(comment => !comment.leading && !comment.trailing)); + return lastDanglingComment && !comments$1.isBlockComment(lastDanglingComment); +} // If we have nested conditional expressions, we want to print them in JSX mode +// if there's at least one JSXElement somewhere in the tree. +// +// A conditional expression chain like this should be printed in normal mode, +// because there aren't JSXElements anywhere in it: +// +// isA ? "A" : isB ? "B" : isC ? "C" : "Unknown"; +// +// But a conditional expression chain like this should be printed in JSX mode, +// because there is a JSXElement in the last ConditionalExpression: +// +// isA ? "A" : isB ? "B" : isC ? "C" : Unknown; +// +// This type of ConditionalExpression chain is structured like this in the AST: +// +// ConditionalExpression { +// test: ..., +// consequent: ..., +// alternate: ConditionalExpression { +// test: ..., +// consequent: ..., +// alternate: ConditionalExpression { +// test: ..., +// consequent: ..., +// alternate: ..., +// } +// } +// } +// +// We want to traverse over that shape and convert it into a flat structure so +// that we can find if there's a JSXElement somewhere inside. + + +function getConditionalChainContents(node) { + // Given this code: + // + // // Using a ConditionalExpression as the consequent is uncommon, but should + // // be handled. + // A ? B : C ? D : E ? F ? G : H : I + // + // which has this AST: + // + // ConditionalExpression { + // test: Identifier(A), + // consequent: Identifier(B), + // alternate: ConditionalExpression { + // test: Identifier(C), + // consequent: Identifier(D), + // alternate: ConditionalExpression { + // test: Identifier(E), + // consequent: ConditionalExpression { + // test: Identifier(F), + // consequent: Identifier(G), + // alternate: Identifier(H), + // }, + // alternate: Identifier(I), + // } + // } + // } + // + // we should return this Array: + // + // [ + // Identifier(A), + // Identifier(B), + // Identifier(C), + // Identifier(D), + // Identifier(E), + // Identifier(F), + // Identifier(G), + // Identifier(H), + // Identifier(I) + // ]; + // + // This loses the information about whether each node was the test, + // consequent, or alternate, but we don't care about that here- we are only + // flattening this structure to find if there's any JSXElements inside. + const nonConditionalExpressions = []; + + function recurse(node) { + if (node.type === "ConditionalExpression") { + recurse(node.test); + recurse(node.consequent); + recurse(node.alternate); + } else { + nonConditionalExpressions.push(node); + } + } + + recurse(node); + return nonConditionalExpressions; +} + +function conditionalExpressionChainContainsJSX(node) { + return Boolean(getConditionalChainContents(node).find(isJSXNode)); +} // Logic to check for args with multiple anonymous functions. For instance, +// the following call should be split on multiple lines for readability: +// source.pipe(map((x) => x + x), filter((x) => x % 2 === 0)) + + +function isFunctionCompositionArgs(args) { + if (args.length <= 1) { + return false; + } + + let count = 0; + + for (const arg of args) { + if (isFunctionOrArrowExpression(arg)) { + count += 1; + + if (count > 1) { + return true; + } + } else if (isCallOrOptionalCallExpression(arg)) { + for (const childArg of arg.arguments) { + if (isFunctionOrArrowExpression(childArg)) { + return true; + } + } + } + } + + return false; +} // Logic to determine if a call is a “long curried function call”. +// See https://github.com/prettier/prettier/issues/1420. +// +// `connect(a, b, c)(d)` +// In the above call expression, the second call is the parent node and the +// first call is the current node. + + +function isLongCurriedCallExpression(path) { + const node = path.getValue(); + const parent = path.getParentNode(); + return isCallOrOptionalCallExpression(node) && isCallOrOptionalCallExpression(parent) && parent.callee === node && node.arguments.length > parent.arguments.length && parent.arguments.length > 0; +} +/** + * @param {import('estree').Node} node + * @param {number} depth + * @returns {boolean} + */ + + +function isSimpleCallArgument(node, depth) { + if (depth >= 2) { + return false; + } + + const isChildSimple = child => isSimpleCallArgument(child, depth + 1); + + const regexpPattern = node.type === "Literal" && node.regex && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern; + + if (regexpPattern && regexpPattern.length > 5) { + return false; + } + + if (node.type === "Literal" || node.type === "BooleanLiteral" || node.type === "NullLiteral" || node.type === "NumericLiteral" || node.type === "StringLiteral" || node.type === "Identifier" || node.type === "ThisExpression" || node.type === "Super" || node.type === "BigIntLiteral" || node.type === "PrivateName" || node.type === "ArgumentPlaceholder" || node.type === "RegExpLiteral" || node.type === "Import") { + return true; + } + + if (node.type === "TemplateLiteral") { + return node.expressions.every(isChildSimple); + } + + if (node.type === "ObjectExpression") { + return node.properties.every(p => !p.computed && (p.shorthand || p.value && isChildSimple(p.value))); + } + + if (node.type === "ArrayExpression") { + return node.elements.every(x => x == null || isChildSimple(x)); + } + + if (node.type === "CallExpression" || node.type === "OptionalCallExpression" || node.type === "NewExpression") { + return isSimpleCallArgument(node.callee, depth) && node.arguments.every(isChildSimple); + } + + if (node.type === "MemberExpression" || node.type === "OptionalMemberExpression") { + return isSimpleCallArgument(node.object, depth) && isSimpleCallArgument(node.property, depth); + } + + if (node.type === "UnaryExpression" && (node.operator === "!" || node.operator === "-")) { + return isSimpleCallArgument(node.argument, depth); + } + + if (node.type === "TSNonNullExpression") { + return isSimpleCallArgument(node.expression, depth); + } + + return false; +} + +function rawText(node) { + return node.extra ? node.extra.raw : node.raw; +} + +function identity$1(x) { + return x; +} + +function isTSXFile(options) { + return options.filepath && /\.tsx$/i.test(options.filepath); +} + +var utils$6 = { + classChildNeedsASIProtection, + classPropMayCauseASIProblems, + conditionalExpressionChainContainsJSX, + getFlowVariance, + getLeftSidePathName, + getParentExportDeclaration, + getTypeScriptMappedTypeModifier, + hasDanglingComments, + hasFlowAnnotationComment, + hasFlowShorthandAnnotationComment, + hasLeadingComment: hasLeadingComment$2, + hasLeadingOwnLineComment, + hasNakedLeftSide, + hasNewlineBetweenOrAfterDecorators, + hasNgSideEffect, + hasNode, + hasPrettierIgnore, + hasTrailingComment, + identity: identity$1, + isBinaryish, + isCallOrOptionalCallExpression, + isEmptyJSXElement, + isExportDeclaration, + isFlowAnnotationComment, + isFunctionCompositionArgs, + isFunctionNotation, + isFunctionOrArrowExpression, + isGetterOrSetter, + isJestEachTemplateLiteral, + isJSXNode, + isJSXWhitespaceExpression, + isLastStatement, + isLiteral, + isLongCurriedCallExpression, + isSimpleCallArgument, + isMeaningfulJSXText, + isMemberExpressionChain, + isMemberish, + isNgForOf, + isNumericLiteral, + isObjectType, + isObjectTypePropertyAFunction, + isSimpleFlowType, + isSimpleTemplateLiteral, + isStringLiteral, + isStringPropSafeToCoerceToIdentifier, + isTemplateOnItsOwnLine, + isTestCall, + isTheOnlyJSXElementInMarkdown, + isTSXFile, + isTypeAnnotationAFunction, + matchJsxWhitespaceRegex, + needsHardlineAfterDanglingComment, + rawText, + returnArgumentHasLeadingComment +}; + +const { + getLeftSidePathName: getLeftSidePathName$1, + hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment$1, + hasNakedLeftSide: hasNakedLeftSide$1, + hasNode: hasNode$1 +} = utils$6; + +function needsParens(path, options) { + const parent = path.getParentNode(); + + if (!parent) { + return false; + } + + const name = path.getName(); + const node = path.getNode(); // If the value of this path is some child of a Node and not a Node + // itself, then it doesn't need parentheses. Only Node objects (in + // fact, only Expression nodes) need parentheses. + + if (path.getValue() !== node) { + return false; + } // to avoid unexpected `}}` in HTML interpolations + + + if (options.__isInHtmlInterpolation && !options.bracketSpacing && endsWithRightBracket(node) && isFollowedByRightBracket(path)) { + return true; + } // Only statements don't need parentheses. + + + if (isStatement(node)) { + return false; + } + + if ( // Preserve parens if we have a Flow annotation comment, unless we're using the Flow + // parser. The Flow parser turns Flow comments into type annotation nodes in its + // AST, which we handle separately. + options.parser !== "flow" && hasFlowShorthandAnnotationComment$1(path.getValue())) { + return true; + } // Identifiers never need parentheses. + + + if (node.type === "Identifier") { + // ...unless those identifiers are embed placeholders. They might be substituted by complex + // expressions, so the parens around them should not be dropped. Example (JS-in-HTML-in-JS): + // let tpl = html``; + // If the inner JS formatter removes the parens, the expression might change its meaning: + // f((a + b) / 2) vs f(a + b / 2) + if (node.extra && node.extra.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(node.name)) { + return true; + } + + return false; + } + + if (parent.type === "ParenthesizedExpression") { + return false; + } // Add parens around the extends clause of a class. It is needed for almost + // all expressions. + + + if ((parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node && (node.type === "ArrowFunctionExpression" || node.type === "AssignmentExpression" || node.type === "AwaitExpression" || node.type === "BinaryExpression" || node.type === "ConditionalExpression" || node.type === "LogicalExpression" || node.type === "NewExpression" || node.type === "ObjectExpression" || node.type === "ParenthesizedExpression" || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "UnaryExpression" || node.type === "UpdateExpression" || node.type === "YieldExpression")) { + return true; + } + + if (parent.type === "ExportDefaultDeclaration") { + return (// `export default function` or `export default class` can't be followed by + // anything after. So an expression like `export default (function(){}).toString()` + // needs to be followed by a parentheses + shouldWrapFunctionForExportDefault(path, options) || // `export default (foo, bar)` also needs parentheses + node.type === "SequenceExpression" + ); + } + + if (parent.type === "Decorator" && parent.expression === node) { + let hasCallExpression = false; + let hasMemberExpression = false; + let current = node; + + while (current) { + switch (current.type) { + case "MemberExpression": + hasMemberExpression = true; + current = current.object; + break; + + case "CallExpression": + if ( + /** @(x().y) */ + hasMemberExpression || + /** @(x().y()) */ + hasCallExpression) { + return true; + } + + hasCallExpression = true; + current = current.callee; + break; + + case "Identifier": + return false; + + default: + return true; + } + } + + return true; + } + + if (parent.type === "ArrowFunctionExpression" && parent.body === node && node.type !== "SequenceExpression" && // these have parens added anyway + util$1.startsWithNoLookaheadToken(node, + /* forbidFunctionClassAndDoExpr */ + false) || parent.type === "ExpressionStatement" && util$1.startsWithNoLookaheadToken(node, + /* forbidFunctionClassAndDoExpr */ + true)) { + return true; + } + + switch (node.type) { + case "SpreadElement": + case "SpreadProperty": + return parent.type === "MemberExpression" && name === "object" && parent.object === node; + + case "UpdateExpression": + if (parent.type === "UnaryExpression") { + return node.prefix && (node.operator === "++" && parent.operator === "+" || node.operator === "--" && parent.operator === "-"); + } + + // else fallthrough + + case "UnaryExpression": + switch (parent.type) { + case "UnaryExpression": + return node.operator === parent.operator && (node.operator === "+" || node.operator === "-"); + + case "BindExpression": + return true; + + case "MemberExpression": + case "OptionalMemberExpression": + return name === "object"; + + case "TaggedTemplateExpression": + return true; + + case "NewExpression": + case "CallExpression": + case "OptionalCallExpression": + return name === "callee"; + + case "BinaryExpression": + return parent.operator === "**" && name === "left"; + + case "TSNonNullExpression": + return true; + + default: + return false; + } + + case "BinaryExpression": + { + if (parent.type === "UpdateExpression") { + return true; + } + + const isLeftOfAForStatement = node => { + let i = 0; + + while (node) { + const parent = path.getParentNode(i++); + + if (!parent) { + return false; + } + + if (parent.type === "ForStatement" && parent.init === node) { + return true; + } + + node = parent; + } + + return false; + }; + + if (node.operator === "in" && isLeftOfAForStatement(node)) { + return true; + } + } + // fallthrough + + case "TSTypeAssertion": + case "TSAsExpression": + case "LogicalExpression": + switch (parent.type) { + case "ConditionalExpression": + return node.type === "TSAsExpression"; + + case "CallExpression": + case "NewExpression": + case "OptionalCallExpression": + return name === "callee"; + + case "ClassExpression": + case "ClassDeclaration": + return name === "superClass" && parent.superClass === node; + + case "TSTypeAssertion": + case "TaggedTemplateExpression": + case "UnaryExpression": + case "JSXSpreadAttribute": + case "SpreadElement": + case "SpreadProperty": + case "BindExpression": + case "AwaitExpression": + case "TSAsExpression": + case "TSNonNullExpression": + case "UpdateExpression": + return true; + + case "MemberExpression": + case "OptionalMemberExpression": + return name === "object"; + + case "AssignmentExpression": + return parent.left === node && (node.type === "TSTypeAssertion" || node.type === "TSAsExpression"); + + case "LogicalExpression": + if (node.type === "LogicalExpression") { + return parent.operator !== node.operator; + } + + // else fallthrough + + case "BinaryExpression": + { + if (!node.operator && node.type !== "TSTypeAssertion") { + return true; + } + + const po = parent.operator; + const pp = util$1.getPrecedence(po); + const no = node.operator; + const np = util$1.getPrecedence(no); + + if (pp > np) { + return true; + } + + if (pp === np && name === "right") { + assert$1.strictEqual(parent.right, node); + return true; + } + + if (pp === np && !util$1.shouldFlatten(po, no)) { + return true; + } + + if (pp < np && no === "%") { + return po === "+" || po === "-"; + } // Add parenthesis when working with bitwise operators + // It's not strictly needed but helps with code understanding + + + if (util$1.isBitwiseOperator(po)) { + return true; + } + + return false; + } + + default: + return false; + } + + case "SequenceExpression": + switch (parent.type) { + case "ReturnStatement": + return false; + + case "ForStatement": + // Although parentheses wouldn't hurt around sequence + // expressions in the head of for loops, traditional style + // dictates that e.g. i++, j++ should not be wrapped with + // parentheses. + return false; + + case "ExpressionStatement": + return name !== "expression"; + + case "ArrowFunctionExpression": + // We do need parentheses, but SequenceExpressions are handled + // specially when printing bodies of arrow functions. + return name !== "body"; + + default: + // Otherwise err on the side of overparenthesization, adding + // explicit exceptions above if this proves overzealous. + return true; + } + + case "YieldExpression": + if (parent.type === "UnaryExpression" || parent.type === "AwaitExpression" || parent.type === "TSAsExpression" || parent.type === "TSNonNullExpression") { + return true; + } + + // else fallthrough + + case "AwaitExpression": + switch (parent.type) { + case "TaggedTemplateExpression": + case "UnaryExpression": + case "BinaryExpression": + case "LogicalExpression": + case "SpreadElement": + case "SpreadProperty": + case "TSAsExpression": + case "TSNonNullExpression": + case "BindExpression": + return true; + + case "MemberExpression": + case "OptionalMemberExpression": + return name === "object"; + + case "NewExpression": + case "CallExpression": + case "OptionalCallExpression": + return name === "callee"; + + case "ConditionalExpression": + return parent.test === node; + + default: + return false; + } + + case "TSJSDocFunctionType": + case "TSConditionalType": + if (parent.type === "TSConditionalType" && node === parent.extendsType) { + return true; + } + + // fallthrough + + case "TSFunctionType": + case "TSConstructorType": + if (parent.type === "TSConditionalType" && node === parent.checkType) { + return true; + } + + // fallthrough + + case "TSUnionType": + case "TSIntersectionType": + if (parent.type === "TSUnionType" || parent.type === "TSIntersectionType") { + return true; + } + + // fallthrough + + case "TSTypeOperator": + case "TSInferType": + return parent.type === "TSArrayType" || parent.type === "TSOptionalType" || parent.type === "TSRestType" || parent.type === "TSIndexedAccessType" && node === parent.objectType || parent.type === "TSTypeOperator" || parent.type === "TSTypeAnnotation" && /^TSJSDoc/.test(path.getParentNode(1).type); + + case "ArrayTypeAnnotation": + return parent.type === "NullableTypeAnnotation"; + + case "IntersectionTypeAnnotation": + case "UnionTypeAnnotation": + return parent.type === "ArrayTypeAnnotation" || parent.type === "NullableTypeAnnotation" || parent.type === "IntersectionTypeAnnotation" || parent.type === "UnionTypeAnnotation"; + + case "NullableTypeAnnotation": + return parent.type === "ArrayTypeAnnotation"; + + case "FunctionTypeAnnotation": + { + const ancestor = parent.type === "NullableTypeAnnotation" ? path.getParentNode(1) : parent; + return ancestor.type === "UnionTypeAnnotation" || ancestor.type === "IntersectionTypeAnnotation" || ancestor.type === "ArrayTypeAnnotation" || // We should check ancestor's parent to know whether the parentheses + // are really needed, but since ??T doesn't make sense this check + // will almost never be true. + ancestor.type === "NullableTypeAnnotation"; + } + + case "StringLiteral": + case "NumericLiteral": + case "Literal": + if (typeof node.value === "string" && parent.type === "ExpressionStatement" && ( // TypeScript workaround for https://github.com/JamesHenry/typescript-estree/issues/2 + // See corresponding workaround in printer.js case: "Literal" + options.parser !== "typescript" && !parent.directive || options.parser === "typescript" && options.originalText.charAt(options.locStart(node) - 1) === "(")) { + // To avoid becoming a directive + const grandParent = path.getParentNode(1); + return grandParent.type === "Program" || grandParent.type === "BlockStatement"; + } + + return parent.type === "MemberExpression" && typeof node.value === "number" && name === "object" && parent.object === node; + + case "AssignmentExpression": + { + const grandParent = path.getParentNode(1); + + if (parent.type === "ArrowFunctionExpression" && parent.body === node) { + return true; + } else if (parent.type === "ClassProperty" && parent.key === node && parent.computed) { + return false; + } else if (parent.type === "TSPropertySignature" && parent.name === node) { + return false; + } else if (parent.type === "ForStatement" && (parent.init === node || parent.update === node)) { + return false; + } else if (parent.type === "ExpressionStatement") { + return node.left.type === "ObjectPattern"; + } else if (parent.type === "TSPropertySignature" && parent.key === node) { + return false; + } else if (parent.type === "AssignmentExpression") { + return false; + } else if (parent.type === "SequenceExpression" && grandParent && grandParent.type === "ForStatement" && (grandParent.init === parent || grandParent.update === parent)) { + return false; + } else if (parent.type === "Property" && parent.value === node) { + return false; + } else if (parent.type === "NGChainedExpression") { + return false; + } + + return true; + } + + case "ConditionalExpression": + switch (parent.type) { + case "TaggedTemplateExpression": + case "UnaryExpression": + case "SpreadElement": + case "SpreadProperty": + case "BinaryExpression": + case "LogicalExpression": + case "NGPipeExpression": + case "ExportDefaultDeclaration": + case "AwaitExpression": + case "JSXSpreadAttribute": + case "TSTypeAssertion": + case "TypeCastExpression": + case "TSAsExpression": + case "TSNonNullExpression": + return true; + + case "NewExpression": + case "CallExpression": + case "OptionalCallExpression": + return name === "callee"; + + case "ConditionalExpression": + return name === "test" && parent.test === node; + + case "MemberExpression": + case "OptionalMemberExpression": + return name === "object"; + + default: + return false; + } + + case "FunctionExpression": + switch (parent.type) { + case "NewExpression": + case "CallExpression": + case "OptionalCallExpression": + // Not always necessary, but it's clearer to the reader if IIFEs are wrapped in parentheses. + // Is necessary if it is `expression` of `ExpressionStatement`. + return name === "callee"; + + case "TaggedTemplateExpression": + return true; + // This is basically a kind of IIFE. + + default: + return false; + } + + case "ArrowFunctionExpression": + switch (parent.type) { + case "NewExpression": + case "CallExpression": + case "OptionalCallExpression": + return name === "callee"; + + case "MemberExpression": + case "OptionalMemberExpression": + return name === "object"; + + case "TSAsExpression": + case "BindExpression": + case "TaggedTemplateExpression": + case "UnaryExpression": + case "LogicalExpression": + case "BinaryExpression": + case "AwaitExpression": + case "TSTypeAssertion": + return true; + + case "ConditionalExpression": + return name === "test"; + + default: + return false; + } + + case "ClassExpression": + switch (parent.type) { + case "NewExpression": + return name === "callee" && parent.callee === node; + + default: + return false; + } + + case "OptionalMemberExpression": + case "OptionalCallExpression": + if (parent.type === "MemberExpression" && name === "object" || (parent.type === "CallExpression" || parent.type === "NewExpression") && name === "callee") { + return true; + } + + // fallthrough + + case "CallExpression": + case "MemberExpression": + case "TaggedTemplateExpression": + case "TSNonNullExpression": + if ((parent.type === "BindExpression" || parent.type === "NewExpression") && name === "callee") { + let object = node; + + while (object) { + switch (object.type) { + case "CallExpression": + case "OptionalCallExpression": + return true; + + case "MemberExpression": + case "OptionalMemberExpression": + case "BindExpression": + object = object.object; + break; + // tagged templates are basically member expressions from a grammar perspective + // see https://tc39.github.io/ecma262/#prod-MemberExpression + + case "TaggedTemplateExpression": + object = object.tag; + break; + + case "TSNonNullExpression": + object = object.expression; + break; + + default: + return false; + } + } + } + + return false; + + case "BindExpression": + return (parent.type === "BindExpression" || parent.type === "NewExpression") && name === "callee" || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && name === "object"; + + case "NGPipeExpression": + if (parent.type === "NGRoot" || parent.type === "NGMicrosyntaxExpression" || parent.type === "ObjectProperty" || parent.type === "ArrayExpression" || (parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.arguments[name] === node || parent.type === "NGPipeExpression" && name === "right" || parent.type === "MemberExpression" && name === "property" || parent.type === "AssignmentExpression") { + return false; + } + + return true; + + case "JSXFragment": + case "JSXElement": + return name === "callee" || parent.type !== "ArrayExpression" && parent.type !== "ArrowFunctionExpression" && parent.type !== "AssignmentExpression" && parent.type !== "AssignmentPattern" && parent.type !== "BinaryExpression" && parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "ConditionalExpression" && parent.type !== "ExpressionStatement" && parent.type !== "JsExpressionRoot" && parent.type !== "JSXAttribute" && parent.type !== "JSXElement" && parent.type !== "JSXExpressionContainer" && parent.type !== "JSXFragment" && parent.type !== "LogicalExpression" && parent.type !== "ObjectProperty" && parent.type !== "OptionalCallExpression" && parent.type !== "Property" && parent.type !== "ReturnStatement" && parent.type !== "ThrowStatement" && parent.type !== "TypeCastExpression" && parent.type !== "VariableDeclarator" && parent.type !== "YieldExpression"; + + case "TypeAnnotation": + return name === "returnType" && parent.type === "ArrowFunctionExpression" && includesFunctionTypeInObjectType(node); + } + + return false; +} + +function isStatement(node) { + return node.type === "BlockStatement" || node.type === "BreakStatement" || node.type === "ClassBody" || node.type === "ClassDeclaration" || node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "ClassPrivateProperty" || node.type === "ContinueStatement" || node.type === "DebuggerStatement" || node.type === "DeclareClass" || node.type === "DeclareExportAllDeclaration" || node.type === "DeclareExportDeclaration" || node.type === "DeclareFunction" || node.type === "DeclareInterface" || node.type === "DeclareModule" || node.type === "DeclareModuleExports" || node.type === "DeclareVariable" || node.type === "DoWhileStatement" || node.type === "EnumDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportDefaultDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExpressionStatement" || node.type === "ForInStatement" || node.type === "ForOfStatement" || node.type === "ForStatement" || node.type === "FunctionDeclaration" || node.type === "IfStatement" || node.type === "ImportDeclaration" || node.type === "InterfaceDeclaration" || node.type === "LabeledStatement" || node.type === "MethodDefinition" || node.type === "ReturnStatement" || node.type === "SwitchStatement" || node.type === "ThrowStatement" || node.type === "TryStatement" || node.type === "TSDeclareFunction" || node.type === "TSEnumDeclaration" || node.type === "TSImportEqualsDeclaration" || node.type === "TSInterfaceDeclaration" || node.type === "TSModuleDeclaration" || node.type === "TSNamespaceExportDeclaration" || node.type === "TypeAlias" || node.type === "VariableDeclaration" || node.type === "WhileStatement" || node.type === "WithStatement"; +} + +function includesFunctionTypeInObjectType(node) { + return hasNode$1(node, n1 => n1.type === "ObjectTypeAnnotation" && hasNode$1(n1, n2 => n2.type === "FunctionTypeAnnotation" || undefined) || undefined); +} + +function endsWithRightBracket(node) { + switch (node.type) { + case "ObjectExpression": + return true; + + default: + return false; + } +} + +function isFollowedByRightBracket(path) { + const node = path.getValue(); + const parent = path.getParentNode(); + const name = path.getName(); + + switch (parent.type) { + case "NGPipeExpression": + if (typeof name === "number" && parent.arguments[name] === node && parent.arguments.length - 1 === name) { + return path.callParent(isFollowedByRightBracket); + } + + break; + + case "ObjectProperty": + if (name === "value") { + const parentParent = path.getParentNode(1); + return parentParent.properties[parentParent.properties.length - 1] === parent; + } + + break; + + case "BinaryExpression": + case "LogicalExpression": + if (name === "right") { + return path.callParent(isFollowedByRightBracket); + } + + break; + + case "ConditionalExpression": + if (name === "alternate") { + return path.callParent(isFollowedByRightBracket); + } + + break; + + case "UnaryExpression": + if (parent.prefix) { + return path.callParent(isFollowedByRightBracket); + } + + break; + } + + return false; +} + +function shouldWrapFunctionForExportDefault(path, options) { + const node = path.getValue(); + const parent = path.getParentNode(); + + if (node.type === "FunctionExpression" || node.type === "ClassExpression") { + return parent.type === "ExportDefaultDeclaration" || // in some cases the function is already wrapped + // (e.g. `export default (function() {})();`) + // in this case we don't need to add extra parens + !needsParens(path, options); + } + + if (!hasNakedLeftSide$1(node) || parent.type !== "ExportDefaultDeclaration" && needsParens(path, options)) { + return false; + } + + return path.call(childPath => shouldWrapFunctionForExportDefault(childPath, options), ...getLeftSidePathName$1(path, node)); +} + +var needsParens_1 = needsParens; + +const { + builders: { + concat: concat$5, + join: join$3, + line: line$3 + } +} = document; + +function printHtmlBinding(path, options, print) { + const node = path.getValue(); + + if (options.__onHtmlBindingRoot && path.getName() === null) { + options.__onHtmlBindingRoot(node, options); + } + + if (node.type !== "File") { + return; + } + + if (options.__isVueForBindingLeft) { + return path.call(functionDeclarationPath => { + const { + params + } = functionDeclarationPath.getValue(); + return concat$5([params.length > 1 ? "(" : "", join$3(concat$5([",", line$3]), functionDeclarationPath.map(print, "params")), params.length > 1 ? ")" : ""]); + }, "program", "body", 0); + } + + if (options.__isVueSlotScope) { + return path.call(functionDeclarationPath => join$3(concat$5([",", line$3]), functionDeclarationPath.map(print, "params")), "program", "body", 0); + } +} // based on https://github.com/prettier/prettier/blob/master/src/language-html/syntax-vue.js isVueEventBindingExpression() + + +function isVueEventBindingExpression(node) { + switch (node.type) { + case "MemberExpression": + switch (node.property.type) { + case "Identifier": + case "NumericLiteral": + case "StringLiteral": + return isVueEventBindingExpression(node.object); + } + + return false; + + case "Identifier": + return true; + + default: + return false; + } +} + +var htmlBinding = { + isVueEventBindingExpression, + printHtmlBinding +}; + +function preprocess(ast, options) { + switch (options.parser) { + case "json": + case "json5": + case "json-stringify": + case "__js_expression": + case "__vue_expression": + return Object.assign({}, ast, { + type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot", + node: ast, + comments: [], + rootMarker: options.rootMarker + }); + + default: + return ast; + } +} + +var preprocess_1 = preprocess; + +const { + shouldFlatten: shouldFlatten$1, + getNextNonSpaceNonCommentCharacter: getNextNonSpaceNonCommentCharacter$1, + hasNewline: hasNewline$4, + hasNewlineInRange: hasNewlineInRange$3, + getLast: getLast$2, + getStringWidth: getStringWidth$3, + printString: printString$1, + printNumber: printNumber$1, + hasIgnoreComment: hasIgnoreComment$2, + hasNodeIgnoreComment: hasNodeIgnoreComment$2, + getPenultimate: getPenultimate$1, + startsWithNoLookaheadToken: startsWithNoLookaheadToken$1, + getIndentSize: getIndentSize$2, + getPreferredQuote: getPreferredQuote$1 +} = util$1; +const { + isNextLineEmpty: isNextLineEmpty$2, + isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$2, + getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$3 +} = utilShared; +const { + insertPragma: insertPragma$1 +} = pragma; +const { + printHtmlBinding: printHtmlBinding$1, + isVueEventBindingExpression: isVueEventBindingExpression$1 +} = htmlBinding; +const { + classChildNeedsASIProtection: classChildNeedsASIProtection$1, + classPropMayCauseASIProblems: classPropMayCauseASIProblems$1, + conditionalExpressionChainContainsJSX: conditionalExpressionChainContainsJSX$1, + getFlowVariance: getFlowVariance$1, + getLeftSidePathName: getLeftSidePathName$2, + getParentExportDeclaration: getParentExportDeclaration$1, + getTypeScriptMappedTypeModifier: getTypeScriptMappedTypeModifier$1, + hasDanglingComments: hasDanglingComments$1, + hasFlowAnnotationComment: hasFlowAnnotationComment$1, + hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment$2, + hasLeadingComment: hasLeadingComment$3, + hasLeadingOwnLineComment: hasLeadingOwnLineComment$1, + hasNakedLeftSide: hasNakedLeftSide$2, + hasNewlineBetweenOrAfterDecorators: hasNewlineBetweenOrAfterDecorators$1, + hasNgSideEffect: hasNgSideEffect$1, + hasPrettierIgnore: hasPrettierIgnore$1, + hasTrailingComment: hasTrailingComment$1, + identity: identity$2, + isBinaryish: isBinaryish$1, + isCallOrOptionalCallExpression: isCallOrOptionalCallExpression$1, + isEmptyJSXElement: isEmptyJSXElement$1, + isExportDeclaration: isExportDeclaration$1, + isFlowAnnotationComment: isFlowAnnotationComment$1, + isFunctionCompositionArgs: isFunctionCompositionArgs$1, + isFunctionNotation: isFunctionNotation$1, + isFunctionOrArrowExpression: isFunctionOrArrowExpression$1, + isGetterOrSetter: isGetterOrSetter$1, + isJestEachTemplateLiteral: isJestEachTemplateLiteral$1, + isJSXNode: isJSXNode$1, + isJSXWhitespaceExpression: isJSXWhitespaceExpression$1, + isLastStatement: isLastStatement$1, + isLiteral: isLiteral$1, + isLongCurriedCallExpression: isLongCurriedCallExpression$1, + isMeaningfulJSXText: isMeaningfulJSXText$1, + isMemberExpressionChain: isMemberExpressionChain$1, + isMemberish: isMemberish$1, + isNgForOf: isNgForOf$1, + isNumericLiteral: isNumericLiteral$1, + isObjectType: isObjectType$1, + isObjectTypePropertyAFunction: isObjectTypePropertyAFunction$1, + isSimpleCallArgument: isSimpleCallArgument$1, + isSimpleFlowType: isSimpleFlowType$1, + isSimpleTemplateLiteral: isSimpleTemplateLiteral$1, + isStringLiteral: isStringLiteral$1, + isStringPropSafeToCoerceToIdentifier: isStringPropSafeToCoerceToIdentifier$1, + isTemplateOnItsOwnLine: isTemplateOnItsOwnLine$1, + isTestCall: isTestCall$1, + isTheOnlyJSXElementInMarkdown: isTheOnlyJSXElementInMarkdown$1, + isTSXFile: isTSXFile$1, + isTypeAnnotationAFunction: isTypeAnnotationAFunction$1, + matchJsxWhitespaceRegex: matchJsxWhitespaceRegex$1, + needsHardlineAfterDanglingComment: needsHardlineAfterDanglingComment$1, + rawText: rawText$1, + returnArgumentHasLeadingComment: returnArgumentHasLeadingComment$1 +} = utils$6; +const needsQuoteProps = new WeakMap(); +const { + builders: { + concat: concat$6, + join: join$4, + line: line$4, + hardline: hardline$4, + softline: softline$2, + literalline: literalline$2, + group: group$2, + indent: indent$3, + align: align$1, + conditionalGroup: conditionalGroup$1, + fill: fill$3, + ifBreak: ifBreak$1, + breakParent: breakParent$2, + lineSuffixBoundary: lineSuffixBoundary$1, + addAlignmentToDoc: addAlignmentToDoc$2, + dedent: dedent$1 + }, + utils: { + willBreak: willBreak$1, + isLineNext: isLineNext$1, + isEmpty: isEmpty$1, + removeLines: removeLines$1 + }, + printer: { + printDocToString: printDocToString$2 + } +} = document; +let uid = 0; + +function shouldPrintComma(options, level) { + level = level || "es5"; + + switch (options.trailingComma) { + case "all": + if (level === "all") { + return true; + } + + // fallthrough + + case "es5": + if (level === "es5") { + return true; + } + + // fallthrough + + case "none": + default: + return false; + } +} + +function genericPrint(path, options, printPath, args) { + const node = path.getValue(); + let needsParens = false; + const linesWithoutParens = printPathNoParens(path, options, printPath, args); + + if (!node || isEmpty$1(linesWithoutParens)) { + return linesWithoutParens; + } + + const parentExportDecl = getParentExportDeclaration$1(path); + const decorators = []; + + if (node.type === "ClassMethod" || node.type === "ClassPrivateMethod" || node.type === "ClassProperty" || node.type === "TSAbstractClassProperty" || node.type === "ClassPrivateProperty" || node.type === "MethodDefinition" || node.type === "TSAbstractMethodDefinition" || node.type === "TSDeclareMethod") ; else if (node.decorators && node.decorators.length > 0 && // If the parent node is an export declaration and the decorator + // was written before the export, the export will be responsible + // for printing the decorators. + !(parentExportDecl && options.locStart(parentExportDecl, { + ignoreDecorators: true + }) > options.locStart(node.decorators[0]))) { + const shouldBreak = node.type === "ClassExpression" || node.type === "ClassDeclaration" || hasNewlineBetweenOrAfterDecorators$1(node, options); + const separator = shouldBreak ? hardline$4 : line$4; + path.each(decoratorPath => { + let decorator = decoratorPath.getValue(); + + if (decorator.expression) { + decorator = decorator.expression; + } else { + decorator = decorator.callee; + } + + decorators.push(printPath(decoratorPath), separator); + }, "decorators"); + + if (parentExportDecl) { + decorators.unshift(hardline$4); + } + } else if (isExportDeclaration$1(node) && node.declaration && node.declaration.decorators && node.declaration.decorators.length > 0 && // Only print decorators here if they were written before the export, + // otherwise they are printed by the node.declaration + options.locStart(node, { + ignoreDecorators: true + }) > options.locStart(node.declaration.decorators[0])) { + // Export declarations are responsible for printing any decorators + // that logically apply to node.declaration. + path.each(decoratorPath => { + const decorator = decoratorPath.getValue(); + const prefix = decorator.type === "Decorator" ? "" : "@"; + decorators.push(prefix, printPath(decoratorPath), hardline$4); + }, "declaration", "decorators"); + } else { + // Nodes with decorators can't have parentheses, so we can avoid + // computing pathNeedsParens() except in this case. + needsParens = needsParens_1(path, options); + } + + const parts = []; + + if (needsParens) { + parts.unshift("("); + } + + parts.push(linesWithoutParens); + + if (needsParens) { + const node = path.getValue(); + + if (hasFlowShorthandAnnotationComment$2(node)) { + parts.push(" /*"); + parts.push(node.trailingComments[0].value.trimStart()); + parts.push("*/"); + node.trailingComments[0].printed = true; + } + + parts.push(")"); + } + + if (decorators.length > 0) { + return group$2(concat$6(decorators.concat(parts))); + } + + return concat$6(parts); +} + +function printDecorators(path, options, print) { + const node = path.getValue(); + return group$2(concat$6([join$4(line$4, path.map(print, "decorators")), hasNewlineBetweenOrAfterDecorators$1(node, options) ? hardline$4 : line$4])); +} +/** + * The following is the shared logic for + * ternary operators, namely ConditionalExpression + * and TSConditionalType + * @typedef {Object} OperatorOptions + * @property {() => Array} beforeParts - Parts to print before the `?`. + * @property {(breakClosingParen: boolean) => Array} afterParts - Parts to print after the conditional expression. + * @property {boolean} shouldCheckJsx - Whether to check for and print in JSX mode. + * @property {string} conditionalNodeType - The type of the conditional expression node, ie "ConditionalExpression" or "TSConditionalType". + * @property {string} consequentNodePropertyName - The property at which the consequent node can be found on the main node, eg "consequent". + * @property {string} alternateNodePropertyName - The property at which the alternate node can be found on the main node, eg "alternate". + * @property {string[]} testNodePropertyNames - The properties at which the test nodes can be found on the main node, eg "test". + * @param {FastPath} path - The path to the ConditionalExpression/TSConditionalType node. + * @param {Options} options - Prettier options + * @param {Function} print - Print function to call recursively + * @param {OperatorOptions} operatorOptions + * @returns Doc + */ + + +function printTernaryOperator(path, options, print, operatorOptions) { + const node = path.getValue(); + const consequentNode = node[operatorOptions.consequentNodePropertyName]; + const alternateNode = node[operatorOptions.alternateNodePropertyName]; + const parts = []; // We print a ConditionalExpression in either "JSX mode" or "normal mode". + // See tests/jsx/conditional-expression.js for more info. + + let jsxMode = false; + const parent = path.getParentNode(); + const isParentTest = parent.type === operatorOptions.conditionalNodeType && operatorOptions.testNodePropertyNames.some(prop => parent[prop] === node); + let forceNoIndent = parent.type === operatorOptions.conditionalNodeType && !isParentTest; // Find the outermost non-ConditionalExpression parent, and the outermost + // ConditionalExpression parent. We'll use these to determine if we should + // print in JSX mode. + + let currentParent; + let previousParent; + let i = 0; + + do { + previousParent = currentParent || node; + currentParent = path.getParentNode(i); + i++; + } while (currentParent && currentParent.type === operatorOptions.conditionalNodeType && operatorOptions.testNodePropertyNames.every(prop => currentParent[prop] !== previousParent)); + + const firstNonConditionalParent = currentParent || parent; + const lastConditionalParent = previousParent; + + if (operatorOptions.shouldCheckJsx && (isJSXNode$1(node[operatorOptions.testNodePropertyNames[0]]) || isJSXNode$1(consequentNode) || isJSXNode$1(alternateNode) || conditionalExpressionChainContainsJSX$1(lastConditionalParent))) { + jsxMode = true; + forceNoIndent = true; // Even though they don't need parens, we wrap (almost) everything in + // parens when using ?: within JSX, because the parens are analogous to + // curly braces in an if statement. + + const wrap = doc => concat$6([ifBreak$1("(", ""), indent$3(concat$6([softline$2, doc])), softline$2, ifBreak$1(")", "")]); // The only things we don't wrap are: + // * Nested conditional expressions in alternates + // * null + // * undefined + + + const isNil = node => node.type === "NullLiteral" || node.type === "Literal" && node.value === null || node.type === "Identifier" && node.name === "undefined"; + + parts.push(" ? ", isNil(consequentNode) ? path.call(print, operatorOptions.consequentNodePropertyName) : wrap(path.call(print, operatorOptions.consequentNodePropertyName)), " : ", alternateNode.type === operatorOptions.conditionalNodeType || isNil(alternateNode) ? path.call(print, operatorOptions.alternateNodePropertyName) : wrap(path.call(print, operatorOptions.alternateNodePropertyName))); + } else { + // normal mode + const part = concat$6([line$4, "? ", consequentNode.type === operatorOptions.conditionalNodeType ? ifBreak$1("", "(") : "", align$1(2, path.call(print, operatorOptions.consequentNodePropertyName)), consequentNode.type === operatorOptions.conditionalNodeType ? ifBreak$1("", ")") : "", line$4, ": ", alternateNode.type === operatorOptions.conditionalNodeType ? path.call(print, operatorOptions.alternateNodePropertyName) : align$1(2, path.call(print, operatorOptions.alternateNodePropertyName))]); + parts.push(parent.type !== operatorOptions.conditionalNodeType || parent[operatorOptions.alternateNodePropertyName] === node || isParentTest ? part : options.useTabs ? dedent$1(indent$3(part)) : align$1(Math.max(0, options.tabWidth - 2), part)); + } // We want a whole chain of ConditionalExpressions to all + // break if any of them break. That means we should only group around the + // outer-most ConditionalExpression. + + + const maybeGroup = doc => parent === firstNonConditionalParent ? group$2(doc) : doc; // Break the closing paren to keep the chain right after it: + // (a + // ? b + // : c + // ).call() + + + const breakClosingParen = !jsxMode && (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression" || parent.type === "NGPipeExpression" && parent.left === node) && !parent.computed; + const result = maybeGroup(concat$6([].concat((testDoc => + /** + * a + * ? b + * : multiline + * test + * node + * ^^ align(2) + * ? d + * : e + */ + parent.type === operatorOptions.conditionalNodeType && parent[operatorOptions.alternateNodePropertyName] === node ? align$1(2, testDoc) : testDoc)(concat$6(operatorOptions.beforeParts())), forceNoIndent ? concat$6(parts) : indent$3(concat$6(parts)), operatorOptions.afterParts(breakClosingParen)))); + return isParentTest ? group$2(concat$6([indent$3(concat$6([softline$2, result])), softline$2])) : result; +} + +function printPathNoParens(path, options, print, args) { + const n = path.getValue(); + const semi = options.semi ? ";" : ""; + + if (!n) { + return ""; + } + + if (typeof n === "string") { + return n; + } + + const htmlBinding = printHtmlBinding$1(path, options, print); + + if (htmlBinding) { + return htmlBinding; + } + + let parts = []; + + switch (n.type) { + case "JsExpressionRoot": + return path.call(print, "node"); + + case "JsonRoot": + return concat$6([path.call(print, "node"), hardline$4]); + + case "File": + // Print @babel/parser's InterpreterDirective here so that + // leading comments on the `Program` node get printed after the hashbang. + if (n.program && n.program.interpreter) { + parts.push(path.call(programPath => programPath.call(print, "interpreter"), "program")); + } + + parts.push(path.call(print, "program")); + return concat$6(parts); + + case "Program": + // Babel 6 + if (n.directives) { + path.each(childPath => { + parts.push(print(childPath), semi, hardline$4); + + if (isNextLineEmpty$2(options.originalText, childPath.getValue(), options.locEnd)) { + parts.push(hardline$4); + } + }, "directives"); + } + + parts.push(path.call(bodyPath => { + return printStatementSequence(bodyPath, options, print); + }, "body")); + parts.push(comments.printDanglingComments(path, options, + /* sameIndent */ + true)); // Only force a trailing newline if there were any contents. + + if (!n.body.every(({ + type + }) => type === "EmptyStatement") || n.comments) { + parts.push(hardline$4); + } + + return concat$6(parts); + // Babel extension. + + case "EmptyStatement": + return ""; + + case "ExpressionStatement": + // Detect Flow-parsed directives + if (n.directive) { + return concat$6([nodeStr(n.expression, options, true), semi]); + } + + if (options.parser === "__vue_event_binding") { + const parent = path.getParentNode(); + + if (parent.type === "Program" && parent.body.length === 1 && parent.body[0] === n) { + return concat$6([path.call(print, "expression"), isVueEventBindingExpression$1(n.expression) ? ";" : ""]); + } + } // Do not append semicolon after the only JSX element in a program + + + return concat$6([path.call(print, "expression"), isTheOnlyJSXElementInMarkdown$1(options, path) ? "" : semi]); + // Babel non-standard node. Used for Closure-style type casts. See postprocess.js. + + case "ParenthesizedExpression": + { + const shouldHug = !n.expression.comments; + + if (shouldHug) { + return concat$6(["(", path.call(print, "expression"), ")"]); + } + + return group$2(concat$6(["(", indent$3(concat$6([softline$2, path.call(print, "expression")])), softline$2, ")"])); + } + + case "AssignmentExpression": + return printAssignment(n.left, path.call(print, "left"), concat$6([" ", n.operator]), n.right, path.call(print, "right"), options); + + case "BinaryExpression": + case "LogicalExpression": + case "NGPipeExpression": + { + const parent = path.getParentNode(); + const parentParent = path.getParentNode(1); + const isInsideParenthesis = n !== parent.body && (parent.type === "IfStatement" || parent.type === "WhileStatement" || parent.type === "SwitchStatement" || parent.type === "DoWhileStatement"); + const parts = printBinaryishExpressions(path, print, options, + /* isNested */ + false, isInsideParenthesis); // if ( + // this.hasPlugin("dynamicImports") && this.lookahead().type === tt.parenLeft + // ) { + // + // looks super weird, we want to break the children if the parent breaks + // + // if ( + // this.hasPlugin("dynamicImports") && + // this.lookahead().type === tt.parenLeft + // ) { + + if (isInsideParenthesis) { + return concat$6(parts); + } // Break between the parens in + // unaries or in a member or specific call expression, i.e. + // + // ( + // a && + // b && + // c + // ).call() + + + if ((parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.callee === n || parent.type === "UnaryExpression" || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && !parent.computed) { + return group$2(concat$6([indent$3(concat$6([softline$2, concat$6(parts)])), softline$2])); + } // Avoid indenting sub-expressions in some cases where the first sub-expression is already + // indented accordingly. We should indent sub-expressions where the first case isn't indented. + + + const shouldNotIndent = parent.type === "ReturnStatement" || parent.type === "ThrowStatement" || parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" || n.operator !== "|" && parent.type === "JsExpressionRoot" || n.type !== "NGPipeExpression" && (parent.type === "NGRoot" && options.parser === "__ng_binding" || parent.type === "NGMicrosyntaxExpression" && parentParent.type === "NGMicrosyntax" && parentParent.body.length === 1) || n === parent.body && parent.type === "ArrowFunctionExpression" || n !== parent.body && parent.type === "ForStatement" || parent.type === "ConditionalExpression" && parentParent.type !== "ReturnStatement" && parentParent.type !== "ThrowStatement" && parentParent.type !== "CallExpression" && parentParent.type !== "OptionalCallExpression" || parent.type === "TemplateLiteral"; + const shouldIndentIfInlining = parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator" || parent.type === "ClassProperty" || parent.type === "TSAbstractClassProperty" || parent.type === "ClassPrivateProperty" || parent.type === "ObjectProperty" || parent.type === "Property"; + const samePrecedenceSubExpression = isBinaryish$1(n.left) && shouldFlatten$1(n.operator, n.left.operator); + + if (shouldNotIndent || shouldInlineLogicalExpression(n) && !samePrecedenceSubExpression || !shouldInlineLogicalExpression(n) && shouldIndentIfInlining) { + return group$2(concat$6(parts)); + } + + if (parts.length === 0) { + return ""; + } // If the right part is a JSX node, we include it in a separate group to + // prevent it breaking the whole chain, so we can print the expression like: + // + // foo && bar && ( + // + // + // + // ) + + + const hasJSX = isJSXNode$1(n.right); + const rest = concat$6(hasJSX ? parts.slice(1, -1) : parts.slice(1)); + const groupId = Symbol("logicalChain-" + ++uid); + const chain = group$2(concat$6([// Don't include the initial expression in the indentation + // level. The first item is guaranteed to be the first + // left-most expression. + parts.length > 0 ? parts[0] : "", indent$3(rest)]), { + id: groupId + }); + + if (!hasJSX) { + return chain; + } + + const jsxPart = getLast$2(parts); + return group$2(concat$6([chain, ifBreak$1(indent$3(jsxPart), jsxPart, { + groupId + })])); + } + + case "AssignmentPattern": + return concat$6([path.call(print, "left"), " = ", path.call(print, "right")]); + + case "TSTypeAssertion": + { + const shouldBreakAfterCast = !(n.expression.type === "ArrayExpression" || n.expression.type === "ObjectExpression"); + const castGroup = group$2(concat$6(["<", indent$3(concat$6([softline$2, path.call(print, "typeAnnotation")])), softline$2, ">"])); + const exprContents = concat$6([ifBreak$1("("), indent$3(concat$6([softline$2, path.call(print, "expression")])), softline$2, ifBreak$1(")")]); + + if (shouldBreakAfterCast) { + return conditionalGroup$1([concat$6([castGroup, path.call(print, "expression")]), concat$6([castGroup, group$2(exprContents, { + shouldBreak: true + })]), concat$6([castGroup, path.call(print, "expression")])]); + } + + return group$2(concat$6([castGroup, path.call(print, "expression")])); + } + + case "OptionalMemberExpression": + case "MemberExpression": + { + const parent = path.getParentNode(); + let firstNonMemberParent; + let i = 0; + + do { + firstNonMemberParent = path.getParentNode(i); + i++; + } while (firstNonMemberParent && (firstNonMemberParent.type === "MemberExpression" || firstNonMemberParent.type === "OptionalMemberExpression" || firstNonMemberParent.type === "TSNonNullExpression")); + + const shouldInline = firstNonMemberParent && (firstNonMemberParent.type === "NewExpression" || firstNonMemberParent.type === "BindExpression" || firstNonMemberParent.type === "VariableDeclarator" && firstNonMemberParent.id.type !== "Identifier" || firstNonMemberParent.type === "AssignmentExpression" && firstNonMemberParent.left.type !== "Identifier") || n.computed || n.object.type === "Identifier" && n.property.type === "Identifier" && parent.type !== "MemberExpression" && parent.type !== "OptionalMemberExpression"; + return concat$6([path.call(print, "object"), shouldInline ? printMemberLookup(path, options, print) : group$2(indent$3(concat$6([softline$2, printMemberLookup(path, options, print)])))]); + } + + case "MetaProperty": + return concat$6([path.call(print, "meta"), ".", path.call(print, "property")]); + + case "BindExpression": + if (n.object) { + parts.push(path.call(print, "object")); + } + + parts.push(group$2(indent$3(concat$6([softline$2, printBindExpressionCallee(path, options, print)])))); + return concat$6(parts); + + case "Identifier": + { + return concat$6([n.name, printOptionalToken(path), printTypeAnnotation(path, options, print)]); + } + + case "V8IntrinsicIdentifier": + return concat$6(["%", n.name]); + + case "SpreadElement": + case "SpreadElementPattern": + case "SpreadProperty": + case "SpreadPropertyPattern": + case "RestElement": + case "ObjectTypeSpreadProperty": + return concat$6(["...", path.call(print, "argument"), printTypeAnnotation(path, options, print)]); + + case "FunctionDeclaration": + case "FunctionExpression": + parts.push(printFunctionDeclaration(path, print, options)); + + if (!n.body) { + parts.push(semi); + } + + return concat$6(parts); + + case "ArrowFunctionExpression": + { + if (n.async) { + parts.push("async "); + } + + if (shouldPrintParamsWithoutParens(path, options)) { + parts.push(path.call(print, "params", 0)); + } else { + parts.push(group$2(concat$6([printFunctionParams(path, print, options, + /* expandLast */ + args && (args.expandLastArg || args.expandFirstArg), + /* printTypeParams */ + true), printReturnType(path, print, options)]))); + } + + const dangling = comments.printDanglingComments(path, options, + /* sameIndent */ + true, comment => { + const nextCharacter = getNextNonSpaceNonCommentCharacterIndex$3(options.originalText, comment, options.locEnd); + return options.originalText.slice(nextCharacter, nextCharacter + 2) === "=>"; + }); + + if (dangling) { + parts.push(" ", dangling); + } + + parts.push(" =>"); + const body = path.call(bodyPath => print(bodyPath, args), "body"); // We want to always keep these types of nodes on the same line + // as the arrow. + + if (!hasLeadingOwnLineComment$1(options.originalText, n.body, options) && (n.body.type === "ArrayExpression" || n.body.type === "ObjectExpression" || n.body.type === "BlockStatement" || isJSXNode$1(n.body) || isTemplateOnItsOwnLine$1(n.body, options.originalText, options) || n.body.type === "ArrowFunctionExpression" || n.body.type === "DoExpression")) { + return group$2(concat$6([concat$6(parts), " ", body])); + } // We handle sequence expressions as the body of arrows specially, + // so that the required parentheses end up on their own lines. + + + if (n.body.type === "SequenceExpression") { + return group$2(concat$6([concat$6(parts), group$2(concat$6([" (", indent$3(concat$6([softline$2, body])), softline$2, ")"]))])); + } // if the arrow function is expanded as last argument, we are adding a + // level of indentation and need to add a softline to align the closing ) + // with the opening (, or if it's inside a JSXExpression (e.g. an attribute) + // we should align the expression's closing } with the line with the opening {. + + + const shouldAddSoftLine = (args && args.expandLastArg || path.getParentNode().type === "JSXExpressionContainer") && !(n.comments && n.comments.length); + const printTrailingComma = args && args.expandLastArg && shouldPrintComma(options, "all"); // In order to avoid confusion between + // a => a ? a : a + // a <= a ? a : a + + const shouldAddParens = n.body.type === "ConditionalExpression" && !startsWithNoLookaheadToken$1(n.body, + /* forbidFunctionAndClass */ + false); + return group$2(concat$6([concat$6(parts), group$2(concat$6([indent$3(concat$6([line$4, shouldAddParens ? ifBreak$1("", "(") : "", body, shouldAddParens ? ifBreak$1("", ")") : ""])), shouldAddSoftLine ? concat$6([ifBreak$1(printTrailingComma ? "," : ""), softline$2]) : ""]))])); + } + + case "YieldExpression": + parts.push("yield"); + + if (n.delegate) { + parts.push("*"); + } + + if (n.argument) { + parts.push(" ", path.call(print, "argument")); + } + + return concat$6(parts); + + case "AwaitExpression": + { + parts.push("await ", path.call(print, "argument")); + const parent = path.getParentNode(); + + if ((parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.callee === n || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && parent.object === n) { + return group$2(concat$6([indent$3(concat$6([softline$2, concat$6(parts)])), softline$2])); + } + + return concat$6(parts); + } + + case "ImportSpecifier": + if (n.importKind) { + parts.push(path.call(print, "importKind"), " "); + } + + parts.push(path.call(print, "imported")); + + if (n.local && n.local.name !== n.imported.name) { + parts.push(" as ", path.call(print, "local")); + } + + return concat$6(parts); + + case "ExportSpecifier": + parts.push(path.call(print, "local")); + + if (n.exported && n.exported.name !== n.local.name) { + parts.push(" as ", path.call(print, "exported")); + } + + return concat$6(parts); + + case "ImportNamespaceSpecifier": + parts.push("* as "); + parts.push(path.call(print, "local")); + return concat$6(parts); + + case "ImportDefaultSpecifier": + return path.call(print, "local"); + + case "TSExportAssignment": + return concat$6(["export = ", path.call(print, "expression"), semi]); + + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + return printExportDeclaration(path, options, print); + + case "ExportAllDeclaration": + parts.push("export "); + + if (n.exportKind === "type") { + parts.push("type "); + } + + parts.push("* "); + + if (n.exported) { + parts.push("as ", path.call(print, "exported"), " "); + } + + parts.push("from ", path.call(print, "source"), semi); + return concat$6(parts); + + case "ExportNamespaceSpecifier": + case "ExportDefaultSpecifier": + return path.call(print, "exported"); + + case "ImportDeclaration": + { + parts.push("import "); + + if (n.importKind && n.importKind !== "value") { + parts.push(n.importKind + " "); + } + + const standalones = []; + const grouped = []; + + if (n.specifiers && n.specifiers.length > 0) { + path.each(specifierPath => { + const value = specifierPath.getValue(); + + if (value.type === "ImportDefaultSpecifier" || value.type === "ImportNamespaceSpecifier") { + standalones.push(print(specifierPath)); + } else { + grouped.push(print(specifierPath)); + } + }, "specifiers"); + + if (standalones.length > 0) { + parts.push(join$4(", ", standalones)); + } + + if (standalones.length > 0 && grouped.length > 0) { + parts.push(", "); + } + + if (grouped.length === 1 && standalones.length === 0 && n.specifiers && !n.specifiers.some(node => node.comments)) { + parts.push(concat$6(["{", options.bracketSpacing ? " " : "", concat$6(grouped), options.bracketSpacing ? " " : "", "}"])); + } else if (grouped.length >= 1) { + parts.push(group$2(concat$6(["{", indent$3(concat$6([options.bracketSpacing ? line$4 : softline$2, join$4(concat$6([",", line$4]), grouped)])), ifBreak$1(shouldPrintComma(options) ? "," : ""), options.bracketSpacing ? line$4 : softline$2, "}"]))); + } + + parts.push(" from "); + } else if (n.importKind && n.importKind === "type" || // import {} from 'x' + /{\s*}/.test(options.originalText.slice(options.locStart(n), options.locStart(n.source)))) { + parts.push("{} from "); + } + + parts.push(path.call(print, "source"), semi); + return concat$6(parts); + } + + case "Import": + return "import"; + + case "TSModuleBlock": + case "BlockStatement": + { + const naked = path.call(bodyPath => { + return printStatementSequence(bodyPath, options, print); + }, "body"); + const hasContent = n.body.find(node => node.type !== "EmptyStatement"); + const hasDirectives = n.directives && n.directives.length > 0; + const parent = path.getParentNode(); + const parentParent = path.getParentNode(1); + + if (!hasContent && !hasDirectives && !hasDanglingComments$1(n) && (parent.type === "ArrowFunctionExpression" || parent.type === "FunctionExpression" || parent.type === "FunctionDeclaration" || parent.type === "ObjectMethod" || parent.type === "ClassMethod" || parent.type === "ClassPrivateMethod" || parent.type === "ForStatement" || parent.type === "WhileStatement" || parent.type === "DoWhileStatement" || parent.type === "DoExpression" || parent.type === "CatchClause" && !parentParent.finalizer || parent.type === "TSModuleDeclaration")) { + return "{}"; + } + + parts.push("{"); // Babel 6 + + if (hasDirectives) { + path.each(childPath => { + parts.push(indent$3(concat$6([hardline$4, print(childPath), semi]))); + + if (isNextLineEmpty$2(options.originalText, childPath.getValue(), options.locEnd)) { + parts.push(hardline$4); + } + }, "directives"); + } + + if (hasContent) { + parts.push(indent$3(concat$6([hardline$4, naked]))); + } + + parts.push(comments.printDanglingComments(path, options)); + parts.push(hardline$4, "}"); + return concat$6(parts); + } + + case "ReturnStatement": + return concat$6(["return", printReturnAndThrowArgument(path, options, print)]); + + case "NewExpression": + case "OptionalCallExpression": + case "CallExpression": + { + const isNew = n.type === "NewExpression"; + const optional = printOptionalToken(path); + + if ( // We want to keep CommonJS- and AMD-style require calls, and AMD-style + // define calls, as a unit. + // e.g. `define(["some/lib", (lib) => {` + !isNew && n.callee.type === "Identifier" && (n.callee.name === "require" || n.callee.name === "define") || // Template literals as single arguments + n.arguments.length === 1 && isTemplateOnItsOwnLine$1(n.arguments[0], options.originalText, options) || // Keep test declarations on a single line + // e.g. `it('long name', () => {` + !isNew && isTestCall$1(n, path.getParentNode())) { + return concat$6([isNew ? "new " : "", path.call(print, "callee"), optional, printFunctionTypeParameters(path, options, print), concat$6(["(", join$4(", ", path.map(print, "arguments")), ")"])]); + } // Inline Flow annotation comments following Identifiers in Call nodes need to + // stay with the Identifier. For example: + // + // foo /*:: */(bar); + // + // Here, we ensure that such comments stay between the Identifier and the Callee. + + + const isIdentifierWithFlowAnnotation = n.callee.type === "Identifier" && hasFlowAnnotationComment$1(n.callee.trailingComments); + + if (isIdentifierWithFlowAnnotation) { + n.callee.trailingComments[0].printed = true; + } // We detect calls on member lookups and possibly print them in a + // special chain format. See `printMemberChain` for more info. + + + if (!isNew && isMemberish$1(n.callee) && !path.call(path => needsParens_1(path, options), "callee")) { + return printMemberChain(path, options, print); + } + + const contents = concat$6([isNew ? "new " : "", path.call(print, "callee"), optional, isIdentifierWithFlowAnnotation ? `/*:: ${n.callee.trailingComments[0].value.slice(2).trim()} */` : "", printFunctionTypeParameters(path, options, print), printArgumentsList(path, options, print)]); // We group here when the callee is itself a call expression. + // See `isLongCurriedCallExpression` for more info. + + if (isCallOrOptionalCallExpression$1(n.callee)) { + return group$2(contents); + } + + return contents; + } + + case "TSInterfaceDeclaration": + if (n.declare) { + parts.push("declare "); + } + + parts.push(n.abstract ? "abstract " : "", printTypeScriptModifiers(path, options, print), "interface ", path.call(print, "id"), n.typeParameters ? path.call(print, "typeParameters") : "", " "); + + if (n.extends && n.extends.length) { + parts.push(group$2(indent$3(concat$6([softline$2, "extends ", (n.extends.length === 1 ? identity$2 : indent$3)(join$4(concat$6([",", line$4]), path.map(print, "extends"))), " "])))); + } + + parts.push(path.call(print, "body")); + return concat$6(parts); + + case "ObjectTypeInternalSlot": + return concat$6([n.static ? "static " : "", "[[", path.call(print, "id"), "]]", printOptionalToken(path), n.method ? "" : ": ", path.call(print, "value")]); + + case "ObjectExpression": + case "ObjectPattern": + case "ObjectTypeAnnotation": + case "TSInterfaceBody": + case "TSTypeLiteral": + { + let propertiesField; + + if (n.type === "TSTypeLiteral") { + propertiesField = "members"; + } else if (n.type === "TSInterfaceBody") { + propertiesField = "body"; + } else { + propertiesField = "properties"; + } + + const isTypeAnnotation = n.type === "ObjectTypeAnnotation"; + const fields = []; + + if (isTypeAnnotation) { + fields.push("indexers", "callProperties", "internalSlots"); + } + + fields.push(propertiesField); + const firstProperty = fields.map(field => n[field][0]).sort((a, b) => options.locStart(a) - options.locStart(b))[0]; + const parent = path.getParentNode(0); + const isFlowInterfaceLikeBody = isTypeAnnotation && parent && (parent.type === "InterfaceDeclaration" || parent.type === "DeclareInterface" || parent.type === "DeclareClass") && path.getName() === "body"; + const shouldBreak = n.type === "TSInterfaceBody" || isFlowInterfaceLikeBody || n.type === "ObjectPattern" && parent.type !== "FunctionDeclaration" && parent.type !== "FunctionExpression" && parent.type !== "ArrowFunctionExpression" && parent.type !== "ObjectMethod" && parent.type !== "ClassMethod" && parent.type !== "ClassPrivateMethod" && parent.type !== "AssignmentPattern" && parent.type !== "CatchClause" && n.properties.some(property => property.value && (property.value.type === "ObjectPattern" || property.value.type === "ArrayPattern")) || n.type !== "ObjectPattern" && firstProperty && hasNewlineInRange$3(options.originalText, options.locStart(n), options.locStart(firstProperty)); + const separator = isFlowInterfaceLikeBody ? ";" : n.type === "TSInterfaceBody" || n.type === "TSTypeLiteral" ? ifBreak$1(semi, ";") : ","; + const leftBrace = n.exact ? "{|" : "{"; + const rightBrace = n.exact ? "|}" : "}"; // Unfortunately, things are grouped together in the ast can be + // interleaved in the source code. So we need to reorder them before + // printing them. + + const propsAndLoc = []; + fields.forEach(field => { + path.each(childPath => { + const node = childPath.getValue(); + propsAndLoc.push({ + node, + printed: print(childPath), + loc: options.locStart(node) + }); + }, field); + }); + let separatorParts = []; + const props = propsAndLoc.sort((a, b) => a.loc - b.loc).map(prop => { + const result = concat$6(separatorParts.concat(group$2(prop.printed))); + separatorParts = [separator, line$4]; + + if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature" || prop.node.type === "TSConstructSignatureDeclaration") && hasNodeIgnoreComment$2(prop.node)) { + separatorParts.shift(); + } + + if (isNextLineEmpty$2(options.originalText, prop.node, options.locEnd)) { + separatorParts.push(hardline$4); + } + + return result; + }); + + if (n.inexact) { + let printed; + + if (hasDanglingComments$1(n)) { + const hasLineComments = !n.comments.every(comments$1.isBlockComment); + const printedDanglingComments = comments.printDanglingComments(path, options, + /* sameIndent */ + true); + printed = concat$6([printedDanglingComments, hasLineComments || hasNewline$4(options.originalText, options.locEnd(n.comments[n.comments.length - 1])) ? hardline$4 : line$4, "..."]); + } else { + printed = "..."; + } + + props.push(concat$6(separatorParts.concat(printed))); + } + + const lastElem = getLast$2(n[propertiesField]); + const canHaveTrailingSeparator = !(n.inexact || lastElem && (lastElem.type === "RestElement" || hasNodeIgnoreComment$2(lastElem))); + let content; + + if (props.length === 0) { + if (!hasDanglingComments$1(n)) { + return concat$6([leftBrace, rightBrace, printTypeAnnotation(path, options, print)]); + } + + content = group$2(concat$6([leftBrace, comments.printDanglingComments(path, options), softline$2, rightBrace, printOptionalToken(path), printTypeAnnotation(path, options, print)])); + } else { + content = concat$6([leftBrace, indent$3(concat$6([options.bracketSpacing ? line$4 : softline$2, concat$6(props)])), ifBreak$1(canHaveTrailingSeparator && (separator !== "," || shouldPrintComma(options)) ? separator : ""), concat$6([options.bracketSpacing ? line$4 : softline$2, rightBrace]), printOptionalToken(path), printTypeAnnotation(path, options, print)]); + } // If we inline the object as first argument of the parent, we don't want + // to create another group so that the object breaks before the return + // type + + + if (path.match(node => node.type === "ObjectPattern" && !node.decorators, (node, name, number) => shouldHugArguments(node) && (name === "params" || name === "parameters") && number === 0) || path.match(shouldHugType, (node, name) => name === "typeAnnotation", (node, name) => name === "typeAnnotation", (node, name, number) => shouldHugArguments(node) && (name === "params" || name === "parameters") && number === 0)) { + return content; + } + + return group$2(content, { + shouldBreak + }); + } + // Babel 6 + + case "ObjectProperty": // Non-standard AST node type. + + case "Property": + if (n.method || n.kind === "get" || n.kind === "set") { + return printMethod(path, options, print); + } + + if (n.shorthand) { + parts.push(path.call(print, "value")); + } else { + parts.push(printAssignment(n.key, printPropertyKey(path, options, print), ":", n.value, path.call(print, "value"), options)); + } + + return concat$6(parts); + // Babel 6 + + case "ClassMethod": + case "ClassPrivateMethod": + case "MethodDefinition": + case "TSAbstractMethodDefinition": + case "TSDeclareMethod": + if (n.decorators && n.decorators.length !== 0) { + parts.push(printDecorators(path, options, print)); + } + + if (n.accessibility) { + parts.push(n.accessibility + " "); + } + + if (n.static) { + parts.push("static "); + } + + if (n.type === "TSAbstractMethodDefinition" || n.abstract) { + parts.push("abstract "); + } + + parts.push(printMethod(path, options, print)); + return concat$6(parts); + + case "ObjectMethod": + return printMethod(path, options, print); + + case "Decorator": + return concat$6(["@", path.call(print, "expression"), path.call(print, "callee")]); + + case "ArrayExpression": + case "ArrayPattern": + if (n.elements.length === 0) { + if (!hasDanglingComments$1(n)) { + parts.push("[]"); + } else { + parts.push(group$2(concat$6(["[", comments.printDanglingComments(path, options), softline$2, "]"]))); + } + } else { + const lastElem = getLast$2(n.elements); + const canHaveTrailingComma = !(lastElem && lastElem.type === "RestElement"); // JavaScript allows you to have empty elements in an array which + // changes its length based on the number of commas. The algorithm + // is that if the last argument is null, we need to force insert + // a comma to ensure JavaScript recognizes it. + // [,].length === 1 + // [1,].length === 1 + // [1,,].length === 2 + // + // Note that getLast returns null if the array is empty, but + // we already check for an empty array just above so we are safe + + const needsForcedTrailingComma = canHaveTrailingComma && lastElem === null; + const shouldBreak = n.elements.length > 1 && n.elements.every((element, i, elements) => { + const elementType = element && element.type; + + if (elementType !== "ArrayExpression" && elementType !== "ObjectExpression") { + return false; + } + + const nextElement = elements[i + 1]; + + if (nextElement && elementType !== nextElement.type) { + return false; + } + + const itemsKey = elementType === "ArrayExpression" ? "elements" : "properties"; + return element[itemsKey] && element[itemsKey].length > 1; + }); + parts.push(group$2(concat$6(["[", indent$3(concat$6([softline$2, printArrayItems(path, options, "elements", print)])), needsForcedTrailingComma ? "," : "", ifBreak$1(canHaveTrailingComma && !needsForcedTrailingComma && shouldPrintComma(options) ? "," : ""), comments.printDanglingComments(path, options, + /* sameIndent */ + true), softline$2, "]"]), { + shouldBreak + })); + } + + parts.push(printOptionalToken(path), printTypeAnnotation(path, options, print)); + return concat$6(parts); + + case "SequenceExpression": + { + const parent = path.getParentNode(0); + + if (parent.type === "ExpressionStatement" || parent.type === "ForStatement") { + // For ExpressionStatements and for-loop heads, which are among + // the few places a SequenceExpression appears unparenthesized, we want + // to indent expressions after the first. + const parts = []; + path.each(p => { + if (p.getName() === 0) { + parts.push(print(p)); + } else { + parts.push(",", indent$3(concat$6([line$4, print(p)]))); + } + }, "expressions"); + return group$2(concat$6(parts)); + } + + return group$2(concat$6([join$4(concat$6([",", line$4]), path.map(print, "expressions"))])); + } + + case "ThisExpression": + return "this"; + + case "Super": + return "super"; + + case "NullLiteral": + // Babel 6 Literal split + return "null"; + + case "RegExpLiteral": + // Babel 6 Literal split + return printRegex(n); + + case "NumericLiteral": + // Babel 6 Literal split + return printNumber$1(n.extra.raw); + + case "BigIntLiteral": + // babel: n.extra.raw, typescript: n.raw, flow: n.bigint + return (n.bigint || (n.extra ? n.extra.raw : n.raw)).toLowerCase(); + + case "BooleanLiteral": // Babel 6 Literal split + + case "StringLiteral": // Babel 6 Literal split + + case "Literal": + { + if (n.regex) { + return printRegex(n.regex); + } + + if (typeof n.value === "number") { + return printNumber$1(n.raw); + } + + if (typeof n.value !== "string") { + return "" + n.value; + } // TypeScript workaround for https://github.com/JamesHenry/typescript-estree/issues/2 + // See corresponding workaround in needs-parens.js + + + const grandParent = path.getParentNode(1); + const isTypeScriptDirective = options.parser === "typescript" && typeof n.value === "string" && grandParent && (grandParent.type === "Program" || grandParent.type === "BlockStatement"); + return nodeStr(n, options, isTypeScriptDirective); + } + + case "Directive": + return path.call(print, "value"); + // Babel 6 + + case "DirectiveLiteral": + return nodeStr(n, options); + + case "UnaryExpression": + parts.push(n.operator); + + if (/[a-z]$/.test(n.operator)) { + parts.push(" "); + } + + if (n.argument.comments && n.argument.comments.length > 0) { + parts.push(group$2(concat$6(["(", indent$3(concat$6([softline$2, path.call(print, "argument")])), softline$2, ")"]))); + } else { + parts.push(path.call(print, "argument")); + } + + return concat$6(parts); + + case "UpdateExpression": + parts.push(path.call(print, "argument"), n.operator); + + if (n.prefix) { + parts.reverse(); + } + + return concat$6(parts); + + case "ConditionalExpression": + return printTernaryOperator(path, options, print, { + beforeParts: () => [path.call(print, "test")], + afterParts: breakClosingParen => [breakClosingParen ? softline$2 : ""], + shouldCheckJsx: true, + conditionalNodeType: "ConditionalExpression", + consequentNodePropertyName: "consequent", + alternateNodePropertyName: "alternate", + testNodePropertyNames: ["test"] + }); + + case "VariableDeclaration": + { + const printed = path.map(childPath => { + return print(childPath); + }, "declarations"); // We generally want to terminate all variable declarations with a + // semicolon, except when they in the () part of for loops. + + const parentNode = path.getParentNode(); + const isParentForLoop = parentNode.type === "ForStatement" || parentNode.type === "ForInStatement" || parentNode.type === "ForOfStatement"; + const hasValue = n.declarations.some(decl => decl.init); + let firstVariable; + + if (printed.length === 1 && !n.declarations[0].comments) { + firstVariable = printed[0]; + } else if (printed.length > 0) { + // Indent first var to comply with eslint one-var rule + firstVariable = indent$3(printed[0]); + } + + parts = [n.declare ? "declare " : "", n.kind, firstVariable ? concat$6([" ", firstVariable]) : "", indent$3(concat$6(printed.slice(1).map(p => concat$6([",", hasValue && !isParentForLoop ? hardline$4 : line$4, p]))))]; + + if (!(isParentForLoop && parentNode.body !== n)) { + parts.push(semi); + } + + return group$2(concat$6(parts)); + } + + case "TSTypeAliasDeclaration": + { + if (n.declare) { + parts.push("declare "); + } + + const printed = printAssignmentRight(n.id, n.typeAnnotation, n.typeAnnotation && path.call(print, "typeAnnotation"), options); + parts.push("type ", path.call(print, "id"), path.call(print, "typeParameters"), " =", printed, semi); + return group$2(concat$6(parts)); + } + + case "VariableDeclarator": + return printAssignment(n.id, path.call(print, "id"), " =", n.init, n.init && path.call(print, "init"), options); + + case "WithStatement": + return group$2(concat$6(["with (", path.call(print, "object"), ")", adjustClause(n.body, path.call(print, "body"))])); + + case "IfStatement": + { + const con = adjustClause(n.consequent, path.call(print, "consequent")); + const opening = group$2(concat$6(["if (", group$2(concat$6([indent$3(concat$6([softline$2, path.call(print, "test")])), softline$2])), ")", con])); + parts.push(opening); + + if (n.alternate) { + const commentOnOwnLine = hasTrailingComment$1(n.consequent) && n.consequent.comments.some(comment => comment.trailing && !comments$1.isBlockComment(comment)) || needsHardlineAfterDanglingComment$1(n); + const elseOnSameLine = n.consequent.type === "BlockStatement" && !commentOnOwnLine; + parts.push(elseOnSameLine ? " " : hardline$4); + + if (hasDanglingComments$1(n)) { + parts.push(comments.printDanglingComments(path, options, true), commentOnOwnLine ? hardline$4 : " "); + } + + parts.push("else", group$2(adjustClause(n.alternate, path.call(print, "alternate"), n.alternate.type === "IfStatement"))); + } + + return concat$6(parts); + } + + case "ForStatement": + { + const body = adjustClause(n.body, path.call(print, "body")); // We want to keep dangling comments above the loop to stay consistent. + // Any comment positioned between the for statement and the parentheses + // is going to be printed before the statement. + + const dangling = comments.printDanglingComments(path, options, + /* sameLine */ + true); + const printedComments = dangling ? concat$6([dangling, softline$2]) : ""; + + if (!n.init && !n.test && !n.update) { + return concat$6([printedComments, group$2(concat$6(["for (;;)", body]))]); + } + + return concat$6([printedComments, group$2(concat$6(["for (", group$2(concat$6([indent$3(concat$6([softline$2, path.call(print, "init"), ";", line$4, path.call(print, "test"), ";", line$4, path.call(print, "update")])), softline$2])), ")", body]))]); + } + + case "WhileStatement": + return group$2(concat$6(["while (", group$2(concat$6([indent$3(concat$6([softline$2, path.call(print, "test")])), softline$2])), ")", adjustClause(n.body, path.call(print, "body"))])); + + case "ForInStatement": + // Note: esprima can't actually parse "for each (". + return group$2(concat$6([n.each ? "for each (" : "for (", path.call(print, "left"), " in ", path.call(print, "right"), ")", adjustClause(n.body, path.call(print, "body"))])); + + case "ForOfStatement": + return group$2(concat$6(["for", n.await ? " await" : "", " (", path.call(print, "left"), " of ", path.call(print, "right"), ")", adjustClause(n.body, path.call(print, "body"))])); + + case "DoWhileStatement": + { + const clause = adjustClause(n.body, path.call(print, "body")); + const doBody = group$2(concat$6(["do", clause])); + parts = [doBody]; + + if (n.body.type === "BlockStatement") { + parts.push(" "); + } else { + parts.push(hardline$4); + } + + parts.push("while ("); + parts.push(group$2(concat$6([indent$3(concat$6([softline$2, path.call(print, "test")])), softline$2])), ")", semi); + return concat$6(parts); + } + + case "DoExpression": + return concat$6(["do ", path.call(print, "body")]); + + case "BreakStatement": + parts.push("break"); + + if (n.label) { + parts.push(" ", path.call(print, "label")); + } + + parts.push(semi); + return concat$6(parts); + + case "ContinueStatement": + parts.push("continue"); + + if (n.label) { + parts.push(" ", path.call(print, "label")); + } + + parts.push(semi); + return concat$6(parts); + + case "LabeledStatement": + if (n.body.type === "EmptyStatement") { + return concat$6([path.call(print, "label"), ":;"]); + } + + return concat$6([path.call(print, "label"), ": ", path.call(print, "body")]); + + case "TryStatement": + return concat$6(["try ", path.call(print, "block"), n.handler ? concat$6([" ", path.call(print, "handler")]) : "", n.finalizer ? concat$6([" finally ", path.call(print, "finalizer")]) : ""]); + + case "CatchClause": + if (n.param) { + const hasComments = n.param.comments && n.param.comments.some(comment => !comments$1.isBlockComment(comment) || comment.leading && hasNewline$4(options.originalText, options.locEnd(comment)) || comment.trailing && hasNewline$4(options.originalText, options.locStart(comment), { + backwards: true + })); + const param = path.call(print, "param"); + return concat$6(["catch ", hasComments ? concat$6(["(", indent$3(concat$6([softline$2, param])), softline$2, ") "]) : concat$6(["(", param, ") "]), path.call(print, "body")]); + } + + return concat$6(["catch ", path.call(print, "body")]); + + case "ThrowStatement": + return concat$6(["throw", printReturnAndThrowArgument(path, options, print)]); + // Note: ignoring n.lexical because it has no printing consequences. + + case "SwitchStatement": + return concat$6([group$2(concat$6(["switch (", indent$3(concat$6([softline$2, path.call(print, "discriminant")])), softline$2, ")"])), " {", n.cases.length > 0 ? indent$3(concat$6([hardline$4, join$4(hardline$4, path.map(casePath => { + const caseNode = casePath.getValue(); + return concat$6([casePath.call(print), n.cases.indexOf(caseNode) !== n.cases.length - 1 && isNextLineEmpty$2(options.originalText, caseNode, options.locEnd) ? hardline$4 : ""]); + }, "cases"))])) : "", hardline$4, "}"]); + + case "SwitchCase": + { + if (n.test) { + parts.push("case ", path.call(print, "test"), ":"); + } else { + parts.push("default:"); + } + + const consequent = n.consequent.filter(node => node.type !== "EmptyStatement"); + + if (consequent.length > 0) { + const cons = path.call(consequentPath => { + return printStatementSequence(consequentPath, options, print); + }, "consequent"); + parts.push(consequent.length === 1 && consequent[0].type === "BlockStatement" ? concat$6([" ", cons]) : indent$3(concat$6([hardline$4, cons]))); + } + + return concat$6(parts); + } + // JSX extensions below. + + case "DebuggerStatement": + return concat$6(["debugger", semi]); + + case "JSXAttribute": + parts.push(path.call(print, "name")); + + if (n.value) { + let res; + + if (isStringLiteral$1(n.value)) { + const raw = rawText$1(n.value); // Unescape all quotes so we get an accurate preferred quote + + let final = raw.replace(/'/g, "'").replace(/"/g, '"'); + const quote = getPreferredQuote$1(final, options.jsxSingleQuote ? "'" : '"'); + const escape = quote === "'" ? "'" : """; + final = final.slice(1, -1).replace(new RegExp(quote, "g"), escape); + res = concat$6([quote, final, quote]); + } else { + res = path.call(print, "value"); + } + + parts.push("=", res); + } + + return concat$6(parts); + + case "JSXIdentifier": + return "" + n.name; + + case "JSXNamespacedName": + return join$4(":", [path.call(print, "namespace"), path.call(print, "name")]); + + case "JSXMemberExpression": + return join$4(".", [path.call(print, "object"), path.call(print, "property")]); + + case "TSQualifiedName": + return join$4(".", [path.call(print, "left"), path.call(print, "right")]); + + case "JSXSpreadAttribute": + case "JSXSpreadChild": + { + return concat$6(["{", path.call(p => { + const printed = concat$6(["...", print(p)]); + const n = p.getValue(); + + if (!n.comments || !n.comments.length) { + return printed; + } + + return concat$6([indent$3(concat$6([softline$2, comments.printComments(p, () => printed, options)])), softline$2]); + }, n.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"]); + } + + case "JSXExpressionContainer": + { + const parent = path.getParentNode(0); + const hasComments = n.expression.comments && n.expression.comments.length > 0; + const shouldInline = n.expression.type === "JSXEmptyExpression" || !hasComments && (n.expression.type === "ArrayExpression" || n.expression.type === "ObjectExpression" || n.expression.type === "ArrowFunctionExpression" || n.expression.type === "CallExpression" || n.expression.type === "OptionalCallExpression" || n.expression.type === "FunctionExpression" || n.expression.type === "TemplateLiteral" || n.expression.type === "TaggedTemplateExpression" || n.expression.type === "DoExpression" || isJSXNode$1(parent) && (n.expression.type === "ConditionalExpression" || isBinaryish$1(n.expression))); + + if (shouldInline) { + return group$2(concat$6(["{", path.call(print, "expression"), lineSuffixBoundary$1, "}"])); + } + + return group$2(concat$6(["{", indent$3(concat$6([softline$2, path.call(print, "expression")])), softline$2, lineSuffixBoundary$1, "}"])); + } + + case "JSXFragment": + case "JSXElement": + { + const elem = comments.printComments(path, () => printJSXElement(path, options, print), options); + return maybeWrapJSXElementInParens(path, elem, options); + } + + case "JSXOpeningElement": + { + const n = path.getValue(); + const nameHasComments = n.name && n.name.comments && n.name.comments.length > 0 || n.typeParameters && n.typeParameters.comments && n.typeParameters.comments.length > 0; // Don't break self-closing elements with no attributes and no comments + + if (n.selfClosing && !n.attributes.length && !nameHasComments) { + return concat$6(["<", path.call(print, "name"), path.call(print, "typeParameters"), " />"]); + } // don't break up opening elements with a single long text attribute + + + if (n.attributes && n.attributes.length === 1 && n.attributes[0].value && isStringLiteral$1(n.attributes[0].value) && !n.attributes[0].value.value.includes("\n") && // We should break for the following cases: + //
+ //
+ !nameHasComments && (!n.attributes[0].comments || !n.attributes[0].comments.length)) { + return group$2(concat$6(["<", path.call(print, "name"), path.call(print, "typeParameters"), " ", concat$6(path.map(print, "attributes")), n.selfClosing ? " />" : ">"])); + } + + const lastAttrHasTrailingComments = n.attributes.length && hasTrailingComment$1(getLast$2(n.attributes)); + const bracketSameLine = // Simple tags (no attributes and no comment in tag name) should be + // kept unbroken regardless of `jsxBracketSameLine` + !n.attributes.length && !nameHasComments || options.jsxBracketSameLine && ( // We should print the bracket in a new line for the following cases: + //
+ //
+ !nameHasComments || n.attributes.length) && !lastAttrHasTrailingComments; // We should print the opening element expanded if any prop value is a + // string literal with newlines + + const shouldBreak = n.attributes && n.attributes.some(attr => attr.value && isStringLiteral$1(attr.value) && attr.value.value.includes("\n")); + return group$2(concat$6(["<", path.call(print, "name"), path.call(print, "typeParameters"), concat$6([indent$3(concat$6(path.map(attr => concat$6([line$4, print(attr)]), "attributes"))), n.selfClosing ? line$4 : bracketSameLine ? ">" : softline$2]), n.selfClosing ? "/>" : bracketSameLine ? "" : ">"]), { + shouldBreak + }); + } + + case "JSXClosingElement": + return concat$6([""]); + + case "JSXOpeningFragment": + case "JSXClosingFragment": + { + const hasComment = n.comments && n.comments.length; + const hasOwnLineComment = hasComment && !n.comments.every(comments$1.isBlockComment); + const isOpeningFragment = n.type === "JSXOpeningFragment"; + return concat$6([isOpeningFragment ? "<" : ""]); + } + + case "JSXText": + /* istanbul ignore next */ + throw new Error("JSXTest should be handled by JSXElement"); + + case "JSXEmptyExpression": + { + const requiresHardline = n.comments && !n.comments.every(comments$1.isBlockComment); + return concat$6([comments.printDanglingComments(path, options, + /* sameIndent */ + !requiresHardline), requiresHardline ? hardline$4 : ""]); + } + + case "ClassBody": + if (!n.comments && n.body.length === 0) { + return "{}"; + } + + return concat$6(["{", n.body.length > 0 ? indent$3(concat$6([hardline$4, path.call(bodyPath => { + return printStatementSequence(bodyPath, options, print); + }, "body")])) : comments.printDanglingComments(path, options), hardline$4, "}"]); + + case "ClassProperty": + case "TSAbstractClassProperty": + case "ClassPrivateProperty": + { + if (n.decorators && n.decorators.length !== 0) { + parts.push(printDecorators(path, options, print)); + } + + if (n.accessibility) { + parts.push(n.accessibility + " "); + } + + if (n.declare) { + parts.push("declare "); + } + + if (n.static) { + parts.push("static "); + } + + if (n.type === "TSAbstractClassProperty" || n.abstract) { + parts.push("abstract "); + } + + if (n.readonly) { + parts.push("readonly "); + } + + const variance = getFlowVariance$1(n); + + if (variance) { + parts.push(variance); + } + + parts.push(printPropertyKey(path, options, print), printOptionalToken(path), printTypeAnnotation(path, options, print)); + + if (n.value) { + parts.push(" =", printAssignmentRight(n.key, n.value, path.call(print, "value"), options)); + } + + parts.push(semi); + return group$2(concat$6(parts)); + } + + case "ClassDeclaration": + case "ClassExpression": + if (n.declare) { + parts.push("declare "); + } + + parts.push(concat$6(printClass(path, options, print))); + return concat$6(parts); + + case "TSInterfaceHeritage": + case "TSExpressionWithTypeArguments": + // Babel AST + parts.push(path.call(print, "expression")); + + if (n.typeParameters) { + parts.push(path.call(print, "typeParameters")); + } + + return concat$6(parts); + + case "TemplateElement": + return join$4(literalline$2, n.value.raw.split(/\r?\n/g)); + + case "TemplateLiteral": + { + let expressions = path.map(print, "expressions"); + const parentNode = path.getParentNode(); + + if (isJestEachTemplateLiteral$1(n, parentNode)) { + const printed = printJestEachTemplateLiteral(n, expressions, options); + + if (printed) { + return printed; + } + } + + const isSimple = isSimpleTemplateLiteral$1(n); + + if (isSimple) { + expressions = expressions.map(doc => printDocToString$2(doc, Object.assign({}, options, { + printWidth: Infinity + })).formatted); + } + + parts.push(lineSuffixBoundary$1, "`"); + path.each(childPath => { + const i = childPath.getName(); + parts.push(print(childPath)); + + if (i < expressions.length) { + // For a template literal of the following form: + // `someQuery { + // ${call({ + // a, + // b, + // })} + // }` + // the expression is on its own line (there is a \n in the previous + // quasi literal), therefore we want to indent the JavaScript + // expression inside at the beginning of ${ instead of the beginning + // of the `. + const { + tabWidth + } = options; + const quasi = childPath.getValue(); + const indentSize = getIndentSize$2(quasi.value.raw, tabWidth); + let printed = expressions[i]; + + if (!isSimple) { + // Breaks at the template element boundaries (${ and }) are preferred to breaking + // in the middle of a MemberExpression + if (n.expressions[i].comments && n.expressions[i].comments.length || n.expressions[i].type === "MemberExpression" || n.expressions[i].type === "OptionalMemberExpression" || n.expressions[i].type === "ConditionalExpression" || n.expressions[i].type === "SequenceExpression" || n.expressions[i].type === "TSAsExpression" || isBinaryish$1(n.expressions[i])) { + printed = concat$6([indent$3(concat$6([softline$2, printed])), softline$2]); + } + } + + const aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align$1(-Infinity, printed) : addAlignmentToDoc$2(printed, indentSize, tabWidth); + parts.push(group$2(concat$6(["${", aligned, lineSuffixBoundary$1, "}"]))); + } + }, "quasis"); + parts.push("`"); + return concat$6(parts); + } + // These types are unprintable because they serve as abstract + // supertypes for other (printable) types. + + case "TaggedTemplateExpression": + return concat$6([path.call(print, "tag"), path.call(print, "typeParameters"), path.call(print, "quasi")]); + + case "Node": + case "Printable": + case "SourceLocation": + case "Position": + case "Statement": + case "Function": + case "Pattern": + case "Expression": + case "Declaration": + case "Specifier": + case "NamedSpecifier": + case "Comment": + case "MemberTypeAnnotation": // Flow + + case "Type": + /* istanbul ignore next */ + throw new Error("unprintable type: " + JSON.stringify(n.type)); + // Type Annotations for Facebook Flow, typically stripped out or + // transformed away before printing. + + case "TypeAnnotation": + case "TSTypeAnnotation": + if (n.typeAnnotation) { + return path.call(print, "typeAnnotation"); + } + /* istanbul ignore next */ + + + return ""; + + case "TSTupleType": + case "TupleTypeAnnotation": + { + const typesField = n.type === "TSTupleType" ? "elementTypes" : "types"; + const hasRest = n[typesField].length > 0 && getLast$2(n[typesField]).type === "TSRestType"; + return group$2(concat$6(["[", indent$3(concat$6([softline$2, printArrayItems(path, options, typesField, print)])), ifBreak$1(shouldPrintComma(options, "all") && !hasRest ? "," : ""), comments.printDanglingComments(path, options, + /* sameIndent */ + true), softline$2, "]"])); + } + + case "ExistsTypeAnnotation": + return "*"; + + case "EmptyTypeAnnotation": + return "empty"; + + case "AnyTypeAnnotation": + return "any"; + + case "MixedTypeAnnotation": + return "mixed"; + + case "ArrayTypeAnnotation": + return concat$6([path.call(print, "elementType"), "[]"]); + + case "BooleanTypeAnnotation": + return "boolean"; + + case "BooleanLiteralTypeAnnotation": + return "" + n.value; + + case "DeclareClass": + return printFlowDeclaration(path, printClass(path, options, print)); + + case "TSDeclareFunction": + // For TypeScript the TSDeclareFunction node shares the AST + // structure with FunctionDeclaration + return concat$6([n.declare ? "declare " : "", printFunctionDeclaration(path, print, options), semi]); + + case "DeclareFunction": + return printFlowDeclaration(path, ["function ", path.call(print, "id"), n.predicate ? " " : "", path.call(print, "predicate"), semi]); + + case "DeclareModule": + return printFlowDeclaration(path, ["module ", path.call(print, "id"), " ", path.call(print, "body")]); + + case "DeclareModuleExports": + return printFlowDeclaration(path, ["module.exports", ": ", path.call(print, "typeAnnotation"), semi]); + + case "DeclareVariable": + return printFlowDeclaration(path, ["var ", path.call(print, "id"), semi]); + + case "DeclareExportAllDeclaration": + return concat$6(["declare export * from ", path.call(print, "source")]); + + case "DeclareExportDeclaration": + return concat$6(["declare ", printExportDeclaration(path, options, print)]); + + case "DeclareOpaqueType": + case "OpaqueType": + { + parts.push("opaque type ", path.call(print, "id"), path.call(print, "typeParameters")); + + if (n.supertype) { + parts.push(": ", path.call(print, "supertype")); + } + + if (n.impltype) { + parts.push(" = ", path.call(print, "impltype")); + } + + parts.push(semi); + + if (n.type === "DeclareOpaqueType") { + return printFlowDeclaration(path, parts); + } + + return concat$6(parts); + } + + case "EnumDeclaration": + return concat$6(["enum ", path.call(print, "id"), " ", path.call(print, "body")]); + + case "EnumBooleanBody": + case "EnumNumberBody": + case "EnumStringBody": + case "EnumSymbolBody": + { + if (n.type === "EnumSymbolBody" || n.explicitType) { + let type = null; + + switch (n.type) { + case "EnumBooleanBody": + type = "boolean"; + break; + + case "EnumNumberBody": + type = "number"; + break; + + case "EnumStringBody": + type = "string"; + break; + + case "EnumSymbolBody": + type = "symbol"; + break; + } + + parts.push("of ", type, " "); + } + + if (n.members.length === 0) { + parts.push(group$2(concat$6(["{", comments.printDanglingComments(path, options), softline$2, "}"]))); + } else { + parts.push(group$2(concat$6(["{", indent$3(concat$6([hardline$4, printArrayItems(path, options, "members", print), shouldPrintComma(options) ? "," : ""])), comments.printDanglingComments(path, options, + /* sameIndent */ + true), hardline$4, "}"]))); + } + + return concat$6(parts); + } + + case "EnumBooleanMember": + case "EnumNumberMember": + case "EnumStringMember": + return concat$6([path.call(print, "id"), " = ", typeof n.init === "object" ? path.call(print, "init") : String(n.init)]); + + case "EnumDefaultedMember": + return path.call(print, "id"); + + case "FunctionTypeAnnotation": + case "TSFunctionType": + { + // FunctionTypeAnnotation is ambiguous: + // declare function foo(a: B): void; OR + // var A: (a: B) => void; + const parent = path.getParentNode(0); + const parentParent = path.getParentNode(1); + const parentParentParent = path.getParentNode(2); + let isArrowFunctionTypeAnnotation = n.type === "TSFunctionType" || !((parent.type === "ObjectTypeProperty" || parent.type === "ObjectTypeInternalSlot") && !getFlowVariance$1(parent) && !parent.optional && options.locStart(parent) === options.locStart(n) || parent.type === "ObjectTypeCallProperty" || parentParentParent && parentParentParent.type === "DeclareFunction"); + let needsColon = isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation"); // Sadly we can't put it inside of FastPath::needsColon because we are + // printing ":" as part of the expression and it would put parenthesis + // around :( + + const needsParens = needsColon && isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation") && parentParent.type === "ArrowFunctionExpression"; + + if (isObjectTypePropertyAFunction$1(parent, options)) { + isArrowFunctionTypeAnnotation = true; + needsColon = true; + } + + if (needsParens) { + parts.push("("); + } + + parts.push(printFunctionParams(path, print, options, + /* expandArg */ + false, + /* printTypeParams */ + true)); // The returnType is not wrapped in a TypeAnnotation, so the colon + // needs to be added separately. + + if (n.returnType || n.predicate || n.typeAnnotation) { + parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path.call(print, "returnType"), path.call(print, "predicate"), path.call(print, "typeAnnotation")); + } + + if (needsParens) { + parts.push(")"); + } + + return group$2(concat$6(parts)); + } + + case "TSRestType": + return concat$6(["...", path.call(print, "typeAnnotation")]); + + case "TSOptionalType": + return concat$6([path.call(print, "typeAnnotation"), "?"]); + + case "FunctionTypeParam": + return concat$6([path.call(print, "name"), printOptionalToken(path), n.name ? ": " : "", path.call(print, "typeAnnotation")]); + + case "GenericTypeAnnotation": + return concat$6([path.call(print, "id"), path.call(print, "typeParameters")]); + + case "DeclareInterface": + case "InterfaceDeclaration": + case "InterfaceTypeAnnotation": + { + if (n.type === "DeclareInterface" || n.declare) { + parts.push("declare "); + } + + parts.push("interface"); + + if (n.type === "DeclareInterface" || n.type === "InterfaceDeclaration") { + parts.push(" ", path.call(print, "id"), path.call(print, "typeParameters")); + } + + if (n.extends.length > 0) { + parts.push(group$2(indent$3(concat$6([line$4, "extends ", (n.extends.length === 1 ? identity$2 : indent$3)(join$4(concat$6([",", line$4]), path.map(print, "extends")))])))); + } + + parts.push(" ", path.call(print, "body")); + return group$2(concat$6(parts)); + } + + case "ClassImplements": + case "InterfaceExtends": + return concat$6([path.call(print, "id"), path.call(print, "typeParameters")]); + + case "TSClassImplements": + return concat$6([path.call(print, "expression"), path.call(print, "typeParameters")]); + + case "TSIntersectionType": + case "IntersectionTypeAnnotation": + { + const types = path.map(print, "types"); + const result = []; + let wasIndented = false; + + for (let i = 0; i < types.length; ++i) { + if (i === 0) { + result.push(types[i]); + } else if (isObjectType$1(n.types[i - 1]) && isObjectType$1(n.types[i])) { + // If both are objects, don't indent + result.push(concat$6([" & ", wasIndented ? indent$3(types[i]) : types[i]])); + } else if (!isObjectType$1(n.types[i - 1]) && !isObjectType$1(n.types[i])) { + // If no object is involved, go to the next line if it breaks + result.push(indent$3(concat$6([" &", line$4, types[i]]))); + } else { + // If you go from object to non-object or vis-versa, then inline it + if (i > 1) { + wasIndented = true; + } + + result.push(" & ", i > 1 ? indent$3(types[i]) : types[i]); + } + } + + return group$2(concat$6(result)); + } + + case "TSUnionType": + case "UnionTypeAnnotation": + { + // single-line variation + // A | B | C + // multi-line variation + // | A + // | B + // | C + const parent = path.getParentNode(); // If there's a leading comment, the parent is doing the indentation + + const shouldIndent = parent.type !== "TypeParameterInstantiation" && parent.type !== "TSTypeParameterInstantiation" && parent.type !== "GenericTypeAnnotation" && parent.type !== "TSTypeReference" && parent.type !== "TSTypeAssertion" && parent.type !== "TupleTypeAnnotation" && parent.type !== "TSTupleType" && !(parent.type === "FunctionTypeParam" && !parent.name) && !((parent.type === "TypeAlias" || parent.type === "VariableDeclarator" || parent.type === "TSTypeAliasDeclaration") && hasLeadingOwnLineComment$1(options.originalText, n, options)); // { + // a: string + // } | null | void + // should be inlined and not be printed in the multi-line variant + + const shouldHug = shouldHugType(n); // We want to align the children but without its comment, so it looks like + // | child1 + // // comment + // | child2 + + const printed = path.map(typePath => { + let printedType = typePath.call(print); + + if (!shouldHug) { + printedType = align$1(2, printedType); + } + + return comments.printComments(typePath, () => printedType, options); + }, "types"); + + if (shouldHug) { + return join$4(" | ", printed); + } + + const shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment$1(options.originalText, n, options); + const code = concat$6([ifBreak$1(concat$6([shouldAddStartLine ? line$4 : "", "| "])), join$4(concat$6([line$4, "| "]), printed)]); + + if (needsParens_1(path, options)) { + return group$2(concat$6([indent$3(code), softline$2])); + } + + if (parent.type === "TupleTypeAnnotation" && parent.types.length > 1 || parent.type === "TSTupleType" && parent.elementTypes.length > 1) { + return group$2(concat$6([indent$3(concat$6([ifBreak$1(concat$6(["(", softline$2])), code])), softline$2, ifBreak$1(")")])); + } + + return group$2(shouldIndent ? indent$3(code) : code); + } + + case "NullableTypeAnnotation": + return concat$6(["?", path.call(print, "typeAnnotation")]); + + case "TSNullKeyword": + case "NullLiteralTypeAnnotation": + return "null"; + + case "ThisTypeAnnotation": + return "this"; + + case "NumberTypeAnnotation": + return "number"; + + case "SymbolTypeAnnotation": + return "symbol"; + + case "ObjectTypeCallProperty": + if (n.static) { + parts.push("static "); + } + + parts.push(path.call(print, "value")); + return concat$6(parts); + + case "ObjectTypeIndexer": + { + const variance = getFlowVariance$1(n); + return concat$6([variance || "", "[", path.call(print, "id"), n.id ? ": " : "", path.call(print, "key"), "]: ", path.call(print, "value")]); + } + + case "ObjectTypeProperty": + { + const variance = getFlowVariance$1(n); + let modifier = ""; + + if (n.proto) { + modifier = "proto "; + } else if (n.static) { + modifier = "static "; + } + + return concat$6([modifier, isGetterOrSetter$1(n) ? n.kind + " " : "", variance || "", printPropertyKey(path, options, print), printOptionalToken(path), isFunctionNotation$1(n, options) ? "" : ": ", path.call(print, "value")]); + } + + case "QualifiedTypeIdentifier": + return concat$6([path.call(print, "qualification"), ".", path.call(print, "id")]); + + case "StringLiteralTypeAnnotation": + return nodeStr(n, options); + + case "NumberLiteralTypeAnnotation": + assert$1.strictEqual(typeof n.value, "number"); + + if (n.extra != null) { + return printNumber$1(n.extra.raw); + } + + return printNumber$1(n.raw); + + case "StringTypeAnnotation": + return "string"; + + case "DeclareTypeAlias": + case "TypeAlias": + { + if (n.type === "DeclareTypeAlias" || n.declare) { + parts.push("declare "); + } + + const printed = printAssignmentRight(n.id, n.right, path.call(print, "right"), options); + parts.push("type ", path.call(print, "id"), path.call(print, "typeParameters"), " =", printed, semi); + return group$2(concat$6(parts)); + } + + case "TypeCastExpression": + { + return concat$6(["(", path.call(print, "expression"), printTypeAnnotation(path, options, print), ")"]); + } + + case "TypeParameterDeclaration": + case "TypeParameterInstantiation": + { + const value = path.getValue(); + const commentStart = value.range ? options.originalText.slice(0, value.range[0]).lastIndexOf("/*") : -1; // As noted in the TypeCastExpression comments above, we're able to use a normal whitespace regex here + // because we know for sure that this is a type definition. + + const commentSyntax = commentStart >= 0 && options.originalText.slice(commentStart).match(/^\/\*\s*::/); + + if (commentSyntax) { + return concat$6(["/*:: ", printTypeParameters(path, options, print, "params"), " */"]); + } + + return printTypeParameters(path, options, print, "params"); + } + + case "TSTypeParameterDeclaration": + case "TSTypeParameterInstantiation": + return printTypeParameters(path, options, print, "params"); + + case "TSTypeParameter": + case "TypeParameter": + { + const parent = path.getParentNode(); + + if (parent.type === "TSMappedType") { + parts.push("[", path.call(print, "name")); + + if (n.constraint) { + parts.push(" in ", path.call(print, "constraint")); + } + + parts.push("]"); + return concat$6(parts); + } + + const variance = getFlowVariance$1(n); + + if (variance) { + parts.push(variance); + } + + parts.push(path.call(print, "name")); + + if (n.bound) { + parts.push(": "); + parts.push(path.call(print, "bound")); + } + + if (n.constraint) { + parts.push(" extends ", path.call(print, "constraint")); + } + + if (n.default) { + parts.push(" = ", path.call(print, "default")); + } // Keep comma if the file extension is .tsx and + // has one type parameter that isn't extend with any types. + // Because, otherwise formatted result will be invalid as tsx. + + + const grandParent = path.getNode(2); + + if (parent.params && parent.params.length === 1 && isTSXFile$1(options) && !n.constraint && grandParent.type === "ArrowFunctionExpression") { + parts.push(","); + } + + return concat$6(parts); + } + + case "TypeofTypeAnnotation": + return concat$6(["typeof ", path.call(print, "argument")]); + + case "VoidTypeAnnotation": + return "void"; + + case "InferredPredicate": + return "%checks"; + // Unhandled types below. If encountered, nodes of these types should + // be either left alone or desugared into AST types that are fully + // supported by the pretty-printer. + + case "DeclaredPredicate": + return concat$6(["%checks(", path.call(print, "value"), ")"]); + + case "TSAbstractKeyword": + return "abstract"; + + case "TSAnyKeyword": + return "any"; + + case "TSAsyncKeyword": + return "async"; + + case "TSBooleanKeyword": + return "boolean"; + + case "TSBigIntKeyword": + return "bigint"; + + case "TSConstKeyword": + return "const"; + + case "TSDeclareKeyword": + return "declare"; + + case "TSExportKeyword": + return "export"; + + case "TSNeverKeyword": + return "never"; + + case "TSNumberKeyword": + return "number"; + + case "TSObjectKeyword": + return "object"; + + case "TSProtectedKeyword": + return "protected"; + + case "TSPrivateKeyword": + return "private"; + + case "TSPublicKeyword": + return "public"; + + case "TSReadonlyKeyword": + return "readonly"; + + case "TSSymbolKeyword": + return "symbol"; + + case "TSStaticKeyword": + return "static"; + + case "TSStringKeyword": + return "string"; + + case "TSUndefinedKeyword": + return "undefined"; + + case "TSUnknownKeyword": + return "unknown"; + + case "TSVoidKeyword": + return "void"; + + case "TSAsExpression": + return concat$6([path.call(print, "expression"), " as ", path.call(print, "typeAnnotation")]); + + case "TSArrayType": + return concat$6([path.call(print, "elementType"), "[]"]); + + case "TSPropertySignature": + { + if (n.export) { + parts.push("export "); + } + + if (n.accessibility) { + parts.push(n.accessibility + " "); + } + + if (n.static) { + parts.push("static "); + } + + if (n.readonly) { + parts.push("readonly "); + } + + parts.push(printPropertyKey(path, options, print), printOptionalToken(path)); + + if (n.typeAnnotation) { + parts.push(": "); + parts.push(path.call(print, "typeAnnotation")); + } // This isn't valid semantically, but it's in the AST so we can print it. + + + if (n.initializer) { + parts.push(" = ", path.call(print, "initializer")); + } + + return concat$6(parts); + } + + case "TSParameterProperty": + if (n.accessibility) { + parts.push(n.accessibility + " "); + } + + if (n.export) { + parts.push("export "); + } + + if (n.static) { + parts.push("static "); + } + + if (n.readonly) { + parts.push("readonly "); + } + + parts.push(path.call(print, "parameter")); + return concat$6(parts); + + case "TSTypeReference": + return concat$6([path.call(print, "typeName"), printTypeParameters(path, options, print, "typeParameters")]); + + case "TSTypeQuery": + return concat$6(["typeof ", path.call(print, "exprName")]); + + case "TSIndexSignature": + { + const parent = path.getParentNode(); // The typescript parser accepts multiple parameters here. If you're + // using them, it makes sense to have a trailing comma. But if you + // aren't, this is more like a computed property name than an array. + // So we leave off the trailing comma when there's just one parameter. + + const trailingComma = n.parameters.length > 1 ? ifBreak$1(shouldPrintComma(options) ? "," : "") : ""; + const parametersGroup = group$2(concat$6([indent$3(concat$6([softline$2, join$4(concat$6([", ", softline$2]), path.map(print, "parameters"))])), trailingComma, softline$2])); + return concat$6([n.export ? "export " : "", n.accessibility ? concat$6([n.accessibility, " "]) : "", n.static ? "static " : "", n.readonly ? "readonly " : "", "[", n.parameters ? parametersGroup : "", n.typeAnnotation ? "]: " : "]", n.typeAnnotation ? path.call(print, "typeAnnotation") : "", parent.type === "ClassBody" ? semi : ""]); + } + + case "TSTypePredicate": + return concat$6([n.asserts ? "asserts " : "", path.call(print, "parameterName"), n.typeAnnotation ? concat$6([" is ", path.call(print, "typeAnnotation")]) : ""]); + + case "TSNonNullExpression": + return concat$6([path.call(print, "expression"), "!"]); + + case "TSThisType": + return "this"; + + case "TSImportType": + return concat$6([!n.isTypeOf ? "" : "typeof ", "import(", path.call(print, n.parameter ? "parameter" : "argument"), ")", !n.qualifier ? "" : concat$6([".", path.call(print, "qualifier")]), printTypeParameters(path, options, print, "typeParameters")]); + + case "TSLiteralType": + return path.call(print, "literal"); + + case "TSIndexedAccessType": + return concat$6([path.call(print, "objectType"), "[", path.call(print, "indexType"), "]"]); + + case "TSConstructSignatureDeclaration": + case "TSCallSignatureDeclaration": + case "TSConstructorType": + { + if (n.type !== "TSCallSignatureDeclaration") { + parts.push("new "); + } + + parts.push(group$2(printFunctionParams(path, print, options, + /* expandArg */ + false, + /* printTypeParams */ + true))); + + if (n.returnType || n.typeAnnotation) { + const isType = n.type === "TSConstructorType"; + parts.push(isType ? " => " : ": ", path.call(print, "returnType"), path.call(print, "typeAnnotation")); + } + + return concat$6(parts); + } + + case "TSTypeOperator": + return concat$6([n.operator, " ", path.call(print, "typeAnnotation")]); + + case "TSMappedType": + { + const shouldBreak = hasNewlineInRange$3(options.originalText, options.locStart(n), options.locEnd(n)); + return group$2(concat$6(["{", indent$3(concat$6([options.bracketSpacing ? line$4 : softline$2, n.readonly ? concat$6([getTypeScriptMappedTypeModifier$1(n.readonly, "readonly"), " "]) : "", printTypeScriptModifiers(path, options, print), path.call(print, "typeParameter"), n.optional ? getTypeScriptMappedTypeModifier$1(n.optional, "?") : "", n.typeAnnotation ? ": " : "", path.call(print, "typeAnnotation"), ifBreak$1(semi, "")])), comments.printDanglingComments(path, options, + /* sameIndent */ + true), options.bracketSpacing ? line$4 : softline$2, "}"]), { + shouldBreak + }); + } + + case "TSMethodSignature": + parts.push(n.accessibility ? concat$6([n.accessibility, " "]) : "", n.export ? "export " : "", n.static ? "static " : "", n.readonly ? "readonly " : "", n.computed ? "[" : "", path.call(print, "key"), n.computed ? "]" : "", printOptionalToken(path), printFunctionParams(path, print, options, + /* expandArg */ + false, + /* printTypeParams */ + true)); + + if (n.returnType || n.typeAnnotation) { + parts.push(": ", path.call(print, "returnType"), path.call(print, "typeAnnotation")); + } + + return group$2(concat$6(parts)); + + case "TSNamespaceExportDeclaration": + parts.push("export as namespace ", path.call(print, "id")); + + if (options.semi) { + parts.push(";"); + } + + return group$2(concat$6(parts)); + + case "TSEnumDeclaration": + if (n.declare) { + parts.push("declare "); + } + + if (n.modifiers) { + parts.push(printTypeScriptModifiers(path, options, print)); + } + + if (n.const) { + parts.push("const "); + } + + parts.push("enum ", path.call(print, "id"), " "); + + if (n.members.length === 0) { + parts.push(group$2(concat$6(["{", comments.printDanglingComments(path, options), softline$2, "}"]))); + } else { + parts.push(group$2(concat$6(["{", indent$3(concat$6([hardline$4, printArrayItems(path, options, "members", print), shouldPrintComma(options, "es5") ? "," : ""])), comments.printDanglingComments(path, options, + /* sameIndent */ + true), hardline$4, "}"]))); + } + + return concat$6(parts); + + case "TSEnumMember": + parts.push(path.call(print, "id")); + + if (n.initializer) { + parts.push(" = ", path.call(print, "initializer")); + } + + return concat$6(parts); + + case "TSImportEqualsDeclaration": + if (n.isExport) { + parts.push("export "); + } + + parts.push("import ", path.call(print, "id"), " = ", path.call(print, "moduleReference")); + + if (options.semi) { + parts.push(";"); + } + + return group$2(concat$6(parts)); + + case "TSExternalModuleReference": + return concat$6(["require(", path.call(print, "expression"), ")"]); + + case "TSModuleDeclaration": + { + const parent = path.getParentNode(); + const isExternalModule = isLiteral$1(n.id); + const parentIsDeclaration = parent.type === "TSModuleDeclaration"; + const bodyIsDeclaration = n.body && n.body.type === "TSModuleDeclaration"; + + if (parentIsDeclaration) { + parts.push("."); + } else { + if (n.declare) { + parts.push("declare "); + } + + parts.push(printTypeScriptModifiers(path, options, print)); + const textBetweenNodeAndItsId = options.originalText.slice(options.locStart(n), options.locStart(n.id)); // Global declaration looks like this: + // (declare)? global { ... } + + const isGlobalDeclaration = n.id.type === "Identifier" && n.id.name === "global" && !/namespace|module/.test(textBetweenNodeAndItsId); + + if (!isGlobalDeclaration) { + parts.push(isExternalModule || /(^|\s)module(\s|$)/.test(textBetweenNodeAndItsId) ? "module " : "namespace "); + } + } + + parts.push(path.call(print, "id")); + + if (bodyIsDeclaration) { + parts.push(path.call(print, "body")); + } else if (n.body) { + parts.push(" ", group$2(path.call(print, "body"))); + } else { + parts.push(semi); + } + + return concat$6(parts); + } + + case "PrivateName": + return concat$6(["#", path.call(print, "id")]); + // TODO: Temporary auto-generated node type. To remove when typescript-estree has proper support for private fields. + + case "TSPrivateIdentifier": + return n.escapedText; + + case "TSConditionalType": + return printTernaryOperator(path, options, print, { + beforeParts: () => [path.call(print, "checkType"), " ", "extends", " ", path.call(print, "extendsType")], + afterParts: () => [], + shouldCheckJsx: false, + conditionalNodeType: "TSConditionalType", + consequentNodePropertyName: "trueType", + alternateNodePropertyName: "falseType", + testNodePropertyNames: ["checkType", "extendsType"] + }); + + case "TSInferType": + return concat$6(["infer", " ", path.call(print, "typeParameter")]); + + case "InterpreterDirective": + parts.push("#!", n.value, hardline$4); + + if (isNextLineEmpty$2(options.originalText, n, options.locEnd)) { + parts.push(hardline$4); + } + + return concat$6(parts); + + case "NGRoot": + return concat$6([].concat(path.call(print, "node"), !n.node.comments || n.node.comments.length === 0 ? [] : concat$6([" //", n.node.comments[0].value.trimEnd()]))); + + case "NGChainedExpression": + return group$2(join$4(concat$6([";", line$4]), path.map(childPath => hasNgSideEffect$1(childPath) ? print(childPath) : concat$6(["(", print(childPath), ")"]), "expressions"))); + + case "NGEmptyExpression": + return ""; + + case "NGQuotedExpression": + return concat$6([n.prefix, ": ", n.value.trim()]); + + case "NGMicrosyntax": + return concat$6(path.map((childPath, index) => concat$6([index === 0 ? "" : isNgForOf$1(childPath.getValue(), index, n) ? " " : concat$6([";", line$4]), print(childPath)]), "body")); + + case "NGMicrosyntaxKey": + return /^[a-z_$][a-z0-9_$]*(-[a-z_$][a-z0-9_$])*$/i.test(n.name) ? n.name : JSON.stringify(n.name); + + case "NGMicrosyntaxExpression": + return concat$6([path.call(print, "expression"), n.alias === null ? "" : concat$6([" as ", path.call(print, "alias")])]); + + case "NGMicrosyntaxKeyedExpression": + { + const index = path.getName(); + const parentNode = path.getParentNode(); + const shouldNotPrintColon = isNgForOf$1(n, index, parentNode) || (index === 1 && (n.key.name === "then" || n.key.name === "else") || index === 2 && n.key.name === "else" && parentNode.body[index - 1].type === "NGMicrosyntaxKeyedExpression" && parentNode.body[index - 1].key.name === "then") && parentNode.body[0].type === "NGMicrosyntaxExpression"; + return concat$6([path.call(print, "key"), shouldNotPrintColon ? " " : ": ", path.call(print, "expression")]); + } + + case "NGMicrosyntaxLet": + return concat$6(["let ", path.call(print, "key"), n.value === null ? "" : concat$6([" = ", path.call(print, "value")])]); + + case "NGMicrosyntaxAs": + return concat$6([path.call(print, "key"), " as ", path.call(print, "alias")]); + + case "ArgumentPlaceholder": + return "?"; + // These are not valid TypeScript. Printing them just for the sake of error recovery. + + case "TSJSDocAllType": + return "*"; + + case "TSJSDocUnknownType": + return "?"; + + case "TSJSDocNullableType": + return concat$6(["?", path.call(print, "typeAnnotation")]); + + case "TSJSDocNonNullableType": + return concat$6(["!", path.call(print, "typeAnnotation")]); + + case "TSJSDocFunctionType": + return concat$6(["function(", // The parameters could be here, but typescript-estree doesn't convert them anyway (throws an error). + "): ", path.call(print, "typeAnnotation")]); + + default: + /* istanbul ignore next */ + throw new Error("unknown type: " + JSON.stringify(n.type)); + } +} + +function printStatementSequence(path, options, print) { + const printed = []; + const bodyNode = path.getNode(); + const isClass = bodyNode.type === "ClassBody"; + path.map((stmtPath, i) => { + const stmt = stmtPath.getValue(); // Just in case the AST has been modified to contain falsy + // "statements," it's safer simply to skip them. + + /* istanbul ignore if */ + + if (!stmt) { + return; + } // Skip printing EmptyStatement nodes to avoid leaving stray + // semicolons lying around. + + + if (stmt.type === "EmptyStatement") { + return; + } + + const stmtPrinted = print(stmtPath); + const text = options.originalText; + const parts = []; // in no-semi mode, prepend statement with semicolon if it might break ASI + // don't prepend the only JSX element in a program with semicolon + + if (!options.semi && !isClass && !isTheOnlyJSXElementInMarkdown$1(options, stmtPath) && stmtNeedsASIProtection(stmtPath, options)) { + if (stmt.comments && stmt.comments.some(comment => comment.leading)) { + parts.push(print(stmtPath, { + needsSemi: true + })); + } else { + parts.push(";", stmtPrinted); + } + } else { + parts.push(stmtPrinted); + } + + if (!options.semi && isClass) { + if (classPropMayCauseASIProblems$1(stmtPath)) { + parts.push(";"); + } else if (stmt.type === "ClassProperty") { + const nextChild = bodyNode.body[i + 1]; + + if (classChildNeedsASIProtection$1(nextChild)) { + parts.push(";"); + } + } + } + + if (isNextLineEmpty$2(text, stmt, options.locEnd) && !isLastStatement$1(stmtPath)) { + parts.push(hardline$4); + } + + printed.push(concat$6(parts)); + }); + return join$4(hardline$4, printed); +} + +function printPropertyKey(path, options, print) { + const node = path.getNode(); + + if (node.computed) { + return concat$6(["[", path.call(print, "key"), "]"]); + } + + const parent = path.getParentNode(); + const { + key + } = node; + + if (node.type === "ClassPrivateProperty" && // flow has `Identifier` key, and babel has `PrivateName` key + key.type === "Identifier") { + return concat$6(["#", path.call(print, "key")]); + } + + if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) { + const objectHasStringProp = (parent.properties || parent.body || parent.members).some(prop => !prop.computed && prop.key && isStringLiteral$1(prop.key) && !isStringPropSafeToCoerceToIdentifier$1(prop, options)); + needsQuoteProps.set(parent, objectHasStringProp); + } + + if (key.type === "Identifier" && (options.parser === "json" || options.quoteProps === "consistent" && needsQuoteProps.get(parent))) { + // a -> "a" + const prop = printString$1(JSON.stringify(key.name), options); + return path.call(keyPath => comments.printComments(keyPath, () => prop, options), "key"); + } + + if (isStringPropSafeToCoerceToIdentifier$1(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) { + // 'a' -> a + return path.call(keyPath => comments.printComments(keyPath, () => key.value, options), "key"); + } + + return path.call(print, "key"); +} + +function printMethod(path, options, print) { + const node = path.getNode(); + const { + kind + } = node; + const value = node.value || node; + const parts = []; + + if (!kind || kind === "init" || kind === "method" || kind === "constructor") { + if (value.async) { + parts.push("async "); + } + + if (value.generator) { + parts.push("*"); + } + } else { + assert$1.ok(kind === "get" || kind === "set"); + parts.push(kind, " "); + } + + parts.push(printPropertyKey(path, options, print), node.optional || node.key.optional ? "?" : "", node === value ? printMethodInternal(path, options, print) : path.call(path => printMethodInternal(path, options, print), "value")); + return concat$6(parts); +} + +function printMethodInternal(path, options, print) { + const parts = [printFunctionTypeParameters(path, options, print), group$2(concat$6([printFunctionParams(path, print, options), printReturnType(path, print, options)]))]; + + if (path.getNode().body) { + parts.push(" ", path.call(print, "body")); + } else { + parts.push(options.semi ? ";" : ""); + } + + return concat$6(parts); +} + +function couldGroupArg(arg) { + return arg.type === "ObjectExpression" && (arg.properties.length > 0 || arg.comments) || arg.type === "ArrayExpression" && (arg.elements.length > 0 || arg.comments) || arg.type === "TSTypeAssertion" && couldGroupArg(arg.expression) || arg.type === "TSAsExpression" && couldGroupArg(arg.expression) || arg.type === "FunctionExpression" || arg.type === "ArrowFunctionExpression" && ( // we want to avoid breaking inside composite return types but not simple keywords + // https://github.com/prettier/prettier/issues/4070 + // export class Thing implements OtherThing { + // do: (type: Type) => Provider = memoize( + // (type: ObjectType): Provider => {} + // ); + // } + // https://github.com/prettier/prettier/issues/6099 + // app.get("/", (req, res): void => { + // res.send("Hello World!"); + // }); + !arg.returnType || !arg.returnType.typeAnnotation || arg.returnType.typeAnnotation.type !== "TSTypeReference") && (arg.body.type === "BlockStatement" || arg.body.type === "ArrowFunctionExpression" || arg.body.type === "ObjectExpression" || arg.body.type === "ArrayExpression" || arg.body.type === "CallExpression" || arg.body.type === "OptionalCallExpression" || arg.body.type === "ConditionalExpression" || isJSXNode$1(arg.body)); +} + +function shouldGroupLastArg(args) { + const lastArg = getLast$2(args); + const penultimateArg = getPenultimate$1(args); + return !hasLeadingComment$3(lastArg) && !hasTrailingComment$1(lastArg) && couldGroupArg(lastArg) && ( // If the last two arguments are of the same type, + // disable last element expansion. + !penultimateArg || penultimateArg.type !== lastArg.type); +} + +function shouldGroupFirstArg(args) { + if (args.length !== 2) { + return false; + } + + const [firstArg, secondArg] = args; + return (!firstArg.comments || !firstArg.comments.length) && (firstArg.type === "FunctionExpression" || firstArg.type === "ArrowFunctionExpression" && firstArg.body.type === "BlockStatement") && secondArg.type !== "FunctionExpression" && secondArg.type !== "ArrowFunctionExpression" && secondArg.type !== "ConditionalExpression" && !couldGroupArg(secondArg); +} + +function printJestEachTemplateLiteral(node, expressions, options) { + /** + * a | b | expected + * ${1} | ${1} | ${2} + * ${1} | ${2} | ${3} + * ${2} | ${1} | ${3} + */ + const headerNames = node.quasis[0].value.raw.trim().split(/\s*\|\s*/); + + if (headerNames.length > 1 || headerNames.some(headerName => headerName.length !== 0)) { + const parts = []; + const stringifiedExpressions = expressions.map(doc => "${" + printDocToString$2(doc, Object.assign({}, options, { + printWidth: Infinity, + endOfLine: "lf" + })).formatted + "}"); + const tableBody = [{ + hasLineBreak: false, + cells: [] + }]; + + for (let i = 1; i < node.quasis.length; i++) { + const row = tableBody[tableBody.length - 1]; + const correspondingExpression = stringifiedExpressions[i - 1]; + row.cells.push(correspondingExpression); + + if (correspondingExpression.includes("\n")) { + row.hasLineBreak = true; + } + + if (node.quasis[i].value.raw.includes("\n")) { + tableBody.push({ + hasLineBreak: false, + cells: [] + }); + } + } + + const maxColumnCount = Math.max(headerNames.length, ...tableBody.map(row => row.cells.length)); + const maxColumnWidths = Array.from({ + length: maxColumnCount + }).fill(0); + const table = [{ + cells: headerNames + }, ...tableBody.filter(row => row.cells.length !== 0)]; + + for (const { + cells + } of table.filter(row => !row.hasLineBreak)) { + cells.forEach((cell, index) => { + maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$3(cell)); + }); + } + + parts.push(lineSuffixBoundary$1, "`", indent$3(concat$6([hardline$4, join$4(hardline$4, table.map(row => join$4(" | ", row.cells.map((cell, index) => row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$3(cell))))))])), hardline$4, "`"); + return concat$6(parts); + } +} + +function printArgumentsList(path, options, print) { + const node = path.getValue(); + const args = node.arguments; + + if (args.length === 0) { + return concat$6(["(", comments.printDanglingComments(path, options, + /* sameIndent */ + true), ")"]); + } // useEffect(() => { ... }, [foo, bar, baz]) + + + if (args.length === 2 && args[0].type === "ArrowFunctionExpression" && args[0].params.length === 0 && args[0].body.type === "BlockStatement" && args[1].type === "ArrayExpression" && !args.find(arg => arg.comments)) { + return concat$6(["(", path.call(print, "arguments", 0), ", ", path.call(print, "arguments", 1), ")"]); + } // func( + // ({ + // a, + // b + // }) => {} + // ); + + + function shouldBreakForArrowFunctionInArguments(arg, argPath) { + if (!arg || arg.type !== "ArrowFunctionExpression" || !arg.body || arg.body.type !== "BlockStatement" || !arg.params || arg.params.length < 1) { + return false; + } + + let shouldBreak = false; + argPath.each(paramPath => { + const printed = concat$6([print(paramPath)]); + shouldBreak = shouldBreak || willBreak$1(printed); + }, "params"); + return shouldBreak; + } + + let anyArgEmptyLine = false; + let shouldBreakForArrowFunction = false; + let hasEmptyLineFollowingFirstArg = false; + const lastArgIndex = args.length - 1; + const printedArguments = path.map((argPath, index) => { + const arg = argPath.getNode(); + const parts = [print(argPath)]; + + if (index === lastArgIndex) ; else if (isNextLineEmpty$2(options.originalText, arg, options.locEnd)) { + if (index === 0) { + hasEmptyLineFollowingFirstArg = true; + } + + anyArgEmptyLine = true; + parts.push(",", hardline$4, hardline$4); + } else { + parts.push(",", line$4); + } + + shouldBreakForArrowFunction = shouldBreakForArrowFunctionInArguments(arg, argPath); + return concat$6(parts); + }, "arguments"); + const maybeTrailingComma = // Dynamic imports cannot have trailing commas + !(node.callee && node.callee.type === "Import") && shouldPrintComma(options, "all") ? "," : ""; + + function allArgsBrokenOut() { + return group$2(concat$6(["(", indent$3(concat$6([line$4, concat$6(printedArguments)])), maybeTrailingComma, line$4, ")"]), { + shouldBreak: true + }); + } + + if (path.getParentNode().type !== "Decorator" && isFunctionCompositionArgs$1(args)) { + return allArgsBrokenOut(); + } + + const shouldGroupFirst = shouldGroupFirstArg(args); + const shouldGroupLast = shouldGroupLastArg(args); + + if (shouldGroupFirst || shouldGroupLast) { + const shouldBreak = (shouldGroupFirst ? printedArguments.slice(1).some(willBreak$1) : printedArguments.slice(0, -1).some(willBreak$1)) || anyArgEmptyLine || shouldBreakForArrowFunction; // We want to print the last argument with a special flag + + let printedExpanded; + let i = 0; + path.each(argPath => { + if (shouldGroupFirst && i === 0) { + printedExpanded = [concat$6([argPath.call(p => print(p, { + expandFirstArg: true + })), printedArguments.length > 1 ? "," : "", hasEmptyLineFollowingFirstArg ? hardline$4 : line$4, hasEmptyLineFollowingFirstArg ? hardline$4 : ""])].concat(printedArguments.slice(1)); + } + + if (shouldGroupLast && i === args.length - 1) { + printedExpanded = printedArguments.slice(0, -1).concat(argPath.call(p => print(p, { + expandLastArg: true + }))); + } + + i++; + }, "arguments"); + const somePrintedArgumentsWillBreak = printedArguments.some(willBreak$1); + const simpleConcat = concat$6(["(", concat$6(printedExpanded), ")"]); + return concat$6([somePrintedArgumentsWillBreak ? breakParent$2 : "", conditionalGroup$1([!somePrintedArgumentsWillBreak && !node.typeArguments && !node.typeParameters ? simpleConcat : ifBreak$1(allArgsBrokenOut(), simpleConcat), shouldGroupFirst ? concat$6(["(", group$2(printedExpanded[0], { + shouldBreak: true + }), concat$6(printedExpanded.slice(1)), ")"]) : concat$6(["(", concat$6(printedArguments.slice(0, -1)), group$2(getLast$2(printedExpanded), { + shouldBreak: true + }), ")"]), allArgsBrokenOut()], { + shouldBreak + })]); + } + + const contents = concat$6(["(", indent$3(concat$6([softline$2, concat$6(printedArguments)])), ifBreak$1(maybeTrailingComma), softline$2, ")"]); + + if (isLongCurriedCallExpression$1(path)) { + // By not wrapping the arguments in a group, the printer prioritizes + // breaking up these arguments rather than the args of the parent call. + return contents; + } + + return group$2(contents, { + shouldBreak: printedArguments.some(willBreak$1) || anyArgEmptyLine + }); +} + +function printTypeAnnotation(path, options, print) { + const node = path.getValue(); + + if (!node.typeAnnotation) { + return ""; + } + + const parentNode = path.getParentNode(); + const isDefinite = node.definite || parentNode && parentNode.type === "VariableDeclarator" && parentNode.definite; + const isFunctionDeclarationIdentifier = parentNode.type === "DeclareFunction" && parentNode.id === node; + + if (isFlowAnnotationComment$1(options.originalText, node.typeAnnotation, options)) { + return concat$6([" /*: ", path.call(print, "typeAnnotation"), " */"]); + } + + return concat$6([isFunctionDeclarationIdentifier ? "" : isDefinite ? "!: " : ": ", path.call(print, "typeAnnotation")]); +} + +function printFunctionTypeParameters(path, options, print) { + const fun = path.getValue(); + + if (fun.typeArguments) { + return path.call(print, "typeArguments"); + } + + if (fun.typeParameters) { + return path.call(print, "typeParameters"); + } + + return ""; +} + +function printFunctionParams(path, print, options, expandArg, printTypeParams) { + const fun = path.getValue(); + const parent = path.getParentNode(); + const paramsField = fun.parameters ? "parameters" : "params"; + const isParametersInTestCall = isTestCall$1(parent); + const shouldHugParameters = shouldHugArguments(fun); + const shouldExpandParameters = expandArg && !(fun[paramsField] && fun[paramsField].some(n => n.comments)); + const typeParams = printTypeParams ? printFunctionTypeParameters(path, options, print) : ""; + let printed = []; + + if (fun[paramsField]) { + const lastArgIndex = fun[paramsField].length - 1; + printed = path.map((childPath, index) => { + const parts = []; + const param = childPath.getValue(); + parts.push(print(childPath)); + + if (index === lastArgIndex) { + if (fun.rest) { + parts.push(",", line$4); + } + } else if (isParametersInTestCall || shouldHugParameters || shouldExpandParameters) { + parts.push(", "); + } else if (isNextLineEmpty$2(options.originalText, param, options.locEnd)) { + parts.push(",", hardline$4, hardline$4); + } else { + parts.push(",", line$4); + } + + return concat$6(parts); + }, paramsField); + } + + if (fun.rest) { + printed.push(concat$6(["...", path.call(print, "rest")])); + } + + if (printed.length === 0) { + return concat$6([typeParams, "(", comments.printDanglingComments(path, options, + /* sameIndent */ + true, comment => getNextNonSpaceNonCommentCharacter$1(options.originalText, comment, options.locEnd) === ")"), ")"]); + } + + const lastParam = getLast$2(fun[paramsField]); // If the parent is a call with the first/last argument expansion and this is the + // params of the first/last argument, we don't want the arguments to break and instead + // want the whole expression to be on a new line. + // + // Good: Bad: + // verylongcall( verylongcall(( + // (a, b) => { a, + // } b, + // }) ) => { + // }) + + if (shouldExpandParameters) { + return group$2(concat$6([removeLines$1(typeParams), "(", concat$6(printed.map(removeLines$1)), ")"])); + } // Single object destructuring should hug + // + // function({ + // a, + // b, + // c + // }) {} + + + const hasNotParameterDecorator = fun[paramsField].every(param => !param.decorators); + + if (shouldHugParameters && hasNotParameterDecorator) { + return concat$6([typeParams, "(", concat$6(printed), ")"]); + } // don't break in specs, eg; `it("should maintain parens around done even when long", (done) => {})` + + + if (isParametersInTestCall) { + return concat$6([typeParams, "(", concat$6(printed), ")"]); + } + + const isFlowShorthandWithOneArg = (isObjectTypePropertyAFunction$1(parent, options) || isTypeAnnotationAFunction$1(parent, options) || parent.type === "TypeAlias" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || parent.type === "IntersectionTypeAnnotation" || parent.type === "FunctionTypeAnnotation" && parent.returnType === fun) && fun[paramsField].length === 1 && fun[paramsField][0].name === null && fun[paramsField][0].typeAnnotation && fun.typeParameters === null && isSimpleFlowType$1(fun[paramsField][0].typeAnnotation) && !fun.rest; + + if (isFlowShorthandWithOneArg) { + if (options.arrowParens === "always") { + return concat$6(["(", concat$6(printed), ")"]); + } + + return concat$6(printed); + } + + const canHaveTrailingComma = !(lastParam && lastParam.type === "RestElement") && !fun.rest; + return concat$6([typeParams, "(", indent$3(concat$6([softline$2, concat$6(printed)])), ifBreak$1(canHaveTrailingComma && shouldPrintComma(options, "all") ? "," : ""), softline$2, ")"]); +} + +function shouldPrintParamsWithoutParens(path, options) { + if (options.arrowParens === "always") { + return false; + } + + if (options.arrowParens === "avoid") { + const node = path.getValue(); + return canPrintParamsWithoutParens(node); + } // Fallback default; should be unreachable + + + return false; +} + +function canPrintParamsWithoutParens(node) { + return node.params.length === 1 && !node.rest && !node.typeParameters && !hasDanglingComments$1(node) && node.params[0].type === "Identifier" && !node.params[0].typeAnnotation && !node.params[0].comments && !node.params[0].optional && !node.predicate && !node.returnType; +} + +function printFunctionDeclaration(path, print, options) { + const n = path.getValue(); + const parts = []; + + if (n.async) { + parts.push("async "); + } + + if (n.generator) { + parts.push("function* "); + } else { + parts.push("function "); + } + + if (n.id) { + parts.push(path.call(print, "id")); + } + + parts.push(printFunctionTypeParameters(path, options, print), group$2(concat$6([printFunctionParams(path, print, options), printReturnType(path, print, options)])), n.body ? " " : "", path.call(print, "body")); + return concat$6(parts); +} + +function printReturnType(path, print, options) { + const n = path.getValue(); + const returnType = path.call(print, "returnType"); + + if (n.returnType && isFlowAnnotationComment$1(options.originalText, n.returnType, options)) { + return concat$6([" /*: ", returnType, " */"]); + } + + const parts = [returnType]; // prepend colon to TypeScript type annotation + + if (n.returnType && n.returnType.typeAnnotation) { + parts.unshift(": "); + } + + if (n.predicate) { + // The return type will already add the colon, but otherwise we + // need to do it ourselves + parts.push(n.returnType ? " " : ": ", path.call(print, "predicate")); + } + + return concat$6(parts); +} + +function printExportDeclaration(path, options, print) { + const decl = path.getValue(); + const semi = options.semi ? ";" : ""; + const parts = ["export "]; + const isDefault = decl.default || decl.type === "ExportDefaultDeclaration"; + + if (isDefault) { + parts.push("default "); + } + + parts.push(comments.printDanglingComments(path, options, + /* sameIndent */ + true)); + + if (needsHardlineAfterDanglingComment$1(decl)) { + parts.push(hardline$4); + } + + if (decl.declaration) { + parts.push(path.call(print, "declaration")); + + if (isDefault && decl.declaration.type !== "ClassDeclaration" && decl.declaration.type !== "FunctionDeclaration" && decl.declaration.type !== "TSInterfaceDeclaration" && decl.declaration.type !== "DeclareClass" && decl.declaration.type !== "DeclareFunction" && decl.declaration.type !== "TSDeclareFunction") { + parts.push(semi); + } + } else { + if (decl.specifiers && decl.specifiers.length > 0) { + const specifiers = []; + const defaultSpecifiers = []; + const namespaceSpecifiers = []; + path.each(specifierPath => { + const specifierType = path.getValue().type; + + if (specifierType === "ExportSpecifier") { + specifiers.push(print(specifierPath)); + } else if (specifierType === "ExportDefaultSpecifier") { + defaultSpecifiers.push(print(specifierPath)); + } else if (specifierType === "ExportNamespaceSpecifier") { + namespaceSpecifiers.push(concat$6(["* as ", print(specifierPath)])); + } + }, "specifiers"); + const isNamespaceFollowed = namespaceSpecifiers.length !== 0 && specifiers.length !== 0; + const isDefaultFollowed = defaultSpecifiers.length !== 0 && (namespaceSpecifiers.length !== 0 || specifiers.length !== 0); + const canBreak = specifiers.length > 1 || defaultSpecifiers.length > 0 || decl.specifiers && decl.specifiers.some(node => node.comments); + let printed = ""; + + if (specifiers.length !== 0) { + if (canBreak) { + printed = group$2(concat$6(["{", indent$3(concat$6([options.bracketSpacing ? line$4 : softline$2, join$4(concat$6([",", line$4]), specifiers)])), ifBreak$1(shouldPrintComma(options) ? "," : ""), options.bracketSpacing ? line$4 : softline$2, "}"])); + } else { + printed = concat$6(["{", options.bracketSpacing ? " " : "", concat$6(specifiers), options.bracketSpacing ? " " : "", "}"]); + } + } + + parts.push(decl.exportKind === "type" ? "type " : "", concat$6(defaultSpecifiers), concat$6([isDefaultFollowed ? ", " : ""]), concat$6(namespaceSpecifiers), concat$6([isNamespaceFollowed ? ", " : ""]), printed); + } else { + parts.push("{}"); + } + + if (decl.source) { + parts.push(" from ", path.call(print, "source")); + } + + parts.push(semi); + } + + return concat$6(parts); +} + +function printFlowDeclaration(path, parts) { + const parentExportDecl = getParentExportDeclaration$1(path); + + if (parentExportDecl) { + assert$1.strictEqual(parentExportDecl.type, "DeclareExportDeclaration"); + } else { + // If the parent node has type DeclareExportDeclaration, then it + // will be responsible for printing the "declare" token. Otherwise + // it needs to be printed with this non-exported declaration node. + parts.unshift("declare "); + } + + return concat$6(parts); +} + +function printTypeScriptModifiers(path, options, print) { + const n = path.getValue(); + + if (!n.modifiers || !n.modifiers.length) { + return ""; + } + + return concat$6([join$4(" ", path.map(print, "modifiers")), " "]); +} + +function printTypeParameters(path, options, print, paramsKey) { + const n = path.getValue(); + + if (!n[paramsKey]) { + return ""; + } // for TypeParameterDeclaration typeParameters is a single node + + + if (!Array.isArray(n[paramsKey])) { + return path.call(print, paramsKey); + } + + const grandparent = path.getNode(2); + const greatGrandParent = path.getNode(3); + const greatGreatGrandParent = path.getNode(4); + const isParameterInTestCall = grandparent != null && isTestCall$1(grandparent); + const shouldInline = isParameterInTestCall || n[paramsKey].length === 0 || n[paramsKey].length === 1 && (shouldHugType(n[paramsKey][0]) || n[paramsKey][0].type === "GenericTypeAnnotation" && shouldHugType(n[paramsKey][0].id) || n[paramsKey][0].type === "TSTypeReference" && shouldHugType(n[paramsKey][0].typeName) || n[paramsKey][0].type === "NullableTypeAnnotation" || // See https://github.com/prettier/prettier/pull/6467 for the context. + greatGreatGrandParent && greatGreatGrandParent.type === "VariableDeclarator" && grandparent.type === "TSTypeAnnotation" && greatGrandParent.type !== "ArrowFunctionExpression" && n[paramsKey][0].type !== "TSUnionType" && n[paramsKey][0].type !== "UnionTypeAnnotation" && n[paramsKey][0].type !== "TSIntersectionType" && n[paramsKey][0].type !== "IntersectionTypeAnnotation" && n[paramsKey][0].type !== "TSConditionalType" && n[paramsKey][0].type !== "TSMappedType" && n[paramsKey][0].type !== "TSTypeOperator" && n[paramsKey][0].type !== "TSIndexedAccessType" && n[paramsKey][0].type !== "TSArrayType"); + + function printDanglingCommentsForInline(n) { + if (!hasDanglingComments$1(n)) { + return ""; + } + + const hasOnlyBlockComments = n.comments.every(comments$1.isBlockComment); + const printed = comments.printDanglingComments(path, options, + /* sameIndent */ + hasOnlyBlockComments); + + if (hasOnlyBlockComments) { + return printed; + } + + return concat$6([printed, hardline$4]); + } + + if (shouldInline) { + return concat$6(["<", join$4(", ", path.map(print, paramsKey)), printDanglingCommentsForInline(n), ">"]); + } + + return group$2(concat$6(["<", indent$3(concat$6([softline$2, join$4(concat$6([",", line$4]), path.map(print, paramsKey))])), ifBreak$1(options.parser !== "typescript" && options.parser !== "babel-ts" && shouldPrintComma(options, "all") ? "," : ""), softline$2, ">"])); +} + +function printClass(path, options, print) { + const n = path.getValue(); + const parts = []; + + if (n.abstract) { + parts.push("abstract "); + } + + parts.push("class"); + + if (n.id) { + parts.push(" ", path.call(print, "id")); + } + + parts.push(path.call(print, "typeParameters")); + const partsGroup = []; + + if (n.superClass) { + const printed = concat$6(["extends ", path.call(print, "superClass"), path.call(print, "superTypeParameters")]); // Keep old behaviour of extends in same line + // If there is only on extends and there are not comments + + if ((!n.implements || n.implements.length === 0) && (!n.superClass.comments || n.superClass.comments.length === 0)) { + parts.push(concat$6([" ", path.call(superClass => comments.printComments(superClass, () => printed, options), "superClass")])); + } else { + partsGroup.push(group$2(concat$6([line$4, path.call(superClass => comments.printComments(superClass, () => printed, options), "superClass")]))); + } + } else if (n.extends && n.extends.length > 0) { + parts.push(" extends ", join$4(", ", path.map(print, "extends"))); + } + + if (n.mixins && n.mixins.length > 0) { + partsGroup.push(line$4, "mixins ", group$2(indent$3(join$4(concat$6([",", line$4]), path.map(print, "mixins"))))); + } + + if (n.implements && n.implements.length > 0) { + partsGroup.push(line$4, "implements", group$2(indent$3(concat$6([line$4, join$4(concat$6([",", line$4]), path.map(print, "implements"))])))); + } + + if (partsGroup.length > 0) { + parts.push(group$2(indent$3(concat$6(partsGroup)))); + } + + if (n.body && n.body.comments && hasLeadingOwnLineComment$1(options.originalText, n.body, options)) { + parts.push(hardline$4); + } else { + parts.push(" "); + } + + parts.push(path.call(print, "body")); + return parts; +} + +function printOptionalToken(path) { + const node = path.getValue(); + + if (!node.optional || // It's an optional computed method parsed by typescript-estree. + // "?" is printed in `printMethod`. + node.type === "Identifier" && node === path.getParentNode().key) { + return ""; + } + + if (node.type === "OptionalCallExpression" || node.type === "OptionalMemberExpression" && node.computed) { + return "?."; + } + + return "?"; +} + +function printMemberLookup(path, options, print) { + const property = path.call(print, "property"); + const n = path.getValue(); + const optional = printOptionalToken(path); + + if (!n.computed) { + return concat$6([optional, ".", property]); + } + + if (!n.property || isNumericLiteral$1(n.property)) { + return concat$6([optional, "[", property, "]"]); + } + + return group$2(concat$6([optional, "[", indent$3(concat$6([softline$2, property])), softline$2, "]"])); +} + +function printBindExpressionCallee(path, options, print) { + return concat$6(["::", path.call(print, "callee")]); +} // We detect calls on member expressions specially to format a +// common pattern better. The pattern we are looking for is this: +// +// arr +// .map(x => x + 1) +// .filter(x => x > 10) +// .some(x => x % 2) +// +// The way it is structured in the AST is via a nested sequence of +// MemberExpression and CallExpression. We need to traverse the AST +// and make groups out of it to print it in the desired way. + + +function printMemberChain(path, options, print) { + // The first phase is to linearize the AST by traversing it down. + // + // a().b() + // has the following AST structure: + // CallExpression(MemberExpression(CallExpression(Identifier))) + // and we transform it into + // [Identifier, CallExpression, MemberExpression, CallExpression] + const printedNodes = []; // Here we try to retain one typed empty line after each call expression or + // the first group whether it is in parentheses or not + + function shouldInsertEmptyLineAfter(node) { + const { + originalText + } = options; + const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex$3(originalText, node, options.locEnd); + const nextChar = originalText.charAt(nextCharIndex); // if it is cut off by a parenthesis, we only account for one typed empty + // line after that parenthesis + + if (nextChar === ")") { + return isNextLineEmptyAfterIndex$2(originalText, nextCharIndex + 1, options.locEnd); + } + + return isNextLineEmpty$2(originalText, node, options.locEnd); + } + + function rec(path) { + const node = path.getValue(); + + if ((node.type === "CallExpression" || node.type === "OptionalCallExpression") && (isMemberish$1(node.callee) || node.callee.type === "CallExpression" || node.callee.type === "OptionalCallExpression")) { + printedNodes.unshift({ + node, + printed: concat$6([comments.printComments(path, () => concat$6([printOptionalToken(path), printFunctionTypeParameters(path, options, print), printArgumentsList(path, options, print)]), options), shouldInsertEmptyLineAfter(node) ? hardline$4 : ""]) + }); + path.call(callee => rec(callee), "callee"); + } else if (isMemberish$1(node)) { + printedNodes.unshift({ + node, + needsParens: needsParens_1(path, options), + printed: comments.printComments(path, () => node.type === "OptionalMemberExpression" || node.type === "MemberExpression" ? printMemberLookup(path, options, print) : printBindExpressionCallee(path, options, print), options) + }); + path.call(object => rec(object), "object"); + } else if (node.type === "TSNonNullExpression") { + printedNodes.unshift({ + node, + printed: comments.printComments(path, () => "!", options) + }); + path.call(expression => rec(expression), "expression"); + } else { + printedNodes.unshift({ + node, + printed: path.call(print) + }); + } + } // Note: the comments of the root node have already been printed, so we + // need to extract this first call without printing them as they would + // if handled inside of the recursive call. + + + const node = path.getValue(); + printedNodes.unshift({ + node, + printed: concat$6([printOptionalToken(path), printFunctionTypeParameters(path, options, print), printArgumentsList(path, options, print)]) + }); + path.call(callee => rec(callee), "callee"); // Once we have a linear list of printed nodes, we want to create groups out + // of it. + // + // a().b.c().d().e + // will be grouped as + // [ + // [Identifier, CallExpression], + // [MemberExpression, MemberExpression, CallExpression], + // [MemberExpression, CallExpression], + // [MemberExpression], + // ] + // so that we can print it as + // a() + // .b.c() + // .d() + // .e + // The first group is the first node followed by + // - as many CallExpression as possible + // < fn()()() >.something() + // - as many array accessors as possible + // < fn()[0][1][2] >.something() + // - then, as many MemberExpression as possible but the last one + // < this.items >.something() + + const groups = []; + let currentGroup = [printedNodes[0]]; + let i = 1; + + for (; i < printedNodes.length; ++i) { + if (printedNodes[i].node.type === "TSNonNullExpression" || printedNodes[i].node.type === "OptionalCallExpression" || printedNodes[i].node.type === "CallExpression" || (printedNodes[i].node.type === "MemberExpression" || printedNodes[i].node.type === "OptionalMemberExpression") && printedNodes[i].node.computed && isNumericLiteral$1(printedNodes[i].node.property)) { + currentGroup.push(printedNodes[i]); + } else { + break; + } + } + + if (printedNodes[0].node.type !== "CallExpression" && printedNodes[0].node.type !== "OptionalCallExpression") { + for (; i + 1 < printedNodes.length; ++i) { + if (isMemberish$1(printedNodes[i].node) && isMemberish$1(printedNodes[i + 1].node)) { + currentGroup.push(printedNodes[i]); + } else { + break; + } + } + } + + groups.push(currentGroup); + currentGroup = []; // Then, each following group is a sequence of MemberExpression followed by + // a sequence of CallExpression. To compute it, we keep adding things to the + // group until we has seen a CallExpression in the past and reach a + // MemberExpression + + let hasSeenCallExpression = false; + + for (; i < printedNodes.length; ++i) { + if (hasSeenCallExpression && isMemberish$1(printedNodes[i].node)) { + // [0] should be appended at the end of the group instead of the + // beginning of the next one + if (printedNodes[i].node.computed && isNumericLiteral$1(printedNodes[i].node.property)) { + currentGroup.push(printedNodes[i]); + continue; + } + + groups.push(currentGroup); + currentGroup = []; + hasSeenCallExpression = false; + } + + if (printedNodes[i].node.type === "CallExpression" || printedNodes[i].node.type === "OptionalCallExpression") { + hasSeenCallExpression = true; + } + + currentGroup.push(printedNodes[i]); + + if (printedNodes[i].node.comments && printedNodes[i].node.comments.some(comment => comment.trailing)) { + groups.push(currentGroup); + currentGroup = []; + hasSeenCallExpression = false; + } + } + + if (currentGroup.length > 0) { + groups.push(currentGroup); + } // There are cases like Object.keys(), Observable.of(), _.values() where + // they are the subject of all the chained calls and therefore should + // be kept on the same line: + // + // Object.keys(items) + // .filter(x => x) + // .map(x => x) + // + // In order to detect those cases, we use an heuristic: if the first + // node is an identifier with the name starting with a capital + // letter or just a sequence of _$. The rationale is that they are + // likely to be factories. + + + function isFactory(name) { + return /^[A-Z]|^[_$]+$/.test(name); + } // In case the Identifier is shorter than tab width, we can keep the + // first call in a single line, if it's an ExpressionStatement. + // + // d3.scaleLinear() + // .domain([0, 100]) + // .range([0, width]); + // + + + function isShort(name) { + return name.length <= options.tabWidth; + } + + function shouldNotWrap(groups) { + const parent = path.getParentNode(); + const isExpression = parent && parent.type === "ExpressionStatement"; + const hasComputed = groups[1].length && groups[1][0].node.computed; + + if (groups[0].length === 1) { + const firstNode = groups[0][0].node; + return firstNode.type === "ThisExpression" || firstNode.type === "Identifier" && (isFactory(firstNode.name) || isExpression && isShort(firstNode.name) || hasComputed); + } + + const lastNode = getLast$2(groups[0]).node; + return (lastNode.type === "MemberExpression" || lastNode.type === "OptionalMemberExpression") && lastNode.property.type === "Identifier" && (isFactory(lastNode.property.name) || hasComputed); + } + + const shouldMerge = groups.length >= 2 && !groups[1][0].node.comments && shouldNotWrap(groups); + + function printGroup(printedGroup) { + const printed = printedGroup.map(tuple => tuple.printed); // Checks if the last node (i.e. the parent node) needs parens and print + // accordingly + + if (printedGroup.length > 0 && printedGroup[printedGroup.length - 1].needsParens) { + return concat$6(["(", ...printed, ")"]); + } + + return concat$6(printed); + } + + function printIndentedGroup(groups) { + if (groups.length === 0) { + return ""; + } + + return indent$3(group$2(concat$6([hardline$4, join$4(hardline$4, groups.map(printGroup))]))); + } + + const printedGroups = groups.map(printGroup); + const oneLine = concat$6(printedGroups); + const cutoff = shouldMerge ? 3 : 2; + const flatGroups = groups.reduce((res, group) => res.concat(group), []); + const hasComment = flatGroups.slice(1, -1).some(node => hasLeadingComment$3(node.node)) || flatGroups.slice(0, -1).some(node => hasTrailingComment$1(node.node)) || groups[cutoff] && hasLeadingComment$3(groups[cutoff][0].node); // If we only have a single `.`, we shouldn't do anything fancy and just + // render everything concatenated together. + + if (groups.length <= cutoff && !hasComment) { + if (isLongCurriedCallExpression$1(path)) { + return oneLine; + } + + return group$2(oneLine); + } // Find out the last node in the first group and check if it has an + // empty line after + + + const lastNodeBeforeIndent = getLast$2(shouldMerge ? groups.slice(1, 2)[0] : groups[0]).node; + const shouldHaveEmptyLineBeforeIndent = lastNodeBeforeIndent.type !== "CallExpression" && lastNodeBeforeIndent.type !== "OptionalCallExpression" && shouldInsertEmptyLineAfter(lastNodeBeforeIndent); + const expanded = concat$6([printGroup(groups[0]), shouldMerge ? concat$6(groups.slice(1, 2).map(printGroup)) : "", shouldHaveEmptyLineBeforeIndent ? hardline$4 : "", printIndentedGroup(groups.slice(shouldMerge ? 2 : 1))]); + const callExpressions = printedNodes.map(({ + node + }) => node).filter(isCallOrOptionalCallExpression$1); // We don't want to print in one line if the chain has: + // * A comment. + // * Non-trivial arguments. + // * Any group but the last one has a hard line. + // If the last group is a function it's okay to inline if it fits. + + if (hasComment || callExpressions.length > 2 && callExpressions.some(expr => !expr.arguments.every(arg => isSimpleCallArgument$1(arg, 0))) || printedGroups.slice(0, -1).some(willBreak$1) || + /** + * scopes.filter(scope => scope.value !== '').map((scope, i) => { + * // multi line content + * }) + */ + ((lastGroupDoc, lastGroupNode) => isCallOrOptionalCallExpression$1(lastGroupNode) && willBreak$1(lastGroupDoc))(getLast$2(printedGroups), getLast$2(getLast$2(groups)).node) && callExpressions.slice(0, -1).some(n => n.arguments.some(isFunctionOrArrowExpression$1))) { + return group$2(expanded); + } + + return concat$6([// We only need to check `oneLine` because if `expanded` is chosen + // that means that the parent group has already been broken + // naturally + willBreak$1(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent$2 : "", conditionalGroup$1([oneLine, expanded])]); +} + +function separatorNoWhitespace(isFacebookTranslationTag, child, childNode, nextNode) { + if (isFacebookTranslationTag) { + return ""; + } + + if (childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement) { + return child.length === 1 ? softline$2 : hardline$4; + } + + return softline$2; +} + +function separatorWithWhitespace(isFacebookTranslationTag, child, childNode, nextNode) { + if (isFacebookTranslationTag) { + return hardline$4; + } + + if (child.length === 1) { + return childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement ? hardline$4 : softline$2; + } + + return hardline$4; +} // JSX Children are strange, mostly for two reasons: +// 1. JSX reads newlines into string values, instead of skipping them like JS +// 2. up to one whitespace between elements within a line is significant, +// but not between lines. +// +// Leading, trailing, and lone whitespace all need to +// turn themselves into the rather ugly `{' '}` when breaking. +// +// We print JSX using the `fill` doc primitive. +// This requires that we give it an array of alternating +// content and whitespace elements. +// To ensure this we add dummy `""` content elements as needed. + + +function printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag) { + const n = path.getValue(); + const children = []; // using `map` instead of `each` because it provides `i` + + path.map((childPath, i) => { + const child = childPath.getValue(); + + if (isLiteral$1(child)) { + const text = rawText$1(child); // Contains a non-whitespace character + + if (isMeaningfulJSXText$1(child)) { + const words = text.split(matchJsxWhitespaceRegex$1); // Starts with whitespace + + if (words[0] === "") { + children.push(""); + words.shift(); + + if (/\n/.test(words[0])) { + const next = n.children[i + 1]; + children.push(separatorWithWhitespace(isFacebookTranslationTag, words[1], child, next)); + } else { + children.push(jsxWhitespace); + } + + words.shift(); + } + + let endWhitespace; // Ends with whitespace + + if (getLast$2(words) === "") { + words.pop(); + endWhitespace = words.pop(); + } // This was whitespace only without a new line. + + + if (words.length === 0) { + return; + } + + words.forEach((word, i) => { + if (i % 2 === 1) { + children.push(line$4); + } else { + children.push(word); + } + }); + + if (endWhitespace !== undefined) { + if (/\n/.test(endWhitespace)) { + const next = n.children[i + 1]; + children.push(separatorWithWhitespace(isFacebookTranslationTag, getLast$2(children), child, next)); + } else { + children.push(jsxWhitespace); + } + } else { + const next = n.children[i + 1]; + children.push(separatorNoWhitespace(isFacebookTranslationTag, getLast$2(children), child, next)); + } + } else if (/\n/.test(text)) { + // Keep (up to one) blank line between tags/expressions/text. + // Note: We don't keep blank lines between text elements. + if (text.match(/\n/g).length > 1) { + children.push(""); + children.push(hardline$4); + } + } else { + children.push(""); + children.push(jsxWhitespace); + } + } else { + const printedChild = print(childPath); + children.push(printedChild); + const next = n.children[i + 1]; + const directlyFollowedByMeaningfulText = next && isMeaningfulJSXText$1(next); + + if (directlyFollowedByMeaningfulText) { + const firstWord = rawText$1(next).trim().split(matchJsxWhitespaceRegex$1)[0]; + children.push(separatorNoWhitespace(isFacebookTranslationTag, firstWord, child, next)); + } else { + children.push(hardline$4); + } + } + }, "children"); + return children; +} // JSX expands children from the inside-out, instead of the outside-in. +// This is both to break children before attributes, +// and to ensure that when children break, their parents do as well. +// +// Any element that is written without any newlines and fits on a single line +// is left that way. +// Not only that, any user-written-line containing multiple JSX siblings +// should also be kept on one line if possible, +// so each user-written-line is wrapped in its own group. +// +// Elements that contain newlines or don't fit on a single line (recursively) +// are fully-split, using hardline and shouldBreak: true. +// +// To support that case properly, all leading and trailing spaces +// are stripped from the list of children, and replaced with a single hardline. + + +function printJSXElement(path, options, print) { + const n = path.getValue(); + + if (n.type === "JSXElement" && isEmptyJSXElement$1(n)) { + return concat$6([path.call(print, "openingElement"), path.call(print, "closingElement")]); + } + + const openingLines = n.type === "JSXElement" ? path.call(print, "openingElement") : path.call(print, "openingFragment"); + const closingLines = n.type === "JSXElement" ? path.call(print, "closingElement") : path.call(print, "closingFragment"); + + if (n.children.length === 1 && n.children[0].type === "JSXExpressionContainer" && (n.children[0].expression.type === "TemplateLiteral" || n.children[0].expression.type === "TaggedTemplateExpression")) { + return concat$6([openingLines, concat$6(path.map(print, "children")), closingLines]); + } // Convert `{" "}` to text nodes containing a space. + // This makes it easy to turn them into `jsxWhitespace` which + // can then print as either a space or `{" "}` when breaking. + + + n.children = n.children.map(child => { + if (isJSXWhitespaceExpression$1(child)) { + return { + type: "JSXText", + value: " ", + raw: " " + }; + } + + return child; + }); + const containsTag = n.children.filter(isJSXNode$1).length > 0; + const containsMultipleExpressions = n.children.filter(child => child.type === "JSXExpressionContainer").length > 1; + const containsMultipleAttributes = n.type === "JSXElement" && n.openingElement.attributes.length > 1; // Record any breaks. Should never go from true to false, only false to true. + + let forcedBreak = willBreak$1(openingLines) || containsTag || containsMultipleAttributes || containsMultipleExpressions; + const isMdxBlock = path.getParentNode().rootMarker === "mdx"; + const rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}'; + const jsxWhitespace = isMdxBlock ? concat$6([" "]) : ifBreak$1(concat$6([rawJsxWhitespace, softline$2]), " "); + const isFacebookTranslationTag = n.openingElement && n.openingElement.name && n.openingElement.name.name === "fbt"; + const children = printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag); + const containsText = n.children.some(child => isMeaningfulJSXText$1(child)); // We can end up we multiple whitespace elements with empty string + // content between them. + // We need to remove empty whitespace and softlines before JSX whitespace + // to get the correct output. + + for (let i = children.length - 2; i >= 0; i--) { + const isPairOfEmptyStrings = children[i] === "" && children[i + 1] === ""; + const isPairOfHardlines = children[i] === hardline$4 && children[i + 1] === "" && children[i + 2] === hardline$4; + const isLineFollowedByJSXWhitespace = (children[i] === softline$2 || children[i] === hardline$4) && children[i + 1] === "" && children[i + 2] === jsxWhitespace; + const isJSXWhitespaceFollowedByLine = children[i] === jsxWhitespace && children[i + 1] === "" && (children[i + 2] === softline$2 || children[i + 2] === hardline$4); + const isDoubleJSXWhitespace = children[i] === jsxWhitespace && children[i + 1] === "" && children[i + 2] === jsxWhitespace; + const isPairOfHardOrSoftLines = children[i] === softline$2 && children[i + 1] === "" && children[i + 2] === hardline$4 || children[i] === hardline$4 && children[i + 1] === "" && children[i + 2] === softline$2; + + if (isPairOfHardlines && containsText || isPairOfEmptyStrings || isLineFollowedByJSXWhitespace || isDoubleJSXWhitespace || isPairOfHardOrSoftLines) { + children.splice(i, 2); + } else if (isJSXWhitespaceFollowedByLine) { + children.splice(i + 1, 2); + } + } // Trim trailing lines (or empty strings) + + + while (children.length && (isLineNext$1(getLast$2(children)) || isEmpty$1(getLast$2(children)))) { + children.pop(); + } // Trim leading lines (or empty strings) + + + while (children.length && (isLineNext$1(children[0]) || isEmpty$1(children[0])) && (isLineNext$1(children[1]) || isEmpty$1(children[1]))) { + children.shift(); + children.shift(); + } // Tweak how we format children if outputting this element over multiple lines. + // Also detect whether we will force this element to output over multiple lines. + + + const multilineChildren = []; + children.forEach((child, i) => { + // There are a number of situations where we need to ensure we display + // whitespace as `{" "}` when outputting this element over multiple lines. + if (child === jsxWhitespace) { + if (i === 1 && children[i - 1] === "") { + if (children.length === 2) { + // Solitary whitespace + multilineChildren.push(rawJsxWhitespace); + return; + } // Leading whitespace + + + multilineChildren.push(concat$6([rawJsxWhitespace, hardline$4])); + return; + } else if (i === children.length - 1) { + // Trailing whitespace + multilineChildren.push(rawJsxWhitespace); + return; + } else if (children[i - 1] === "" && children[i - 2] === hardline$4) { + // Whitespace after line break + multilineChildren.push(rawJsxWhitespace); + return; + } + } + + multilineChildren.push(child); + + if (willBreak$1(child)) { + forcedBreak = true; + } + }); // If there is text we use `fill` to fit as much onto each line as possible. + // When there is no text (just tags and expressions) we use `group` + // to output each on a separate line. + + const content = containsText ? fill$3(multilineChildren) : group$2(concat$6(multilineChildren), { + shouldBreak: true + }); + + if (isMdxBlock) { + return content; + } + + const multiLineElem = group$2(concat$6([openingLines, indent$3(concat$6([hardline$4, content])), hardline$4, closingLines])); + + if (forcedBreak) { + return multiLineElem; + } + + return conditionalGroup$1([group$2(concat$6([openingLines, concat$6(children), closingLines])), multiLineElem]); +} + +function maybeWrapJSXElementInParens(path, elem, options) { + const parent = path.getParentNode(); + + if (!parent) { + return elem; + } + + const NO_WRAP_PARENTS = { + ArrayExpression: true, + JSXAttribute: true, + JSXElement: true, + JSXExpressionContainer: true, + JSXFragment: true, + ExpressionStatement: true, + CallExpression: true, + OptionalCallExpression: true, + ConditionalExpression: true, + JsExpressionRoot: true + }; + + if (NO_WRAP_PARENTS[parent.type]) { + return elem; + } + + const shouldBreak = path.match(undefined, node => node.type === "ArrowFunctionExpression", isCallOrOptionalCallExpression$1, node => node.type === "JSXExpressionContainer"); + const needsParens = needsParens_1(path, options); + return group$2(concat$6([needsParens ? "" : ifBreak$1("("), indent$3(concat$6([softline$2, elem])), softline$2, needsParens ? "" : ifBreak$1(")")]), { + shouldBreak + }); +} + +function shouldInlineLogicalExpression(node) { + if (node.type !== "LogicalExpression") { + return false; + } + + if (node.right.type === "ObjectExpression" && node.right.properties.length !== 0) { + return true; + } + + if (node.right.type === "ArrayExpression" && node.right.elements.length !== 0) { + return true; + } + + if (isJSXNode$1(node.right)) { + return true; + } + + return false; +} // For binary expressions to be consistent, we need to group +// subsequent operators with the same precedence level under a single +// group. Otherwise they will be nested such that some of them break +// onto new lines but not all. Operators with the same precedence +// level should either all break or not. Because we group them by +// precedence level and the AST is structured based on precedence +// level, things are naturally broken up correctly, i.e. `&&` is +// broken before `+`. + + +function printBinaryishExpressions(path, print, options, isNested, isInsideParenthesis) { + let parts = []; + const node = path.getValue(); // We treat BinaryExpression and LogicalExpression nodes the same. + + if (isBinaryish$1(node)) { + // Put all operators with the same precedence level in the same + // group. The reason we only need to do this with the `left` + // expression is because given an expression like `1 + 2 - 3`, it + // is always parsed like `((1 + 2) - 3)`, meaning the `left` side + // is where the rest of the expression will exist. Binary + // expressions on the right side mean they have a difference + // precedence level and should be treated as a separate group, so + // print them normally. (This doesn't hold for the `**` operator, + // which is unique in that it is right-associative.) + if (shouldFlatten$1(node.operator, node.left.operator)) { + // Flatten them out by recursively calling this function. + parts = parts.concat(path.call(left => printBinaryishExpressions(left, print, options, + /* isNested */ + true, isInsideParenthesis), "left")); + } else { + parts.push(path.call(print, "left")); + } + + const shouldInline = shouldInlineLogicalExpression(node); + const lineBeforeOperator = (node.operator === "|>" || node.type === "NGPipeExpression" || node.operator === "|" && options.parser === "__vue_expression") && !hasLeadingOwnLineComment$1(options.originalText, node.right, options); + const operator = node.type === "NGPipeExpression" ? "|" : node.operator; + const rightSuffix = node.type === "NGPipeExpression" && node.arguments.length !== 0 ? group$2(indent$3(concat$6([softline$2, ": ", join$4(concat$6([softline$2, ":", ifBreak$1(" ")]), path.map(print, "arguments").map(arg => align$1(2, group$2(arg))))]))) : ""; + const right = shouldInline ? concat$6([operator, " ", path.call(print, "right"), rightSuffix]) : concat$6([lineBeforeOperator ? softline$2 : "", operator, lineBeforeOperator ? " " : line$4, path.call(print, "right"), rightSuffix]); // If there's only a single binary expression, we want to create a group + // in order to avoid having a small right part like -1 be on its own line. + + const parent = path.getParentNode(); + const shouldGroup = !(isInsideParenthesis && node.type === "LogicalExpression") && parent.type !== node.type && node.left.type !== node.type && node.right.type !== node.type; + parts.push(" ", shouldGroup ? group$2(right) : right); // The root comments are already printed, but we need to manually print + // the other ones since we don't call the normal print on BinaryExpression, + // only for the left and right parts + + if (isNested && node.comments) { + parts = comments.printComments(path, () => concat$6(parts), options); + } + } else { + // Our stopping case. Simply print the node normally. + parts.push(path.call(print)); + } + + return parts; +} + +function printAssignmentRight(leftNode, rightNode, printedRight, options) { + if (hasLeadingOwnLineComment$1(options.originalText, rightNode, options)) { + return indent$3(concat$6([line$4, printedRight])); + } + + const canBreak = isBinaryish$1(rightNode) && !shouldInlineLogicalExpression(rightNode) || rightNode.type === "ConditionalExpression" && isBinaryish$1(rightNode.test) && !shouldInlineLogicalExpression(rightNode.test) || rightNode.type === "StringLiteralTypeAnnotation" || rightNode.type === "ClassExpression" && rightNode.decorators && rightNode.decorators.length || (leftNode.type === "Identifier" || isStringLiteral$1(leftNode) || leftNode.type === "MemberExpression") && (isStringLiteral$1(rightNode) || isMemberExpressionChain$1(rightNode)) && // do not put values on a separate line from the key in json + options.parser !== "json" && options.parser !== "json5" || rightNode.type === "SequenceExpression"; + + if (canBreak) { + return group$2(indent$3(concat$6([line$4, printedRight]))); + } + + return concat$6([" ", printedRight]); +} + +function printAssignment(leftNode, printedLeft, operator, rightNode, printedRight, options) { + if (!rightNode) { + return printedLeft; + } + + const printed = printAssignmentRight(leftNode, rightNode, printedRight, options); + return group$2(concat$6([printedLeft, operator, printed])); +} + +function adjustClause(node, clause, forceSpace) { + if (node.type === "EmptyStatement") { + return ";"; + } + + if (node.type === "BlockStatement" || forceSpace) { + return concat$6([" ", clause]); + } + + return indent$3(concat$6([line$4, clause])); +} + +function nodeStr(node, options, isFlowOrTypeScriptDirectiveLiteral) { + const raw = rawText$1(node); + const isDirectiveLiteral = isFlowOrTypeScriptDirectiveLiteral || node.type === "DirectiveLiteral"; + return printString$1(raw, options, isDirectiveLiteral); +} + +function printRegex(node) { + const flags = node.flags.split("").sort().join(""); + return `/${node.pattern}/${flags}`; +} + +function exprNeedsASIProtection(path, options) { + const node = path.getValue(); + const maybeASIProblem = needsParens_1(path, options) || node.type === "ParenthesizedExpression" || node.type === "TypeCastExpression" || node.type === "ArrowFunctionExpression" && !shouldPrintParamsWithoutParens(path, options) || node.type === "ArrayExpression" || node.type === "ArrayPattern" || node.type === "UnaryExpression" && node.prefix && (node.operator === "+" || node.operator === "-") || node.type === "TemplateLiteral" || node.type === "TemplateElement" || isJSXNode$1(node) || node.type === "BindExpression" && !node.object || node.type === "RegExpLiteral" || node.type === "Literal" && node.pattern || node.type === "Literal" && node.regex; + + if (maybeASIProblem) { + return true; + } + + if (!hasNakedLeftSide$2(node)) { + return false; + } + + return path.call(childPath => exprNeedsASIProtection(childPath, options), ...getLeftSidePathName$2(path, node)); +} + +function stmtNeedsASIProtection(path, options) { + const node = path.getNode(); + + if (node.type !== "ExpressionStatement") { + return false; + } + + return path.call(childPath => exprNeedsASIProtection(childPath, options), "expression"); +} + +function shouldHugType(node) { + if (isSimpleFlowType$1(node) || isObjectType$1(node)) { + return true; + } + + if (node.type === "UnionTypeAnnotation" || node.type === "TSUnionType") { + const voidCount = node.types.filter(n => n.type === "VoidTypeAnnotation" || n.type === "TSVoidKeyword" || n.type === "NullLiteralTypeAnnotation" || n.type === "TSNullKeyword").length; + const hasObject = node.types.some(n => n.type === "ObjectTypeAnnotation" || n.type === "TSTypeLiteral" || // This is a bit aggressive but captures Array<{x}> + n.type === "GenericTypeAnnotation" || n.type === "TSTypeReference"); + + if (node.types.length - 1 === voidCount && hasObject) { + return true; + } + } + + return false; +} + +function shouldHugArguments(fun) { + if (!fun || fun.rest) { + return false; + } + + const params = fun.params || fun.parameters; + + if (!params || params.length !== 1) { + return false; + } + + const param = params[0]; + return !param.comments && (param.type === "ObjectPattern" || param.type === "ArrayPattern" || param.type === "Identifier" && param.typeAnnotation && (param.typeAnnotation.type === "TypeAnnotation" || param.typeAnnotation.type === "TSTypeAnnotation") && isObjectType$1(param.typeAnnotation.typeAnnotation) || param.type === "FunctionTypeParam" && isObjectType$1(param.typeAnnotation) || param.type === "AssignmentPattern" && (param.left.type === "ObjectPattern" || param.left.type === "ArrayPattern") && (param.right.type === "Identifier" || param.right.type === "ObjectExpression" && param.right.properties.length === 0 || param.right.type === "ArrayExpression" && param.right.elements.length === 0)); +} + +function printArrayItems(path, options, printPath, print) { + const printedElements = []; + let separatorParts = []; + path.each(childPath => { + printedElements.push(concat$6(separatorParts)); + printedElements.push(group$2(print(childPath))); + separatorParts = [",", line$4]; + + if (childPath.getValue() && isNextLineEmpty$2(options.originalText, childPath.getValue(), options.locEnd)) { + separatorParts.push(softline$2); + } + }, printPath); + return concat$6(printedElements); +} + +function printReturnAndThrowArgument(path, options, print) { + const node = path.getValue(); + const semi = options.semi ? ";" : ""; + const parts = []; + + if (node.argument) { + if (returnArgumentHasLeadingComment$1(options, node.argument)) { + parts.push(concat$6([" (", indent$3(concat$6([hardline$4, path.call(print, "argument")])), hardline$4, ")"])); + } else if (isBinaryish$1(node.argument) || node.argument.type === "SequenceExpression") { + parts.push(group$2(concat$6([ifBreak$1(" (", " "), indent$3(concat$6([softline$2, path.call(print, "argument")])), softline$2, ifBreak$1(")")]))); + } else { + parts.push(" ", path.call(print, "argument")); + } + } + + const lastComment = Array.isArray(node.comments) && node.comments[node.comments.length - 1]; + const isLastCommentLine = lastComment && (lastComment.type === "CommentLine" || lastComment.type === "Line"); + + if (isLastCommentLine) { + parts.push(semi); + } + + if (hasDanglingComments$1(node)) { + parts.push(" ", comments.printDanglingComments(path, options, + /* sameIndent */ + true)); + } + + if (!isLastCommentLine) { + parts.push(semi); + } + + return concat$6(parts); +} + +function willPrintOwnComments(path +/*, options */ +) { + const node = path.getValue(); + const parent = path.getParentNode(); + return (node && (isJSXNode$1(node) || hasFlowShorthandAnnotationComment$2(node) || parent && (parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && (hasFlowAnnotationComment$1(node.leadingComments) || hasFlowAnnotationComment$1(node.trailingComments))) || parent && (parent.type === "JSXSpreadAttribute" || parent.type === "JSXSpreadChild" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || (parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node)) && (!hasIgnoreComment$2(path) || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType"); +} + +function canAttachComment(node) { + return node.type && node.type !== "CommentBlock" && node.type !== "CommentLine" && node.type !== "Line" && node.type !== "Block" && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import"; +} + +function printComment$1(commentPath, options) { + const comment = commentPath.getValue(); + + switch (comment.type) { + case "CommentBlock": + case "Block": + { + if (isIndentableBlockComment(comment)) { + const printed = printIndentableBlockComment(comment); // We need to prevent an edge case of a previous trailing comment + // printed as a `lineSuffix` which causes the comments to be + // interleaved. See https://github.com/prettier/prettier/issues/4412 + + if (comment.trailing && !hasNewline$4(options.originalText, options.locStart(comment), { + backwards: true + })) { + return concat$6([hardline$4, printed]); + } + + return printed; + } + + const commentEnd = options.locEnd(comment); + const isInsideFlowComment = options.originalText.slice(commentEnd - 3, commentEnd) === "*-/"; + return "/*" + comment.value + (isInsideFlowComment ? "*-/" : "*/"); + } + + case "CommentLine": + case "Line": + // Print shebangs with the proper comment characters + if (options.originalText.slice(options.locStart(comment)).startsWith("#!")) { + return "#!" + comment.value.trimEnd(); + } + + return "//" + comment.value.trimEnd(); + + default: + throw new Error("Not a comment: " + JSON.stringify(comment)); + } +} + +function isIndentableBlockComment(comment) { + // If the comment has multiple lines and every line starts with a star + // we can fix the indentation of each line. The stars in the `/*` and + // `*/` delimiters are not included in the comment value, so add them + // back first. + const lines = `*${comment.value}*`.split("\n"); + return lines.length > 1 && lines.every(line => line.trim()[0] === "*"); +} + +function printIndentableBlockComment(comment) { + const lines = comment.value.split("\n"); + return concat$6(["/*", join$4(hardline$4, lines.map((line, index) => index === 0 ? line.trimEnd() : " " + (index < lines.length - 1 ? line.trim() : line.trimStart()))), "*/"]); +} + +var printerEstree = { + preprocess: preprocess_1, + print: genericPrint, + embed: embed_1, + insertPragma: insertPragma$1, + massageAstNode: clean_1, + hasPrettierIgnore: hasPrettierIgnore$1, + willPrintOwnComments, + canAttachComment, + printComment: printComment$1, + isBlockComment: comments$1.isBlockComment, + handleComments: { + ownLine: comments$1.handleOwnLineComment, + endOfLine: comments$1.handleEndOfLineComment, + remaining: comments$1.handleRemainingComment + }, + getGapRegex: comments$1.getGapRegex, + getCommentChildNodes: comments$1.getCommentChildNodes +}; + +const { + concat: concat$7, + hardline: hardline$5, + indent: indent$4, + join: join$5 +} = document.builders; + +function genericPrint$1(path, options, print) { + const node = path.getValue(); + + switch (node.type) { + case "JsonRoot": + return concat$7([path.call(print, "node"), hardline$5]); + + case "ArrayExpression": + return node.elements.length === 0 ? "[]" : concat$7(["[", indent$4(concat$7([hardline$5, join$5(concat$7([",", hardline$5]), path.map(print, "elements"))])), hardline$5, "]"]); + + case "ObjectExpression": + return node.properties.length === 0 ? "{}" : concat$7(["{", indent$4(concat$7([hardline$5, join$5(concat$7([",", hardline$5]), path.map(print, "properties"))])), hardline$5, "}"]); + + case "ObjectProperty": + return concat$7([path.call(print, "key"), ": ", path.call(print, "value")]); + + case "UnaryExpression": + return concat$7([node.operator === "+" ? "" : node.operator, path.call(print, "argument")]); + + case "NullLiteral": + return "null"; + + case "BooleanLiteral": + return node.value ? "true" : "false"; + + case "StringLiteral": + case "NumericLiteral": + return JSON.stringify(node.value); + + case "Identifier": + return JSON.stringify(node.name); + + default: + /* istanbul ignore next */ + throw new Error("unknown type: " + JSON.stringify(node.type)); + } +} + +function clean$1(node, newNode +/*, parent*/ +) { + delete newNode.start; + delete newNode.end; + delete newNode.extra; + delete newNode.loc; + delete newNode.comments; + delete newNode.errors; + + if (node.type === "Identifier") { + return { + type: "StringLiteral", + value: node.name + }; + } + + if (node.type === "UnaryExpression" && node.operator === "+") { + return newNode.argument; + } +} + +var printerEstreeJson = { + preprocess: preprocess_1, + print: genericPrint$1, + massageAstNode: clean$1 +}; + +const CATEGORY_COMMON = "Common"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js + +var commonOptions = { + bracketSpacing: { + since: "0.0.0", + category: CATEGORY_COMMON, + type: "boolean", + default: true, + description: "Print spaces between brackets.", + oppositeDescription: "Do not print spaces between brackets." + }, + singleQuote: { + since: "0.0.0", + category: CATEGORY_COMMON, + type: "boolean", + default: false, + description: "Use single quotes instead of double quotes." + }, + proseWrap: { + since: "1.8.2", + category: CATEGORY_COMMON, + type: "choice", + default: [{ + since: "1.8.2", + value: true + }, { + since: "1.9.0", + value: "preserve" + }], + description: "How to wrap prose.", + choices: [{ + since: "1.9.0", + value: "always", + description: "Wrap prose if it exceeds the print width." + }, { + since: "1.9.0", + value: "never", + description: "Do not wrap prose." + }, { + since: "1.9.0", + value: "preserve", + description: "Wrap prose as-is." + }] + } +}; + +const CATEGORY_JAVASCRIPT = "JavaScript"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js + +var options$2 = { + arrowParens: { + since: "1.9.0", + category: CATEGORY_JAVASCRIPT, + type: "choice", + default: [{ + since: "1.9.0", + value: "avoid" + }, { + since: "2.0.0", + value: "always" + }], + description: "Include parentheses around a sole arrow function parameter.", + choices: [{ + value: "always", + description: "Always include parens. Example: `(x) => x`" + }, { + value: "avoid", + description: "Omit parens when possible. Example: `x => x`" + }] + }, + bracketSpacing: commonOptions.bracketSpacing, + jsxBracketSameLine: { + since: "0.17.0", + category: CATEGORY_JAVASCRIPT, + type: "boolean", + default: false, + description: "Put > on the last line instead of at a new line." + }, + semi: { + since: "1.0.0", + category: CATEGORY_JAVASCRIPT, + type: "boolean", + default: true, + description: "Print semicolons.", + oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them." + }, + singleQuote: commonOptions.singleQuote, + jsxSingleQuote: { + since: "1.15.0", + category: CATEGORY_JAVASCRIPT, + type: "boolean", + default: false, + description: "Use single quotes in JSX." + }, + quoteProps: { + since: "1.17.0", + category: CATEGORY_JAVASCRIPT, + type: "choice", + default: "as-needed", + description: "Change when properties in objects are quoted.", + choices: [{ + value: "as-needed", + description: "Only add quotes around object properties where required." + }, { + value: "consistent", + description: "If at least one property in an object requires quotes, quote all properties." + }, { + value: "preserve", + description: "Respect the input use of quotes in object properties." + }] + }, + trailingComma: { + since: "0.0.0", + category: CATEGORY_JAVASCRIPT, + type: "choice", + default: [{ + since: "0.0.0", + value: false + }, { + since: "0.19.0", + value: "none" + }, { + since: "2.0.0", + value: "es5" + }], + description: "Print trailing commas wherever possible when multi-line.", + choices: [{ + value: "es5", + description: "Trailing commas where valid in ES5 (objects, arrays, etc.)" + }, { + value: "none", + description: "No trailing commas." + }, { + value: "all", + description: "Trailing commas wherever possible (including function arguments)." + }] + } +}; + +var createLanguage = function (linguistData, override) { + const { + languageId + } = linguistData, + rest = _objectWithoutPropertiesLoose(linguistData, ["languageId"]); + + return Object.assign({ + linguistLanguageId: languageId + }, rest, {}, override(linguistData)); +}; + +var name$2 = "JavaScript"; +var type = "programming"; +var tmScope = "source.js"; +var aceMode = "javascript"; +var codemirrorMode = "javascript"; +var codemirrorMimeType = "text/javascript"; +var color = "#f1e05a"; +var aliases = [ + "js", + "node" +]; +var extensions = [ + ".js", + "._js", + ".bones", + ".cjs", + ".es", + ".es6", + ".frag", + ".gs", + ".jake", + ".jsb", + ".jscad", + ".jsfl", + ".jsm", + ".jss", + ".mjs", + ".njs", + ".pac", + ".sjs", + ".ssjs", + ".xsjs", + ".xsjslib" +]; +var filenames = [ + "Jakefile" +]; +var interpreters = [ + "chakra", + "d8", + "gjs", + "js", + "node", + "qjs", + "rhino", + "v8", + "v8-shell" +]; +var languageId = 183; +var JavaScript = { + name: name$2, + type: type, + tmScope: tmScope, + aceMode: aceMode, + codemirrorMode: codemirrorMode, + codemirrorMimeType: codemirrorMimeType, + color: color, + aliases: aliases, + extensions: extensions, + filenames: filenames, + interpreters: interpreters, + languageId: languageId +}; + +var JavaScript$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$2, + type: type, + tmScope: tmScope, + aceMode: aceMode, + codemirrorMode: codemirrorMode, + codemirrorMimeType: codemirrorMimeType, + color: color, + aliases: aliases, + extensions: extensions, + filenames: filenames, + interpreters: interpreters, + languageId: languageId, + 'default': JavaScript +}); + +var name$3 = "JSX"; +var type$1 = "programming"; +var group$3 = "JavaScript"; +var extensions$1 = [ + ".jsx" +]; +var tmScope$1 = "source.js.jsx"; +var aceMode$1 = "javascript"; +var codemirrorMode$1 = "jsx"; +var codemirrorMimeType$1 = "text/jsx"; +var languageId$1 = 178; +var JSX = { + name: name$3, + type: type$1, + group: group$3, + extensions: extensions$1, + tmScope: tmScope$1, + aceMode: aceMode$1, + codemirrorMode: codemirrorMode$1, + codemirrorMimeType: codemirrorMimeType$1, + languageId: languageId$1 +}; + +var JSX$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$3, + type: type$1, + group: group$3, + extensions: extensions$1, + tmScope: tmScope$1, + aceMode: aceMode$1, + codemirrorMode: codemirrorMode$1, + codemirrorMimeType: codemirrorMimeType$1, + languageId: languageId$1, + 'default': JSX +}); + +var name$4 = "TypeScript"; +var type$2 = "programming"; +var color$1 = "#2b7489"; +var aliases$1 = [ + "ts" +]; +var interpreters$1 = [ + "deno", + "ts-node" +]; +var extensions$2 = [ + ".ts" +]; +var tmScope$2 = "source.ts"; +var aceMode$2 = "typescript"; +var codemirrorMode$2 = "javascript"; +var codemirrorMimeType$2 = "application/typescript"; +var languageId$2 = 378; +var TypeScript = { + name: name$4, + type: type$2, + color: color$1, + aliases: aliases$1, + interpreters: interpreters$1, + extensions: extensions$2, + tmScope: tmScope$2, + aceMode: aceMode$2, + codemirrorMode: codemirrorMode$2, + codemirrorMimeType: codemirrorMimeType$2, + languageId: languageId$2 +}; + +var TypeScript$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$4, + type: type$2, + color: color$1, + aliases: aliases$1, + interpreters: interpreters$1, + extensions: extensions$2, + tmScope: tmScope$2, + aceMode: aceMode$2, + codemirrorMode: codemirrorMode$2, + codemirrorMimeType: codemirrorMimeType$2, + languageId: languageId$2, + 'default': TypeScript +}); + +var name$5 = "TSX"; +var type$3 = "programming"; +var group$4 = "TypeScript"; +var extensions$3 = [ + ".tsx" +]; +var tmScope$3 = "source.tsx"; +var aceMode$3 = "javascript"; +var codemirrorMode$3 = "jsx"; +var codemirrorMimeType$3 = "text/jsx"; +var languageId$3 = 94901924; +var TSX = { + name: name$5, + type: type$3, + group: group$4, + extensions: extensions$3, + tmScope: tmScope$3, + aceMode: aceMode$3, + codemirrorMode: codemirrorMode$3, + codemirrorMimeType: codemirrorMimeType$3, + languageId: languageId$3 +}; + +var TSX$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$5, + type: type$3, + group: group$4, + extensions: extensions$3, + tmScope: tmScope$3, + aceMode: aceMode$3, + codemirrorMode: codemirrorMode$3, + codemirrorMimeType: codemirrorMimeType$3, + languageId: languageId$3, + 'default': TSX +}); + +var name$6 = "JSON"; +var type$4 = "data"; +var tmScope$4 = "source.json"; +var aceMode$4 = "json"; +var codemirrorMode$4 = "javascript"; +var codemirrorMimeType$4 = "application/json"; +var searchable = false; +var extensions$4 = [ + ".json", + ".avsc", + ".geojson", + ".gltf", + ".har", + ".ice", + ".JSON-tmLanguage", + ".jsonl", + ".mcmeta", + ".tfstate", + ".tfstate.backup", + ".topojson", + ".webapp", + ".webmanifest", + ".yy", + ".yyp" +]; +var filenames$1 = [ + ".arcconfig", + ".htmlhintrc", + ".tern-config", + ".tern-project", + ".watchmanconfig", + "composer.lock", + "mcmod.info" +]; +var languageId$4 = 174; +var _JSON = { + name: name$6, + type: type$4, + tmScope: tmScope$4, + aceMode: aceMode$4, + codemirrorMode: codemirrorMode$4, + codemirrorMimeType: codemirrorMimeType$4, + searchable: searchable, + extensions: extensions$4, + filenames: filenames$1, + languageId: languageId$4 +}; + +var _JSON$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$6, + type: type$4, + tmScope: tmScope$4, + aceMode: aceMode$4, + codemirrorMode: codemirrorMode$4, + codemirrorMimeType: codemirrorMimeType$4, + searchable: searchable, + extensions: extensions$4, + filenames: filenames$1, + languageId: languageId$4, + 'default': _JSON +}); + +var name$7 = "JSON with Comments"; +var type$5 = "data"; +var group$5 = "JSON"; +var tmScope$5 = "source.js"; +var aceMode$5 = "javascript"; +var codemirrorMode$5 = "javascript"; +var codemirrorMimeType$5 = "text/javascript"; +var aliases$2 = [ + "jsonc" +]; +var extensions$5 = [ + ".jsonc", + ".sublime-build", + ".sublime-commands", + ".sublime-completions", + ".sublime-keymap", + ".sublime-macro", + ".sublime-menu", + ".sublime-mousemap", + ".sublime-project", + ".sublime-settings", + ".sublime-theme", + ".sublime-workspace", + ".sublime_metrics", + ".sublime_session" +]; +var filenames$2 = [ + ".babelrc", + ".eslintrc.json", + ".jscsrc", + ".jshintrc", + ".jslintrc", + "jsconfig.json", + "language-configuration.json", + "tsconfig.json" +]; +var languageId$5 = 423; +var JSON_with_Comments = { + name: name$7, + type: type$5, + group: group$5, + tmScope: tmScope$5, + aceMode: aceMode$5, + codemirrorMode: codemirrorMode$5, + codemirrorMimeType: codemirrorMimeType$5, + aliases: aliases$2, + extensions: extensions$5, + filenames: filenames$2, + languageId: languageId$5 +}; + +var JSON_with_Comments$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$7, + type: type$5, + group: group$5, + tmScope: tmScope$5, + aceMode: aceMode$5, + codemirrorMode: codemirrorMode$5, + codemirrorMimeType: codemirrorMimeType$5, + aliases: aliases$2, + extensions: extensions$5, + filenames: filenames$2, + languageId: languageId$5, + 'default': JSON_with_Comments +}); + +var name$8 = "JSON5"; +var type$6 = "data"; +var extensions$6 = [ + ".json5" +]; +var tmScope$6 = "source.js"; +var aceMode$6 = "javascript"; +var codemirrorMode$6 = "javascript"; +var codemirrorMimeType$6 = "application/json"; +var languageId$6 = 175; +var JSON5 = { + name: name$8, + type: type$6, + extensions: extensions$6, + tmScope: tmScope$6, + aceMode: aceMode$6, + codemirrorMode: codemirrorMode$6, + codemirrorMimeType: codemirrorMimeType$6, + languageId: languageId$6 +}; + +var JSON5$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$8, + type: type$6, + extensions: extensions$6, + tmScope: tmScope$6, + aceMode: aceMode$6, + codemirrorMode: codemirrorMode$6, + codemirrorMimeType: codemirrorMimeType$6, + languageId: languageId$6, + 'default': JSON5 +}); + +var require$$0$1 = getCjsExportFromNamespace(JavaScript$1); + +var require$$1$1 = getCjsExportFromNamespace(JSX$1); + +var require$$2 = getCjsExportFromNamespace(TypeScript$1); + +var require$$3 = getCjsExportFromNamespace(TSX$1); + +var require$$4$1 = getCjsExportFromNamespace(_JSON$1); + +var require$$5 = getCjsExportFromNamespace(JSON_with_Comments$1); + +var require$$6 = getCjsExportFromNamespace(JSON5$1); + +const languages = [createLanguage(require$$0$1, data => ({ + since: "0.0.0", + parsers: ["babel", "flow"], + vscodeLanguageIds: ["javascript", "mongo"], + interpreters: data.interpreters.concat(["nodejs"]) +})), createLanguage(require$$0$1, () => ({ + name: "Flow", + since: "0.0.0", + parsers: ["babel", "flow"], + vscodeLanguageIds: ["javascript"], + aliases: [], + filenames: [], + extensions: [".js.flow"] +})), createLanguage(require$$1$1, () => ({ + since: "0.0.0", + parsers: ["babel", "flow"], + vscodeLanguageIds: ["javascriptreact"] +})), createLanguage(require$$2, () => ({ + since: "1.4.0", + parsers: ["typescript", "babel-ts"], + vscodeLanguageIds: ["typescript"] +})), createLanguage(require$$3, () => ({ + since: "1.4.0", + parsers: ["typescript", "babel-ts"], + vscodeLanguageIds: ["typescriptreact"] +})), createLanguage(require$$4$1, () => ({ + name: "JSON.stringify", + since: "1.13.0", + parsers: ["json-stringify"], + vscodeLanguageIds: ["json"], + extensions: [], + // .json file defaults to json instead of json-stringify + filenames: ["package.json", "package-lock.json", "composer.json"] +})), createLanguage(require$$4$1, data => ({ + since: "1.5.0", + parsers: ["json"], + vscodeLanguageIds: ["json"], + filenames: data.filenames.concat([".prettierrc"]) +})), createLanguage(require$$5, data => ({ + since: "1.5.0", + parsers: ["json"], + vscodeLanguageIds: ["jsonc"], + filenames: data.filenames.concat([".eslintrc"]) +})), createLanguage(require$$6, () => ({ + since: "1.13.0", + parsers: ["json5"], + vscodeLanguageIds: ["json5"] +}))]; +const printers = { + estree: printerEstree, + "estree-json": printerEstreeJson +}; +var languageJs = { + languages, + options: options$2, + printers +}; + +function clean$2(ast, newObj, parent) { + ["raw", // front-matter + "raws", "sourceIndex", "source", "before", "after", "trailingComma"].forEach(name => { + delete newObj[name]; + }); + + if (ast.type === "yaml") { + delete newObj.value; + } // --insert-pragma + + + if (ast.type === "css-comment" && parent.type === "css-root" && parent.nodes.length !== 0 && ( // first non-front-matter comment + parent.nodes[0] === ast || (parent.nodes[0].type === "yaml" || parent.nodes[0].type === "toml") && parent.nodes[1] === ast)) { + /** + * something + * + * @format + */ + delete newObj.text; // standalone pragma + + if (/^\*\s*@(format|prettier)\s*$/.test(ast.text)) { + return null; + } + } + + if (ast.type === "media-query" || ast.type === "media-query-list" || ast.type === "media-feature-expression") { + delete newObj.value; + } + + if (ast.type === "css-rule") { + delete newObj.params; + } + + if (ast.type === "selector-combinator") { + newObj.value = newObj.value.replace(/\s+/g, " "); + } + + if (ast.type === "media-feature") { + newObj.value = newObj.value.replace(/ /g, ""); + } + + if (ast.type === "value-word" && (ast.isColor && ast.isHex || ["initial", "inherit", "unset", "revert"].includes(newObj.value.replace().toLowerCase())) || ast.type === "media-feature" || ast.type === "selector-root-invalid" || ast.type === "selector-pseudo") { + newObj.value = newObj.value.toLowerCase(); + } + + if (ast.type === "css-decl") { + newObj.prop = newObj.prop.toLowerCase(); + } + + if (ast.type === "css-atrule" || ast.type === "css-import") { + newObj.name = newObj.name.toLowerCase(); + } + + if (ast.type === "value-number") { + newObj.unit = newObj.unit.toLowerCase(); + } + + if ((ast.type === "media-feature" || ast.type === "media-keyword" || ast.type === "media-type" || ast.type === "media-unknown" || ast.type === "media-url" || ast.type === "media-value" || ast.type === "selector-attribute" || ast.type === "selector-string" || ast.type === "selector-class" || ast.type === "selector-combinator" || ast.type === "value-string") && newObj.value) { + newObj.value = cleanCSSStrings(newObj.value); + } + + if (ast.type === "selector-attribute") { + newObj.attribute = newObj.attribute.trim(); + + if (newObj.namespace) { + if (typeof newObj.namespace === "string") { + newObj.namespace = newObj.namespace.trim(); + + if (newObj.namespace.length === 0) { + newObj.namespace = true; + } + } + } + + if (newObj.value) { + newObj.value = newObj.value.trim().replace(/^['"]|['"]$/g, ""); + delete newObj.quoted; + } + } + + if ((ast.type === "media-value" || ast.type === "media-type" || ast.type === "value-number" || ast.type === "selector-root-invalid" || ast.type === "selector-class" || ast.type === "selector-combinator" || ast.type === "selector-tag") && newObj.value) { + newObj.value = newObj.value.replace(/([\d.eE+-]+)([a-zA-Z]*)/g, (match, numStr, unit) => { + const num = Number(numStr); + return isNaN(num) ? match : num + unit.toLowerCase(); + }); + } + + if (ast.type === "selector-tag") { + const lowercasedValue = ast.value.toLowerCase(); + + if (["from", "to"].includes(lowercasedValue)) { + newObj.value = lowercasedValue; + } + } // Workaround when `postcss-values-parser` parse `not`, `and` or `or` keywords as `value-func` + + + if (ast.type === "css-atrule" && ast.name.toLowerCase() === "supports") { + delete newObj.value; + } // Workaround for SCSS nested properties + + + if (ast.type === "selector-unknown") { + delete newObj.value; + } +} + +function cleanCSSStrings(value) { + return value.replace(/'/g, '"').replace(/\\([^a-fA-F\d])/g, "$1"); +} + +var clean_1$1 = clean$2; + +const { + builders: { + hardline: hardline$6, + literalline: literalline$3, + concat: concat$8, + markAsRoot: markAsRoot$1 + }, + utils: { + mapDoc: mapDoc$2 + } +} = document; + +function embed$1(path, print, textToDoc +/*, options */ +) { + const node = path.getValue(); + + if (node.type === "yaml") { + return markAsRoot$1(concat$8(["---", hardline$6, node.value.trim() ? replaceNewlinesWithLiterallines(textToDoc(node.value, { + parser: "yaml" + })) : "", "---", hardline$6])); + } + + return null; + + function replaceNewlinesWithLiterallines(doc) { + return mapDoc$2(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$8(currentDoc.split(/(\n)/g).map((v, i) => i % 2 === 0 ? v : literalline$3)) : currentDoc); + } +} + +var embed_1$1 = embed$1; + +const DELIMITER_MAP = { + "---": "yaml", + "+++": "toml" +}; + +function parse$5(text) { + const delimiterRegex = Object.keys(DELIMITER_MAP).map(escapeStringRegexp$2).join("|"); + const match = text.match( // trailing spaces after delimiters are allowed + new RegExp(`^(${delimiterRegex})[^\\n\\S]*\\n(?:([\\s\\S]*?)\\n)?\\1[^\\n\\S]*(\\n|$)`)); + + if (match === null) { + return { + frontMatter: null, + content: text + }; + } + + const [raw, delimiter, value] = match; + return { + frontMatter: { + type: DELIMITER_MAP[delimiter], + value, + raw: raw.replace(/\n$/, "") + }, + content: raw.replace(/[^\n]/g, " ") + text.slice(raw.length) + }; +} + +var frontMatter = parse$5; + +function hasPragma$1(text) { + return pragma.hasPragma(frontMatter(text).content); +} + +function insertPragma$2(text) { + const { + frontMatter: frontMatter$1, + content + } = frontMatter(text); + return (frontMatter$1 ? frontMatter$1.raw + "\n\n" : "") + pragma.insertPragma(content); +} + +var pragma$1 = { + hasPragma: hasPragma$1, + insertPragma: insertPragma$2 +}; + +var lineColumnToIndex = function (lineColumn, text) { + let index = 0; + + for (let i = 0; i < lineColumn.line - 1; ++i) { + index = text.indexOf("\n", index) + 1; + + if (index === -1) { + return -1; + } + } + + return index + lineColumn.column; +}; + +const { + getLast: getLast$3, + skipEverythingButNewLine: skipEverythingButNewLine$2 +} = util$1; + +function calculateLocStart(node, text) { + if (node.source) { + return lineColumnToIndex(node.source.start, text) - 1; + } + + return null; +} + +function calculateLocEnd(node, text) { + if (node.type === "css-comment" && node.inline) { + return skipEverythingButNewLine$2(text, node.source.startOffset); + } + + const endNode = node.nodes && getLast$3(node.nodes); + + if (endNode && node.source && !node.source.end) { + node = endNode; + } + + if (node.source && node.source.end) { + return lineColumnToIndex(node.source.end, text); + } + + return null; +} + +function calculateLoc(node, text) { + if (node && typeof node === "object") { + if (node.source) { + node.source.startOffset = calculateLocStart(node, text); + node.source.endOffset = calculateLocEnd(node, text); + } + + for (const key in node) { + calculateLoc(node[key], text); + } + } +} +/** + * Workaround for a bug: quotes in inline comments corrupt loc data of subsequent nodes. + * This function replaces the quotes with U+FFFE and U+FFFF. Later, when the comments are printed, + * their content is extracted from the original text or restored by replacing the placeholder + * characters back with quotes. + * - https://github.com/prettier/prettier/issues/7780 + * - https://github.com/shellscape/postcss-less/issues/145 + * - About noncharacters (U+FFFE and U+FFFF): http://www.unicode.org/faq/private_use.html#nonchar1 + * @param text {string} + */ + + +function replaceQuotesInInlineComments(text) { + /** @typedef { 'initial' | 'single-quotes' | 'double-quotes' | 'url' | 'comment-block' | 'comment-inline' } State */ + + /** @type {State} */ + let state = "initial"; + /** @type {State} */ + + let stateToReturnFromQuotes = "initial"; + let inlineCommentStartIndex; + let inlineCommentContainsQuotes = false; + const inlineCommentsToReplace = []; + + for (let i = 0; i < text.length; i++) { + const c = text[i]; + + switch (state) { + case "initial": + if (c === "'") { + state = "single-quotes"; + continue; + } + + if (c === '"') { + state = "double-quotes"; + continue; + } + + if ((c === "u" || c === "U") && text.slice(i, i + 4).toLowerCase() === "url(") { + state = "url"; + i += 3; + continue; + } + + if (c === "*" && text[i - 1] === "/") { + state = "comment-block"; + continue; + } + + if (c === "/" && text[i - 1] === "/") { + state = "comment-inline"; + inlineCommentStartIndex = i - 1; + continue; + } + + continue; + + case "single-quotes": + if (c === "'" && text[i - 1] !== "\\") { + state = stateToReturnFromQuotes; + stateToReturnFromQuotes = "initial"; + } + + if (c === "\n" || c === "\r") { + return text; // invalid input + } + + continue; + + case "double-quotes": + if (c === '"' && text[i - 1] !== "\\") { + state = stateToReturnFromQuotes; + stateToReturnFromQuotes = "initial"; + } + + if (c === "\n" || c === "\r") { + return text; // invalid input + } + + continue; + + case "url": + if (c === ")") { + state = "initial"; + } + + if (c === "\n" || c === "\r") { + return text; // invalid input + } + + if (c === "'") { + state = "single-quotes"; + stateToReturnFromQuotes = "url"; + continue; + } + + if (c === '"') { + state = "double-quotes"; + stateToReturnFromQuotes = "url"; + continue; + } + + continue; + + case "comment-block": + if (c === "/" && text[i - 1] === "*") { + state = "initial"; + } + + continue; + + case "comment-inline": + if (c === '"' || c === "'") { + inlineCommentContainsQuotes = true; + } + + if (c === "\n" || c === "\r") { + if (inlineCommentContainsQuotes) { + inlineCommentsToReplace.push([inlineCommentStartIndex, i]); + } + + state = "initial"; + inlineCommentContainsQuotes = false; + } + + continue; + } + } + + for (const [start, end] of inlineCommentsToReplace) { + text = text.slice(0, start) + text.slice(start, end).replace(/'/g, "\ufffe").replace(/"/g, "\uffff") + text.slice(end); + } + + return text; +} + +function restoreQuotesInInlineComments(text) { + return text.replace(/\ufffe/g, "'").replace(/\uffff/g, '"'); +} + +var loc$1 = { + calculateLoc, + replaceQuotesInInlineComments, + restoreQuotesInInlineComments +}; + +const colorAdjusterFunctions = ["red", "green", "blue", "alpha", "a", "rgb", "hue", "h", "saturation", "s", "lightness", "l", "whiteness", "w", "blackness", "b", "tint", "shade", "blend", "blenda", "contrast", "hsl", "hsla", "hwb", "hwba"]; + +function getAncestorCounter(path, typeOrTypes) { + const types = [].concat(typeOrTypes); + let counter = -1; + let ancestorNode; + + while (ancestorNode = path.getParentNode(++counter)) { + if (types.includes(ancestorNode.type)) { + return counter; + } + } + + return -1; +} + +function getAncestorNode(path, typeOrTypes) { + const counter = getAncestorCounter(path, typeOrTypes); + return counter === -1 ? null : path.getParentNode(counter); +} + +function getPropOfDeclNode(path) { + const declAncestorNode = getAncestorNode(path, "css-decl"); + return declAncestorNode && declAncestorNode.prop && declAncestorNode.prop.toLowerCase(); +} + +function isSCSS(parser, text) { + const hasExplicitParserChoice = parser === "less" || parser === "scss"; + const IS_POSSIBLY_SCSS = /(\w\s*:\s*[^}:]+|#){|@import[^\n]+(?:url|,)/; + return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(text); +} + +function isWideKeywords(value) { + return ["initial", "inherit", "unset", "revert"].includes(value.toLowerCase()); +} + +function isKeyframeAtRuleKeywords(path, value) { + const atRuleAncestorNode = getAncestorNode(path, "css-atrule"); + return atRuleAncestorNode && atRuleAncestorNode.name && atRuleAncestorNode.name.toLowerCase().endsWith("keyframes") && ["from", "to"].includes(value.toLowerCase()); +} + +function maybeToLowerCase(value) { + return value.includes("$") || value.includes("@") || value.includes("#") || value.startsWith("%") || value.startsWith("--") || value.startsWith(":--") || value.includes("(") && value.includes(")") ? value : value.toLowerCase(); +} + +function insideValueFunctionNode(path, functionName) { + const funcAncestorNode = getAncestorNode(path, "value-func"); + return funcAncestorNode && funcAncestorNode.value && funcAncestorNode.value.toLowerCase() === functionName; +} + +function insideICSSRuleNode(path) { + const ruleAncestorNode = getAncestorNode(path, "css-rule"); + return ruleAncestorNode && ruleAncestorNode.raws && ruleAncestorNode.raws.selector && (ruleAncestorNode.raws.selector.startsWith(":import") || ruleAncestorNode.raws.selector.startsWith(":export")); +} + +function insideAtRuleNode(path, atRuleNameOrAtRuleNames) { + const atRuleNames = [].concat(atRuleNameOrAtRuleNames); + const atRuleAncestorNode = getAncestorNode(path, "css-atrule"); + return atRuleAncestorNode && atRuleNames.includes(atRuleAncestorNode.name.toLowerCase()); +} + +function insideURLFunctionInImportAtRuleNode(path) { + const node = path.getValue(); + const atRuleAncestorNode = getAncestorNode(path, "css-atrule"); + return atRuleAncestorNode && atRuleAncestorNode.name === "import" && node.groups[0].value === "url" && node.groups.length === 2; +} + +function isURLFunctionNode(node) { + return node.type === "value-func" && node.value.toLowerCase() === "url"; +} + +function isLastNode(path, node) { + const parentNode = path.getParentNode(); + + if (!parentNode) { + return false; + } + + const { + nodes + } = parentNode; + return nodes && nodes.indexOf(node) === nodes.length - 1; +} + +function isDetachedRulesetDeclarationNode(node) { + // If a Less file ends up being parsed with the SCSS parser, Less + // variable declarations will be parsed as atrules with names ending + // with a colon, so keep the original case then. + if (!node.selector) { + return false; + } + + return typeof node.selector === "string" && /^@.+:.*$/.test(node.selector) || node.selector.value && /^@.+:.*$/.test(node.selector.value); +} + +function isForKeywordNode(node) { + return node.type === "value-word" && ["from", "through", "end"].includes(node.value); +} + +function isIfElseKeywordNode(node) { + return node.type === "value-word" && ["and", "or", "not"].includes(node.value); +} + +function isEachKeywordNode(node) { + return node.type === "value-word" && node.value === "in"; +} + +function isMultiplicationNode(node) { + return node.type === "value-operator" && node.value === "*"; +} + +function isDivisionNode(node) { + return node.type === "value-operator" && node.value === "/"; +} + +function isAdditionNode(node) { + return node.type === "value-operator" && node.value === "+"; +} + +function isSubtractionNode(node) { + return node.type === "value-operator" && node.value === "-"; +} + +function isModuloNode(node) { + return node.type === "value-operator" && node.value === "%"; +} + +function isMathOperatorNode(node) { + return isMultiplicationNode(node) || isDivisionNode(node) || isAdditionNode(node) || isSubtractionNode(node) || isModuloNode(node); +} + +function isEqualityOperatorNode(node) { + return node.type === "value-word" && ["==", "!="].includes(node.value); +} + +function isRelationalOperatorNode(node) { + return node.type === "value-word" && ["<", ">", "<=", ">="].includes(node.value); +} + +function isSCSSControlDirectiveNode(node) { + return node.type === "css-atrule" && ["if", "else", "for", "each", "while"].includes(node.name); +} + +function isSCSSNestedPropertyNode(node) { + if (!node.selector) { + return false; + } + + return node.selector.replace(/\/\*.*?\*\//, "").replace(/\/\/.*?\n/, "").trim().endsWith(":"); +} + +function isDetachedRulesetCallNode(node) { + return node.raws && node.raws.params && /^\(\s*\)$/.test(node.raws.params); +} + +function isTemplatePlaceholderNode(node) { + return node.name.startsWith("prettier-placeholder"); +} + +function isTemplatePropNode(node) { + return node.prop.startsWith("@prettier-placeholder"); +} + +function isPostcssSimpleVarNode(currentNode, nextNode) { + return currentNode.value === "$$" && currentNode.type === "value-func" && nextNode && nextNode.type === "value-word" && !nextNode.raws.before; +} + +function hasComposesNode(node) { + return node.value && node.value.type === "value-root" && node.value.group && node.value.group.type === "value-value" && node.prop.toLowerCase() === "composes"; +} + +function hasParensAroundNode(node) { + return node.value && node.value.group && node.value.group.group && node.value.group.group.type === "value-paren_group" && node.value.group.group.open !== null && node.value.group.group.close !== null; +} + +function hasEmptyRawBefore(node) { + return node.raws && node.raws.before === ""; +} + +function isKeyValuePairNode(node) { + return node.type === "value-comma_group" && node.groups && node.groups[1] && node.groups[1].type === "value-colon"; +} + +function isKeyValuePairInParenGroupNode(node) { + return node.type === "value-paren_group" && node.groups && node.groups[0] && isKeyValuePairNode(node.groups[0]); +} + +function isSCSSMapItemNode(path) { + const node = path.getValue(); // Ignore empty item (i.e. `$key: ()`) + + if (node.groups.length === 0) { + return false; + } + + const parentParentNode = path.getParentNode(1); // Check open parens contain key/value pair (i.e. `(key: value)` and `(key: (value, other-value)`) + + if (!isKeyValuePairInParenGroupNode(node) && !(parentParentNode && isKeyValuePairInParenGroupNode(parentParentNode))) { + return false; + } + + const declNode = getAncestorNode(path, "css-decl"); // SCSS map declaration (i.e. `$map: (key: value, other-key: other-value)`) + + if (declNode && declNode.prop && declNode.prop.startsWith("$")) { + return true; + } // List as value of key inside SCSS map (i.e. `$map: (key: (value other-value other-other-value))`) + + + if (isKeyValuePairInParenGroupNode(parentParentNode)) { + return true; + } // SCSS Map is argument of function (i.e. `func((key: value, other-key: other-value))`) + + + if (parentParentNode.type === "value-func") { + return true; + } + + return false; +} + +function isInlineValueCommentNode(node) { + return node.type === "value-comment" && node.inline; +} + +function isHashNode(node) { + return node.type === "value-word" && node.value === "#"; +} + +function isLeftCurlyBraceNode(node) { + return node.type === "value-word" && node.value === "{"; +} + +function isRightCurlyBraceNode(node) { + return node.type === "value-word" && node.value === "}"; +} + +function isWordNode(node) { + return ["value-word", "value-atword"].includes(node.type); +} + +function isColonNode(node) { + return node.type === "value-colon"; +} + +function isMediaAndSupportsKeywords(node) { + return node.value && ["not", "and", "or"].includes(node.value.toLowerCase()); +} + +function isColorAdjusterFuncNode(node) { + if (node.type !== "value-func") { + return false; + } + + return colorAdjusterFunctions.includes(node.value.toLowerCase()); +} // TODO: only check `less` when we don't use `less` to parse `css` + + +function isLessParser(options) { + return options.parser === "css" || options.parser === "less"; +} + +function lastLineHasInlineComment(text) { + return /\/\//.test(text.split(/[\r\n]/).pop()); +} + +var utils$7 = { + getAncestorCounter, + getAncestorNode, + getPropOfDeclNode, + maybeToLowerCase, + insideValueFunctionNode, + insideICSSRuleNode, + insideAtRuleNode, + insideURLFunctionInImportAtRuleNode, + isKeyframeAtRuleKeywords, + isWideKeywords, + isSCSS, + isLastNode, + isLessParser, + isSCSSControlDirectiveNode, + isDetachedRulesetDeclarationNode, + isRelationalOperatorNode, + isEqualityOperatorNode, + isMultiplicationNode, + isDivisionNode, + isAdditionNode, + isSubtractionNode, + isModuloNode, + isMathOperatorNode, + isEachKeywordNode, + isForKeywordNode, + isURLFunctionNode, + isIfElseKeywordNode, + hasComposesNode, + hasParensAroundNode, + hasEmptyRawBefore, + isSCSSNestedPropertyNode, + isDetachedRulesetCallNode, + isTemplatePlaceholderNode, + isTemplatePropNode, + isPostcssSimpleVarNode, + isKeyValuePairNode, + isKeyValuePairInParenGroupNode, + isSCSSMapItemNode, + isInlineValueCommentNode, + isHashNode, + isLeftCurlyBraceNode, + isRightCurlyBraceNode, + isWordNode, + isColonNode, + isMediaAndSupportsKeywords, + isColorAdjusterFuncNode, + lastLineHasInlineComment +}; + +const { + insertPragma: insertPragma$3 +} = pragma$1; +const { + printNumber: printNumber$2, + printString: printString$2, + hasIgnoreComment: hasIgnoreComment$3, + hasNewline: hasNewline$5 +} = util$1; +const { + isNextLineEmpty: isNextLineEmpty$3 +} = utilShared; +const { + restoreQuotesInInlineComments: restoreQuotesInInlineComments$1 +} = loc$1; +const { + builders: { + concat: concat$9, + join: join$6, + line: line$5, + hardline: hardline$7, + softline: softline$3, + group: group$6, + fill: fill$4, + indent: indent$5, + dedent: dedent$2, + ifBreak: ifBreak$2 + }, + utils: { + removeLines: removeLines$2 + } +} = document; +const { + getAncestorNode: getAncestorNode$1, + getPropOfDeclNode: getPropOfDeclNode$1, + maybeToLowerCase: maybeToLowerCase$1, + insideValueFunctionNode: insideValueFunctionNode$1, + insideICSSRuleNode: insideICSSRuleNode$1, + insideAtRuleNode: insideAtRuleNode$1, + insideURLFunctionInImportAtRuleNode: insideURLFunctionInImportAtRuleNode$1, + isKeyframeAtRuleKeywords: isKeyframeAtRuleKeywords$1, + isWideKeywords: isWideKeywords$1, + isSCSS: isSCSS$1, + isLastNode: isLastNode$1, + isLessParser: isLessParser$1, + isSCSSControlDirectiveNode: isSCSSControlDirectiveNode$1, + isDetachedRulesetDeclarationNode: isDetachedRulesetDeclarationNode$1, + isRelationalOperatorNode: isRelationalOperatorNode$1, + isEqualityOperatorNode: isEqualityOperatorNode$1, + isMultiplicationNode: isMultiplicationNode$1, + isDivisionNode: isDivisionNode$1, + isAdditionNode: isAdditionNode$1, + isSubtractionNode: isSubtractionNode$1, + isMathOperatorNode: isMathOperatorNode$1, + isEachKeywordNode: isEachKeywordNode$1, + isForKeywordNode: isForKeywordNode$1, + isURLFunctionNode: isURLFunctionNode$1, + isIfElseKeywordNode: isIfElseKeywordNode$1, + hasComposesNode: hasComposesNode$1, + hasParensAroundNode: hasParensAroundNode$1, + hasEmptyRawBefore: hasEmptyRawBefore$1, + isKeyValuePairNode: isKeyValuePairNode$1, + isDetachedRulesetCallNode: isDetachedRulesetCallNode$1, + isTemplatePlaceholderNode: isTemplatePlaceholderNode$1, + isTemplatePropNode: isTemplatePropNode$1, + isPostcssSimpleVarNode: isPostcssSimpleVarNode$1, + isSCSSMapItemNode: isSCSSMapItemNode$1, + isInlineValueCommentNode: isInlineValueCommentNode$1, + isHashNode: isHashNode$1, + isLeftCurlyBraceNode: isLeftCurlyBraceNode$1, + isRightCurlyBraceNode: isRightCurlyBraceNode$1, + isWordNode: isWordNode$1, + isColonNode: isColonNode$1, + isMediaAndSupportsKeywords: isMediaAndSupportsKeywords$1, + isColorAdjusterFuncNode: isColorAdjusterFuncNode$1, + lastLineHasInlineComment: lastLineHasInlineComment$1 +} = utils$7; + +function shouldPrintComma$1(options) { + switch (options.trailingComma) { + case "all": + case "es5": + return true; + + case "none": + default: + return false; + } +} + +function genericPrint$2(path, options, print) { + const node = path.getValue(); + /* istanbul ignore if */ + + if (!node) { + return ""; + } + + if (typeof node === "string") { + return node; + } + + switch (node.type) { + case "yaml": + case "toml": + return concat$9([node.raw, hardline$7]); + + case "css-root": + { + const nodes = printNodeSequence(path, options, print); + + if (nodes.parts.length) { + return concat$9([nodes, options.__isHTMLStyleAttribute ? "" : hardline$7]); + } + + return nodes; + } + + case "css-comment": + { + const isInlineComment = node.inline || node.raws.inline; + const text = options.originalText.slice(options.locStart(node), options.locEnd(node)); + return isInlineComment ? text.trimEnd() : text; + } + + case "css-rule": + { + return concat$9([path.call(print, "selector"), node.important ? " !important" : "", node.nodes ? concat$9([node.selector && node.selector.type === "selector-unknown" && lastLineHasInlineComment$1(node.selector.value) ? line$5 : " ", "{", node.nodes.length > 0 ? indent$5(concat$9([hardline$7, printNodeSequence(path, options, print)])) : "", hardline$7, "}", isDetachedRulesetDeclarationNode$1(node) ? ";" : ""]) : ";"]); + } + + case "css-decl": + { + const parentNode = path.getParentNode(); + return concat$9([node.raws.before.replace(/[\s;]/g, ""), insideICSSRuleNode$1(path) ? node.prop : maybeToLowerCase$1(node.prop), node.raws.between.trim() === ":" ? ":" : node.raws.between.trim(), node.extend ? "" : " ", hasComposesNode$1(node) ? removeLines$2(path.call(print, "value")) : path.call(print, "value"), node.raws.important ? node.raws.important.replace(/\s*!\s*important/i, " !important") : node.important ? " !important" : "", node.raws.scssDefault ? node.raws.scssDefault.replace(/\s*!default/i, " !default") : node.scssDefault ? " !default" : "", node.raws.scssGlobal ? node.raws.scssGlobal.replace(/\s*!global/i, " !global") : node.scssGlobal ? " !global" : "", node.nodes ? concat$9([" {", indent$5(concat$9([softline$3, printNodeSequence(path, options, print)])), softline$3, "}"]) : isTemplatePropNode$1(node) && !parentNode.raws.semicolon && options.originalText[options.locEnd(node) - 1] !== ";" ? "" : ";"]); + } + + case "css-atrule": + { + const parentNode = path.getParentNode(); + const isTemplatePlaceholderNodeWithoutSemiColon = isTemplatePlaceholderNode$1(node) && !parentNode.raws.semicolon && options.originalText[options.locEnd(node) - 1] !== ";"; + + if (isLessParser$1(options)) { + if (node.mixin) { + return concat$9([path.call(print, "selector"), node.important ? " !important" : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]); + } + + if (node.function) { + return concat$9([node.name, concat$9([path.call(print, "params")]), isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]); + } + + if (node.variable) { + return concat$9(["@", node.name, ": ", node.value ? concat$9([path.call(print, "value")]) : "", node.raws.between.trim() ? node.raws.between.trim() + " " : "", node.nodes ? concat$9(["{", indent$5(concat$9([node.nodes.length > 0 ? softline$3 : "", printNodeSequence(path, options, print)])), softline$3, "}"]) : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]); + } + } + + return concat$9(["@", // If a Less file ends up being parsed with the SCSS parser, Less + // variable declarations will be parsed as at-rules with names ending + // with a colon, so keep the original case then. + isDetachedRulesetCallNode$1(node) || node.name.endsWith(":") ? node.name : maybeToLowerCase$1(node.name), node.params ? concat$9([isDetachedRulesetCallNode$1(node) ? "" : isTemplatePlaceholderNode$1(node) ? node.raws.afterName === "" ? "" : node.name.endsWith(":") ? " " : /^\s*\n\s*\n/.test(node.raws.afterName) ? concat$9([hardline$7, hardline$7]) : /^\s*\n/.test(node.raws.afterName) ? hardline$7 : " " : " ", path.call(print, "params")]) : "", node.selector ? indent$5(concat$9([" ", path.call(print, "selector")])) : "", node.value ? group$6(concat$9([" ", path.call(print, "value"), isSCSSControlDirectiveNode$1(node) ? hasParensAroundNode$1(node) ? " " : line$5 : ""])) : node.name === "else" ? " " : "", node.nodes ? concat$9([isSCSSControlDirectiveNode$1(node) ? "" : " ", "{", indent$5(concat$9([node.nodes.length > 0 ? softline$3 : "", printNodeSequence(path, options, print)])), softline$3, "}"]) : isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]); + } + // postcss-media-query-parser + + case "media-query-list": + { + const parts = []; + path.each(childPath => { + const node = childPath.getValue(); + + if (node.type === "media-query" && node.value === "") { + return; + } + + parts.push(childPath.call(print)); + }, "nodes"); + return group$6(indent$5(join$6(line$5, parts))); + } + + case "media-query": + { + return concat$9([join$6(" ", path.map(print, "nodes")), isLastNode$1(path, node) ? "" : ","]); + } + + case "media-type": + { + return adjustNumbers(adjustStrings(node.value, options)); + } + + case "media-feature-expression": + { + if (!node.nodes) { + return node.value; + } + + return concat$9(["(", concat$9(path.map(print, "nodes")), ")"]); + } + + case "media-feature": + { + return maybeToLowerCase$1(adjustStrings(node.value.replace(/ +/g, " "), options)); + } + + case "media-colon": + { + return concat$9([node.value, " "]); + } + + case "media-value": + { + return adjustNumbers(adjustStrings(node.value, options)); + } + + case "media-keyword": + { + return adjustStrings(node.value, options); + } + + case "media-url": + { + return adjustStrings(node.value.replace(/^url\(\s+/gi, "url(").replace(/\s+\)$/gi, ")"), options); + } + + case "media-unknown": + { + return node.value; + } + // postcss-selector-parser + + case "selector-root": + { + return group$6(concat$9([insideAtRuleNode$1(path, "custom-selector") ? concat$9([getAncestorNode$1(path, "css-atrule").customSelector, line$5]) : "", join$6(concat$9([",", insideAtRuleNode$1(path, ["extend", "custom-selector", "nest"]) ? line$5 : hardline$7]), path.map(print, "nodes"))])); + } + + case "selector-selector": + { + return group$6(indent$5(concat$9(path.map(print, "nodes")))); + } + + case "selector-comment": + { + return node.value; + } + + case "selector-string": + { + return adjustStrings(node.value, options); + } + + case "selector-tag": + { + const parentNode = path.getParentNode(); + const index = parentNode && parentNode.nodes.indexOf(node); + const prevNode = index && parentNode.nodes[index - 1]; + return concat$9([node.namespace ? concat$9([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", prevNode.type === "selector-nesting" ? node.value : adjustNumbers(isKeyframeAtRuleKeywords$1(path, node.value) ? node.value.toLowerCase() : node.value)]); + } + + case "selector-id": + { + return concat$9(["#", node.value]); + } + + case "selector-class": + { + return concat$9([".", adjustNumbers(adjustStrings(node.value, options))]); + } + + case "selector-attribute": + { + return concat$9(["[", node.namespace ? concat$9([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", node.attribute.trim(), node.operator ? node.operator : "", node.value ? quoteAttributeValue(adjustStrings(node.value.trim(), options), options) : "", node.insensitive ? " i" : "", "]"]); + } + + case "selector-combinator": + { + if (node.value === "+" || node.value === ">" || node.value === "~" || node.value === ">>>") { + const parentNode = path.getParentNode(); + const leading = parentNode.type === "selector-selector" && parentNode.nodes[0] === node ? "" : line$5; + return concat$9([leading, node.value, isLastNode$1(path, node) ? "" : " "]); + } + + const leading = node.value.trim().startsWith("(") ? line$5 : ""; + const value = adjustNumbers(adjustStrings(node.value.trim(), options)) || line$5; + return concat$9([leading, value]); + } + + case "selector-universal": + { + return concat$9([node.namespace ? concat$9([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", node.value]); + } + + case "selector-pseudo": + { + return concat$9([maybeToLowerCase$1(node.value), node.nodes && node.nodes.length > 0 ? concat$9(["(", join$6(", ", path.map(print, "nodes")), ")"]) : ""]); + } + + case "selector-nesting": + { + return node.value; + } + + case "selector-unknown": + { + const ruleAncestorNode = getAncestorNode$1(path, "css-rule"); // Nested SCSS property + + if (ruleAncestorNode && ruleAncestorNode.isSCSSNesterProperty) { + return adjustNumbers(adjustStrings(maybeToLowerCase$1(node.value), options)); + } // originalText has to be used for Less, see replaceQuotesInInlineComments in loc.js + + + const parentNode = path.getParentNode(); + + if (parentNode.raws && parentNode.raws.selector) { + const start = options.locStart(parentNode); + const end = start + parentNode.raws.selector.length; + return options.originalText.slice(start, end).trim(); + } + + return node.value; + } + // postcss-values-parser + + case "value-value": + case "value-root": + { + return path.call(print, "group"); + } + + case "value-comment": + { + return concat$9([node.inline ? "//" : "/*", // see replaceQuotesInInlineComments in loc.js + // value-* nodes don't have correct location data, so we have to rely on placeholder characters. + restoreQuotesInInlineComments$1(node.value), node.inline ? "" : "*/"]); + } + + case "value-comma_group": + { + const parentNode = path.getParentNode(); + const parentParentNode = path.getParentNode(1); + const declAncestorProp = getPropOfDeclNode$1(path); + const isGridValue = declAncestorProp && parentNode.type === "value-value" && (declAncestorProp === "grid" || declAncestorProp.startsWith("grid-template")); + const atRuleAncestorNode = getAncestorNode$1(path, "css-atrule"); + const isControlDirective = atRuleAncestorNode && isSCSSControlDirectiveNode$1(atRuleAncestorNode); + const printed = path.map(print, "groups"); + const parts = []; + const insideURLFunction = insideValueFunctionNode$1(path, "url"); + let insideSCSSInterpolationInString = false; + let didBreak = false; + + for (let i = 0; i < node.groups.length; ++i) { + parts.push(printed[i]); + const iPrevNode = node.groups[i - 1]; + const iNode = node.groups[i]; + const iNextNode = node.groups[i + 1]; + const iNextNextNode = node.groups[i + 2]; + + if (insideURLFunction) { + if (iNextNode && isAdditionNode$1(iNextNode) || isAdditionNode$1(iNode)) { + parts.push(" "); + } + + continue; + } // Ignore after latest node (i.e. before semicolon) + + + if (!iNextNode) { + continue; + } // styled.div` background: var(--${one}); ` + + + if (!iPrevNode && iNode.value === "--" && iNextNode.type === "value-atword") { + continue; + } // Ignore spaces before/after string interpolation (i.e. `"#{my-fn("_")}"`) + + + const isStartSCSSInterpolationInString = iNode.type === "value-string" && iNode.value.startsWith("#{"); + const isEndingSCSSInterpolationInString = insideSCSSInterpolationInString && iNextNode.type === "value-string" && iNextNode.value.endsWith("}"); + + if (isStartSCSSInterpolationInString || isEndingSCSSInterpolationInString) { + insideSCSSInterpolationInString = !insideSCSSInterpolationInString; + continue; + } + + if (insideSCSSInterpolationInString) { + continue; + } // Ignore colon (i.e. `:`) + + + if (isColonNode$1(iNode) || isColonNode$1(iNextNode)) { + continue; + } // Ignore `@` in Less (i.e. `@@var;`) + + + if (iNode.type === "value-atword" && iNode.value === "") { + continue; + } // Ignore `~` in Less (i.e. `content: ~"^//* some horrible but needed css hack";`) + + + if (iNode.value === "~") { + continue; + } // Ignore escape `\` + + + if (iNode.value && iNode.value.includes("\\") && iNextNode && iNextNode.type !== "value-comment") { + continue; + } // Ignore escaped `/` + + + if (iPrevNode && iPrevNode.value && iPrevNode.value.indexOf("\\") === iPrevNode.value.length - 1 && iNode.type === "value-operator" && iNode.value === "/") { + continue; + } // Ignore `\` (i.e. `$variable: \@small;`) + + + if (iNode.value === "\\") { + continue; + } // Ignore `$$` (i.e. `background-color: $$(style)Color;`) + + + if (isPostcssSimpleVarNode$1(iNode, iNextNode)) { + continue; + } // Ignore spaces after `#` and after `{` and before `}` in SCSS interpolation (i.e. `#{variable}`) + + + if (isHashNode$1(iNode) || isLeftCurlyBraceNode$1(iNode) || isRightCurlyBraceNode$1(iNextNode) || isLeftCurlyBraceNode$1(iNextNode) && hasEmptyRawBefore$1(iNextNode) || isRightCurlyBraceNode$1(iNode) && hasEmptyRawBefore$1(iNextNode)) { + continue; + } // Ignore css variables and interpolation in SCSS (i.e. `--#{$var}`) + + + if (iNode.value === "--" && isHashNode$1(iNextNode)) { + continue; + } // Formatting math operations + + + const isMathOperator = isMathOperatorNode$1(iNode); + const isNextMathOperator = isMathOperatorNode$1(iNextNode); // Print spaces before and after math operators beside SCSS interpolation as is + // (i.e. `#{$var}+5`, `#{$var} +5`, `#{$var}+ 5`, `#{$var} + 5`) + // (i.e. `5+#{$var}`, `5 +#{$var}`, `5+ #{$var}`, `5 + #{$var}`) + + if ((isMathOperator && isHashNode$1(iNextNode) || isNextMathOperator && isRightCurlyBraceNode$1(iNode)) && hasEmptyRawBefore$1(iNextNode)) { + continue; + } // Print spaces before and after addition and subtraction math operators as is in `calc` function + // due to the fact that it is not valid syntax + // (i.e. `calc(1px+1px)`, `calc(1px+ 1px)`, `calc(1px +1px)`, `calc(1px + 1px)`) + + + if (insideValueFunctionNode$1(path, "calc") && (isAdditionNode$1(iNode) || isAdditionNode$1(iNextNode) || isSubtractionNode$1(iNode) || isSubtractionNode$1(iNextNode)) && hasEmptyRawBefore$1(iNextNode)) { + continue; + } // Print spaces after `+` and `-` in color adjuster functions as is (e.g. `color(red l(+ 20%))`) + // Adjusters with signed numbers (e.g. `color(red l(+20%))`) output as-is. + + + const isColorAdjusterNode = (isAdditionNode$1(iNode) || isSubtractionNode$1(iNode)) && i === 0 && (iNextNode.type === "value-number" || iNextNode.isHex) && parentParentNode && isColorAdjusterFuncNode$1(parentParentNode) && !hasEmptyRawBefore$1(iNextNode); + const requireSpaceBeforeOperator = iNextNextNode && iNextNextNode.type === "value-func" || iNextNextNode && isWordNode$1(iNextNextNode) || iNode.type === "value-func" || isWordNode$1(iNode); + const requireSpaceAfterOperator = iNextNode.type === "value-func" || isWordNode$1(iNextNode) || iPrevNode && iPrevNode.type === "value-func" || iPrevNode && isWordNode$1(iPrevNode); // Formatting `/`, `+`, `-` sign + + if (!(isMultiplicationNode$1(iNextNode) || isMultiplicationNode$1(iNode)) && !insideValueFunctionNode$1(path, "calc") && !isColorAdjusterNode && (isDivisionNode$1(iNextNode) && !requireSpaceBeforeOperator || isDivisionNode$1(iNode) && !requireSpaceAfterOperator || isAdditionNode$1(iNextNode) && !requireSpaceBeforeOperator || isAdditionNode$1(iNode) && !requireSpaceAfterOperator || isSubtractionNode$1(iNextNode) || isSubtractionNode$1(iNode)) && (hasEmptyRawBefore$1(iNextNode) || isMathOperator && (!iPrevNode || iPrevNode && isMathOperatorNode$1(iPrevNode)))) { + continue; + } // Add `hardline` after inline comment (i.e. `// comment\n foo: bar;`) + + + if (isInlineValueCommentNode$1(iNode)) { + parts.push(hardline$7); + continue; + } // Handle keywords in SCSS control directive + + + if (isControlDirective && (isEqualityOperatorNode$1(iNextNode) || isRelationalOperatorNode$1(iNextNode) || isIfElseKeywordNode$1(iNextNode) || isEachKeywordNode$1(iNode) || isForKeywordNode$1(iNode))) { + parts.push(" "); + continue; + } // At-rule `namespace` should be in one line + + + if (atRuleAncestorNode && atRuleAncestorNode.name.toLowerCase() === "namespace") { + parts.push(" "); + continue; + } // Formatting `grid` property + + + if (isGridValue) { + if (iNode.source && iNextNode.source && iNode.source.start.line !== iNextNode.source.start.line) { + parts.push(hardline$7); + didBreak = true; + } else { + parts.push(" "); + } + + continue; + } // Add `space` before next math operation + // Note: `grip` property have `/` delimiter and it is not math operation, so + // `grid` property handles above + + + if (isNextMathOperator) { + parts.push(" "); + continue; + } // Be default all values go through `line` + + + parts.push(line$5); + } + + if (didBreak) { + parts.unshift(hardline$7); + } + + if (isControlDirective) { + return group$6(indent$5(concat$9(parts))); + } // Indent is not needed for import url when url is very long + // and node has two groups + // when type is value-comma_group + // example @import url("verylongurl") projection,tv + + + if (insideURLFunctionInImportAtRuleNode$1(path)) { + return group$6(fill$4(parts)); + } + + return group$6(indent$5(fill$4(parts))); + } + + case "value-paren_group": + { + const parentNode = path.getParentNode(); + + if (parentNode && isURLFunctionNode$1(parentNode) && (node.groups.length === 1 || node.groups.length > 0 && node.groups[0].type === "value-comma_group" && node.groups[0].groups.length > 0 && node.groups[0].groups[0].type === "value-word" && node.groups[0].groups[0].value.startsWith("data:"))) { + return concat$9([node.open ? path.call(print, "open") : "", join$6(",", path.map(print, "groups")), node.close ? path.call(print, "close") : ""]); + } + + if (!node.open) { + const printed = path.map(print, "groups"); + const res = []; + + for (let i = 0; i < printed.length; i++) { + if (i !== 0) { + res.push(concat$9([",", line$5])); + } + + res.push(printed[i]); + } + + return group$6(indent$5(fill$4(res))); + } + + const isSCSSMapItem = isSCSSMapItemNode$1(path); + const lastItem = node.groups[node.groups.length - 1]; + const isLastItemComment = lastItem && lastItem.type === "value-comment"; + return group$6(concat$9([node.open ? path.call(print, "open") : "", indent$5(concat$9([softline$3, join$6(concat$9([",", line$5]), path.map(childPath => { + const node = childPath.getValue(); + const printed = print(childPath); // Key/Value pair in open paren already indented + + if (isKeyValuePairNode$1(node) && node.type === "value-comma_group" && node.groups && node.groups[2] && node.groups[2].type === "value-paren_group") { + printed.contents.contents.parts[1] = group$6(printed.contents.contents.parts[1]); + return group$6(dedent$2(printed)); + } + + return printed; + }, "groups"))])), ifBreak$2(!isLastItemComment && isSCSS$1(options.parser, options.originalText) && isSCSSMapItem && shouldPrintComma$1(options) ? "," : ""), softline$3, node.close ? path.call(print, "close") : ""]), { + shouldBreak: isSCSSMapItem + }); + } + + case "value-func": + { + return concat$9([node.value, insideAtRuleNode$1(path, "supports") && isMediaAndSupportsKeywords$1(node) ? " " : "", path.call(print, "group")]); + } + + case "value-paren": + { + return node.value; + } + + case "value-number": + { + return concat$9([printCssNumber(node.value), maybeToLowerCase$1(node.unit)]); + } + + case "value-operator": + { + return node.value; + } + + case "value-word": + { + if (node.isColor && node.isHex || isWideKeywords$1(node.value)) { + return node.value.toLowerCase(); + } + + return node.value; + } + + case "value-colon": + { + return concat$9([node.value, // Don't add spaces on `:` in `url` function (i.e. `url(fbglyph: cross-outline, fig-white)`) + insideValueFunctionNode$1(path, "url") ? "" : line$5]); + } + + case "value-comma": + { + return concat$9([node.value, " "]); + } + + case "value-string": + { + return printString$2(node.raws.quote + node.value + node.raws.quote, options); + } + + case "value-atword": + { + return concat$9(["@", node.value]); + } + + case "value-unicode-range": + { + return node.value; + } + + case "value-unknown": + { + return node.value; + } + + default: + /* istanbul ignore next */ + throw new Error(`Unknown postcss type ${JSON.stringify(node.type)}`); + } +} + +function printNodeSequence(path, options, print) { + const node = path.getValue(); + const parts = []; + let i = 0; + path.map(pathChild => { + const prevNode = node.nodes[i - 1]; + + if (prevNode && prevNode.type === "css-comment" && prevNode.text.trim() === "prettier-ignore") { + const childNode = pathChild.getValue(); + parts.push(options.originalText.slice(options.locStart(childNode), options.locEnd(childNode))); + } else { + parts.push(pathChild.call(print)); + } + + if (i !== node.nodes.length - 1) { + if (node.nodes[i + 1].type === "css-comment" && !hasNewline$5(options.originalText, options.locStart(node.nodes[i + 1]), { + backwards: true + }) && node.nodes[i].type !== "yaml" && node.nodes[i].type !== "toml" || node.nodes[i + 1].type === "css-atrule" && node.nodes[i + 1].name === "else" && node.nodes[i].type !== "css-comment") { + parts.push(" "); + } else { + parts.push(options.__isHTMLStyleAttribute ? line$5 : hardline$7); + + if (isNextLineEmpty$3(options.originalText, pathChild.getValue(), options.locEnd) && node.nodes[i].type !== "yaml" && node.nodes[i].type !== "toml") { + parts.push(hardline$7); + } + } + } + + i++; + }, "nodes"); + return concat$9(parts); +} + +const STRING_REGEX$3 = /(['"])(?:(?!\1)[^\\]|\\[\s\S])*\1/g; +const NUMBER_REGEX = /(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g; +const STANDARD_UNIT_REGEX = /[a-zA-Z]+/g; +const WORD_PART_REGEX = /[$@]?[a-zA-Z_\u0080-\uFFFF][\w\-\u0080-\uFFFF]*/g; +const ADJUST_NUMBERS_REGEX = new RegExp(STRING_REGEX$3.source + "|" + `(${WORD_PART_REGEX.source})?` + `(${NUMBER_REGEX.source})` + `(${STANDARD_UNIT_REGEX.source})?`, "g"); + +function adjustStrings(value, options) { + return value.replace(STRING_REGEX$3, match => printString$2(match, options)); +} + +function quoteAttributeValue(value, options) { + const quote = options.singleQuote ? "'" : '"'; + return value.includes('"') || value.includes("'") ? value : quote + value + quote; +} + +function adjustNumbers(value) { + return value.replace(ADJUST_NUMBERS_REGEX, (match, quote, wordPart, number, unit) => !wordPart && number ? printCssNumber(number) + maybeToLowerCase$1(unit || "") : match); +} + +function printCssNumber(rawNumber) { + return printNumber$2(rawNumber) // Remove trailing `.0`. + .replace(/\.0(?=$|e)/, ""); +} + +var printerPostcss = { + print: genericPrint$2, + embed: embed_1$1, + insertPragma: insertPragma$3, + hasPrettierIgnore: hasIgnoreComment$3, + massageAstNode: clean_1$1 +}; + +var options$3 = { + singleQuote: commonOptions.singleQuote +}; + +var name$9 = "CSS"; +var type$7 = "markup"; +var tmScope$7 = "source.css"; +var aceMode$7 = "css"; +var codemirrorMode$7 = "css"; +var codemirrorMimeType$7 = "text/css"; +var color$2 = "#563d7c"; +var extensions$7 = [ + ".css" +]; +var languageId$7 = 50; +var CSS = { + name: name$9, + type: type$7, + tmScope: tmScope$7, + aceMode: aceMode$7, + codemirrorMode: codemirrorMode$7, + codemirrorMimeType: codemirrorMimeType$7, + color: color$2, + extensions: extensions$7, + languageId: languageId$7 +}; + +var CSS$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$9, + type: type$7, + tmScope: tmScope$7, + aceMode: aceMode$7, + codemirrorMode: codemirrorMode$7, + codemirrorMimeType: codemirrorMimeType$7, + color: color$2, + extensions: extensions$7, + languageId: languageId$7, + 'default': CSS +}); + +var name$a = "PostCSS"; +var type$8 = "markup"; +var tmScope$8 = "source.postcss"; +var group$7 = "CSS"; +var extensions$8 = [ + ".pcss", + ".postcss" +]; +var aceMode$8 = "text"; +var languageId$8 = 262764437; +var PostCSS = { + name: name$a, + type: type$8, + tmScope: tmScope$8, + group: group$7, + extensions: extensions$8, + aceMode: aceMode$8, + languageId: languageId$8 +}; + +var PostCSS$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$a, + type: type$8, + tmScope: tmScope$8, + group: group$7, + extensions: extensions$8, + aceMode: aceMode$8, + languageId: languageId$8, + 'default': PostCSS +}); + +var name$b = "Less"; +var type$9 = "markup"; +var group$8 = "CSS"; +var extensions$9 = [ + ".less" +]; +var tmScope$9 = "source.css.less"; +var aceMode$9 = "less"; +var codemirrorMode$8 = "css"; +var codemirrorMimeType$8 = "text/css"; +var languageId$9 = 198; +var Less = { + name: name$b, + type: type$9, + group: group$8, + extensions: extensions$9, + tmScope: tmScope$9, + aceMode: aceMode$9, + codemirrorMode: codemirrorMode$8, + codemirrorMimeType: codemirrorMimeType$8, + languageId: languageId$9 +}; + +var Less$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$b, + type: type$9, + group: group$8, + extensions: extensions$9, + tmScope: tmScope$9, + aceMode: aceMode$9, + codemirrorMode: codemirrorMode$8, + codemirrorMimeType: codemirrorMimeType$8, + languageId: languageId$9, + 'default': Less +}); + +var name$c = "SCSS"; +var type$a = "markup"; +var tmScope$a = "source.css.scss"; +var group$9 = "CSS"; +var aceMode$a = "scss"; +var codemirrorMode$9 = "css"; +var codemirrorMimeType$9 = "text/x-scss"; +var extensions$a = [ + ".scss" +]; +var languageId$a = 329; +var SCSS = { + name: name$c, + type: type$a, + tmScope: tmScope$a, + group: group$9, + aceMode: aceMode$a, + codemirrorMode: codemirrorMode$9, + codemirrorMimeType: codemirrorMimeType$9, + extensions: extensions$a, + languageId: languageId$a +}; + +var SCSS$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$c, + type: type$a, + tmScope: tmScope$a, + group: group$9, + aceMode: aceMode$a, + codemirrorMode: codemirrorMode$9, + codemirrorMimeType: codemirrorMimeType$9, + extensions: extensions$a, + languageId: languageId$a, + 'default': SCSS +}); + +var require$$0$2 = getCjsExportFromNamespace(CSS$1); + +var require$$1$2 = getCjsExportFromNamespace(PostCSS$1); + +var require$$2$1 = getCjsExportFromNamespace(Less$1); + +var require$$3$1 = getCjsExportFromNamespace(SCSS$1); + +const languages$1 = [createLanguage(require$$0$2, () => ({ + since: "1.4.0", + parsers: ["css"], + vscodeLanguageIds: ["css"] +})), createLanguage(require$$1$2, () => ({ + since: "1.4.0", + parsers: ["css"], + vscodeLanguageIds: ["postcss"] +})), createLanguage(require$$2$1, () => ({ + since: "1.4.0", + parsers: ["less"], + vscodeLanguageIds: ["less"] +})), createLanguage(require$$3$1, () => ({ + since: "1.4.0", + parsers: ["scss"], + vscodeLanguageIds: ["scss"] +}))]; +const printers$1 = { + postcss: printerPostcss +}; +var languageCss = { + languages: languages$1, + options: options$3, + printers: printers$1 +}; + +var clean$3 = function (ast, newNode) { + delete newNode.loc; + delete newNode.selfClosing; // (Glimmer/HTML) ignore TextNode whitespace + + if (ast.type === "TextNode") { + const trimmed = ast.chars.trim(); + + if (!trimmed) { + return null; + } + + newNode.chars = trimmed; + } +}; + +function isUppercase(string) { + return string.toUpperCase() === string; +} + +function isGlimmerComponent(node) { + return isNodeOfSomeType(node, ["ElementNode"]) && typeof node.tag === "string" && (isUppercase(node.tag[0]) || node.tag.includes(".")); +} + +function isWhitespaceNode(node) { + return isNodeOfSomeType(node, ["TextNode"]) && !/\S/.test(node.chars); +} + +function isNodeOfSomeType(node, types) { + return node && types.some(type => node.type === type); +} + +function isParentOfSomeType(path, types) { + const parentNode = path.getParentNode(0); + return isNodeOfSomeType(parentNode, types); +} + +function isPreviousNodeOfSomeType(path, types) { + const previousNode = getPreviousNode(path); + return isNodeOfSomeType(previousNode, types); +} + +function isNextNodeOfSomeType(path, types) { + const nextNode = getNextNode(path); + return isNodeOfSomeType(nextNode, types); +} + +function getSiblingNode(path, offset) { + const node = path.getValue(); + const parentNode = path.getParentNode(0) || {}; + const children = parentNode.children || parentNode.body || []; + const index = children.indexOf(node); + return index !== -1 && children[index + offset]; +} + +function getPreviousNode(path, lookBack = 1) { + return getSiblingNode(path, -lookBack); +} + +function getNextNode(path) { + return getSiblingNode(path, 1); +} + +function isPrettierIgnoreNode(node) { + return isNodeOfSomeType(node, ["MustacheCommentStatement"]) && typeof node.value === "string" && node.value.trim() === "prettier-ignore"; +} + +function hasPrettierIgnore$2(path) { + const node = path.getValue(); + const previousPreviousNode = getPreviousNode(path, 2); + return isPrettierIgnoreNode(node) || isPrettierIgnoreNode(previousPreviousNode); +} + +var utils$8 = { + getNextNode, + getPreviousNode, + hasPrettierIgnore: hasPrettierIgnore$2, + isGlimmerComponent, + isNextNodeOfSomeType, + isNodeOfSomeType, + isParentOfSomeType, + isPreviousNodeOfSomeType, + isWhitespaceNode +}; + +const { + concat: concat$a, + join: join$7, + softline: softline$4, + hardline: hardline$8, + line: line$6, + group: group$a, + indent: indent$6, + ifBreak: ifBreak$3 +} = document.builders; +const { + getNextNode: getNextNode$1, + getPreviousNode: getPreviousNode$1, + hasPrettierIgnore: hasPrettierIgnore$3, + isGlimmerComponent: isGlimmerComponent$1, + isNextNodeOfSomeType: isNextNodeOfSomeType$1, + isParentOfSomeType: isParentOfSomeType$1, + isPreviousNodeOfSomeType: isPreviousNodeOfSomeType$1, + isWhitespaceNode: isWhitespaceNode$1 +} = utils$8; // http://w3c.github.io/html/single-page.html#void-elements + +const voidTags = ["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]; // Formatter based on @glimmerjs/syntax's built-in test formatter: +// https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/syntax/lib/generation/print.ts + +function print(path, options, print) { + const n = path.getValue(); + /* istanbul ignore if*/ + + if (!n) { + return ""; + } + + if (hasPrettierIgnore$3(path)) { + const startOffset = locationToOffset(options.originalText, n.loc.start.line - 1, n.loc.start.column); + const endOffset = locationToOffset(options.originalText, n.loc.end.line - 1, n.loc.end.column); + const ignoredText = options.originalText.slice(startOffset, endOffset); + return ignoredText; + } + + switch (n.type) { + case "Block": + case "Program": + case "Template": + { + return group$a(concat$a(path.map(print, "body"))); + } + + case "ElementNode": + { + const hasChildren = n.children.length > 0; + const hasNonWhitespaceChildren = n.children.some(n => !isWhitespaceNode$1(n)); + const isVoid = isGlimmerComponent$1(n) && (!hasChildren || !hasNonWhitespaceChildren) || voidTags.includes(n.tag); + const closeTagForNoBreak = isVoid ? concat$a([" />", softline$4]) : ">"; + const closeTagForBreak = isVoid ? "/>" : ">"; + + const printParams = (path, print) => indent$6(concat$a([n.attributes.length ? line$6 : "", join$7(line$6, path.map(print, "attributes")), n.modifiers.length ? line$6 : "", join$7(line$6, path.map(print, "modifiers")), n.comments.length ? line$6 : "", join$7(line$6, path.map(print, "comments"))])); + + const nextNode = getNextNode$1(path); + return concat$a([group$a(concat$a(["<", n.tag, printParams(path, print), n.blockParams.length ? ` as |${n.blockParams.join(" ")}|` : "", ifBreak$3(softline$4, ""), ifBreak$3(closeTagForBreak, closeTagForNoBreak)])), !isVoid ? group$a(concat$a([hasNonWhitespaceChildren ? indent$6(printChildren(path, options, print)) : "", ifBreak$3(hasChildren ? hardline$8 : "", ""), concat$a([""])])) : "", nextNode && nextNode.type === "ElementNode" ? hardline$8 : ""]); + } + + case "BlockStatement": + { + const pp = path.getParentNode(1); + const isElseIf = pp && pp.inverse && pp.inverse.body.length === 1 && pp.inverse.body[0] === n && pp.inverse.body[0].path.parts[0] === "if"; + const hasElseIf = n.inverse && n.inverse.body.length === 1 && n.inverse.body[0].type === "BlockStatement" && n.inverse.body[0].path.parts[0] === "if"; + const indentElse = hasElseIf ? a => a : indent$6; + const inverseElseStatement = (n.inverseStrip.open ? "{{~" : "{{") + "else" + (n.inverseStrip.close ? "~}}" : "}}"); + + if (n.inverse) { + return concat$a([isElseIf ? concat$a([n.openStrip.open ? "{{~else " : "{{else ", printPathParams(path, print), n.openStrip.close ? "~}}" : "}}"]) : printOpenBlock(path, print, n.openStrip), indent$6(concat$a([hardline$8, path.call(print, "program")])), n.inverse && !hasElseIf ? concat$a([hardline$8, inverseElseStatement]) : "", n.inverse ? indentElse(concat$a([hardline$8, path.call(print, "inverse")])) : "", isElseIf ? "" : concat$a([hardline$8, printCloseBlock(path, print, n.closeStrip)])]); + } else if (isElseIf) { + return concat$a([concat$a([n.openStrip.open ? "{{~else" : "{{else ", printPathParams(path, print), n.openStrip.close ? "~}}" : "}}"]), indent$6(concat$a([hardline$8, path.call(print, "program")]))]); + } + + const hasNonWhitespaceChildren = n.program.body.some(n => !isWhitespaceNode$1(n)); + return concat$a([printOpenBlock(path, print, n.openStrip), group$a(concat$a([indent$6(concat$a([softline$4, path.call(print, "program")])), hasNonWhitespaceChildren ? hardline$8 : softline$4, printCloseBlock(path, print, n.closeStrip)]))]); + } + + case "ElementModifierStatement": + { + return group$a(concat$a(["{{", printPathParams(path, print), softline$4, "}}"])); + } + + case "MustacheStatement": + { + const isEscaped = n.escaped === false; + const { + open: openStrip, + close: closeStrip + } = n.strip; + const opening = (isEscaped ? "{{{" : "{{") + (openStrip ? "~" : ""); + const closing = (closeStrip ? "~" : "") + (isEscaped ? "}}}" : "}}"); + const leading = isParentOfSomeType$1(path, ["AttrNode", "ConcatStatement", "ElementNode"]) ? [opening, indent$6(softline$4)] : [opening]; + return group$a(concat$a([...leading, printPathParams(path, print), softline$4, closing])); + } + + case "SubExpression": + { + const params = printParams(path, print); + const printedParams = params.length > 0 ? indent$6(concat$a([line$6, group$a(join$7(line$6, params))])) : ""; + return group$a(concat$a(["(", printPath(path, print), printedParams, softline$4, ")"])); + } + + case "AttrNode": + { + const isText = n.value.type === "TextNode"; + const isEmptyText = isText && n.value.chars === ""; // If the text is empty and the value's loc start and end columns are the + // same, there is no value for this AttrNode and it should be printed + // without the `=""`. Example: `` -> `` + + const isEmptyValue = isEmptyText && n.value.loc.start.column === n.value.loc.end.column; + + if (isEmptyValue) { + return concat$a([n.name]); + } + + const value = path.call(print, "value"); + const quotedValue = isText ? printStringLiteral(value.parts.join(), options) : value; + return concat$a([n.name, "=", quotedValue]); + } + + case "ConcatStatement": + { + return concat$a(['"', concat$a(path.map(partPath => print(partPath), "parts").filter(a => a !== "")), '"']); + } + + case "Hash": + { + return concat$a([join$7(line$6, path.map(print, "pairs"))]); + } + + case "HashPair": + { + return concat$a([n.key, "=", path.call(print, "value")]); + } + + case "TextNode": + { + const maxLineBreaksToPreserve = 2; + const isFirstElement = !getPreviousNode$1(path); + const isLastElement = !getNextNode$1(path); + const isWhitespaceOnly = !/\S/.test(n.chars); + const lineBreaksCount = countNewLines(n.chars); + const hasBlockParent = path.getParentNode(0).type === "Block"; + const hasElementParent = path.getParentNode(0).type === "ElementNode"; + const hasTemplateParent = path.getParentNode(0).type === "Template"; + let leadingLineBreaksCount = countLeadingNewLines(n.chars); + let trailingLineBreaksCount = countTrailingNewLines(n.chars); + + if ((isFirstElement || isLastElement) && isWhitespaceOnly && (hasBlockParent || hasElementParent || hasTemplateParent)) { + return ""; + } + + if (isWhitespaceOnly && lineBreaksCount) { + leadingLineBreaksCount = Math.min(lineBreaksCount, maxLineBreaksToPreserve); + trailingLineBreaksCount = 0; + } else { + if (isNextNodeOfSomeType$1(path, ["BlockStatement", "ElementNode"])) { + trailingLineBreaksCount = Math.max(trailingLineBreaksCount, 1); + } + + if (isPreviousNodeOfSomeType$1(path, ["ElementNode"]) || isPreviousNodeOfSomeType$1(path, ["BlockStatement"])) { + leadingLineBreaksCount = Math.max(leadingLineBreaksCount, 1); + } + } + + let leadingSpace = ""; + let trailingSpace = ""; // preserve a space inside of an attribute node where whitespace present, + // when next to mustache statement. + + const inAttrNode = path.stack.includes("attributes"); + + if (inAttrNode) { + const parentNode = path.getParentNode(0); + const isConcat = parentNode.type === "ConcatStatement"; + + if (isConcat) { + const { + parts + } = parentNode; + const partIndex = parts.indexOf(n); + + if (partIndex > 0) { + const partType = parts[partIndex - 1].type; + const isMustache = partType === "MustacheStatement"; + + if (isMustache) { + leadingSpace = " "; + } + } + + if (partIndex < parts.length - 1) { + const partType = parts[partIndex + 1].type; + const isMustache = partType === "MustacheStatement"; + + if (isMustache) { + trailingSpace = " "; + } + } + } + } else { + if (trailingLineBreaksCount === 0 && isNextNodeOfSomeType$1(path, ["MustacheStatement"])) { + trailingSpace = " "; + } + + if (leadingLineBreaksCount === 0 && isPreviousNodeOfSomeType$1(path, ["MustacheStatement"])) { + leadingSpace = " "; + } + + if (isFirstElement) { + leadingLineBreaksCount = 0; + leadingSpace = ""; + } + + if (isLastElement) { + trailingLineBreaksCount = 0; + trailingSpace = ""; + } + } + + return concat$a([...generateHardlines(leadingLineBreaksCount, maxLineBreaksToPreserve), n.chars.replace(/^[\s ]+/g, leadingSpace).replace(/[\s ]+$/, trailingSpace), ...generateHardlines(trailingLineBreaksCount, maxLineBreaksToPreserve)].filter(Boolean)); + } + + case "MustacheCommentStatement": + { + const dashes = n.value.includes("}}") ? "--" : ""; + return concat$a(["{{!", dashes, n.value, dashes, "}}"]); + } + + case "PathExpression": + { + return n.original; + } + + case "BooleanLiteral": + { + return String(n.value); + } + + case "CommentStatement": + { + return concat$a([""]); + } + + case "StringLiteral": + { + return printStringLiteral(n.value, options); + } + + case "NumberLiteral": + { + return String(n.value); + } + + case "UndefinedLiteral": + { + return "undefined"; + } + + case "NullLiteral": + { + return "null"; + } + + /* istanbul ignore next */ + + default: + throw new Error("unknown glimmer type: " + JSON.stringify(n.type)); + } +} + +function printChildren(path, options, print) { + return concat$a(path.map((childPath, childIndex) => { + const childNode = path.getValue(); + const isFirstNode = childIndex === 0; + const isLastNode = childIndex === path.getParentNode(0).children.length - 1; + const isLastNodeInMultiNodeList = isLastNode && !isFirstNode; + const isWhitespace = isWhitespaceNode$1(childNode); + + if (isWhitespace && isLastNodeInMultiNodeList) { + return print(childPath, options, print); + } else if (isFirstNode) { + return concat$a([softline$4, print(childPath, options, print)]); + } + + return print(childPath, options, print); + }, "children")); +} +/** + * Prints a string literal with the correct surrounding quotes based on + * `options.singleQuote` and the number of escaped quotes contained in + * the string literal. This function is the glimmer equivalent of `printString` + * in `common/util`, but has differences because of the way escaped characters + * are treated in hbs string literals. + * @param {string} stringLiteral - the string literal value + * @param {object} options - the prettier options object + */ + + +function printStringLiteral(stringLiteral, options) { + const double = { + quote: '"', + regex: /"/g + }; + const single = { + quote: "'", + regex: /'/g + }; + const preferred = options.singleQuote ? single : double; + const alternate = preferred === single ? double : single; + let shouldUseAlternateQuote = false; // If `stringLiteral` contains at least one of the quote preferred for + // enclosing the string, we might want to enclose with the alternate quote + // instead, to minimize the number of escaped quotes. + + if (stringLiteral.includes(preferred.quote) || stringLiteral.includes(alternate.quote)) { + const numPreferredQuotes = (stringLiteral.match(preferred.regex) || []).length; + const numAlternateQuotes = (stringLiteral.match(alternate.regex) || []).length; + shouldUseAlternateQuote = numPreferredQuotes > numAlternateQuotes; + } + + const enclosingQuote = shouldUseAlternateQuote ? alternate : preferred; + const escapedStringLiteral = stringLiteral.replace(enclosingQuote.regex, `\\${enclosingQuote.quote}`); + return concat$a([enclosingQuote.quote, escapedStringLiteral, enclosingQuote.quote]); +} + +function printPath(path, print) { + return path.call(print, "path"); +} + +function printParams(path, print) { + const node = path.getValue(); + let parts = []; + + if (node.params.length > 0) { + parts = parts.concat(path.map(print, "params")); + } + + if (node.hash && node.hash.pairs.length > 0) { + parts.push(path.call(print, "hash")); + } + + return parts; +} + +function printPathParams(path, print) { + const printedPath = printPath(path, print); + const printedParams = printParams(path, print); + const parts = [printedPath, ...printedParams]; + return indent$6(group$a(join$7(line$6, parts))); +} + +function printBlockParams(path) { + const block = path.getValue(); + + if (!block.program || !block.program.blockParams.length) { + return ""; + } + + return concat$a([" as |", block.program.blockParams.join(" "), "|"]); +} + +function printOpenBlock(path, print, { + open: isOpenStrip = false, + close: isCloseStrip = false +} = {}) { + return group$a(concat$a([isOpenStrip ? "{{~#" : "{{#", printPathParams(path, print), printBlockParams(path), softline$4, isCloseStrip ? "~}}" : "}}"])); +} + +function printCloseBlock(path, print, { + open: isOpenStrip = false, + close: isCloseStrip = false +} = {}) { + return concat$a([isOpenStrip ? "{{~/" : "{{/", path.call(print, "path"), isCloseStrip ? "~}}" : "}}"]); +} + +function countNewLines(string) { + /* istanbul ignore next */ + string = typeof string === "string" ? string : ""; + return string.split("\n").length - 1; +} + +function countLeadingNewLines(string) { + /* istanbul ignore next */ + string = typeof string === "string" ? string : ""; + const newLines = (string.match(/^([^\S\r\n]*[\r\n])+/g) || [])[0] || ""; + return countNewLines(newLines); +} + +function countTrailingNewLines(string) { + /* istanbul ignore next */ + string = typeof string === "string" ? string : ""; + const newLines = (string.match(/([\r\n][^\S\r\n]*)+$/g) || [])[0] || ""; + return countNewLines(newLines); +} + +function generateHardlines(number = 0, max = 0) { + return new Array(Math.min(number, max)).fill(hardline$8); +} +/* istanbul ignore next + https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/compiler/lib/location.ts#L5-L29 +*/ + + +function locationToOffset(source, line, column) { + let seenLines = 0; + let seenChars = 0; // eslint-disable-next-line no-constant-condition + + while (true) { + if (seenChars === source.length) { + return null; + } + + let nextLine = source.indexOf("\n", seenChars); + + if (nextLine === -1) { + nextLine = source.length; + } + + if (seenLines === line) { + if (seenChars + column > nextLine) { + return null; + } + + return seenChars + column; + } else if (nextLine === -1) { + return null; + } + + seenLines += 1; + seenChars = nextLine + 1; + } +} + +var printerGlimmer = { + print, + massageAstNode: clean$3 +}; + +var name$d = "Handlebars"; +var type$b = "markup"; +var group$b = "HTML"; +var aliases$3 = [ + "hbs", + "htmlbars" +]; +var extensions$b = [ + ".handlebars", + ".hbs" +]; +var tmScope$b = "text.html.handlebars"; +var aceMode$b = "handlebars"; +var languageId$b = 155; +var Handlebars = { + name: name$d, + type: type$b, + group: group$b, + aliases: aliases$3, + extensions: extensions$b, + tmScope: tmScope$b, + aceMode: aceMode$b, + languageId: languageId$b +}; + +var Handlebars$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$d, + type: type$b, + group: group$b, + aliases: aliases$3, + extensions: extensions$b, + tmScope: tmScope$b, + aceMode: aceMode$b, + languageId: languageId$b, + 'default': Handlebars +}); + +var require$$0$3 = getCjsExportFromNamespace(Handlebars$1); + +const languages$2 = [createLanguage(require$$0$3, () => ({ + since: null, + // unreleased + parsers: ["glimmer"], + vscodeLanguageIds: ["handlebars"] +}))]; +const printers$2 = { + glimmer: printerGlimmer +}; +var languageHandlebars = { + languages: languages$2, + printers: printers$2 +}; + +function hasPragma$2(text) { + return /^\s*#[^\n\S]*@(format|prettier)\s*(\n|$)/.test(text); +} + +function insertPragma$4(text) { + return "# @format\n\n" + text; +} + +var pragma$2 = { + hasPragma: hasPragma$2, + insertPragma: insertPragma$4 +}; + +const { + concat: concat$b, + join: join$8, + hardline: hardline$9, + line: line$7, + softline: softline$5, + group: group$c, + indent: indent$7, + ifBreak: ifBreak$4 +} = document.builders; +const { + hasIgnoreComment: hasIgnoreComment$4 +} = util$1; +const { + isNextLineEmpty: isNextLineEmpty$4 +} = utilShared; +const { + insertPragma: insertPragma$5 +} = pragma$2; + +function genericPrint$3(path, options, print) { + const n = path.getValue(); + + if (!n) { + return ""; + } + + if (typeof n === "string") { + return n; + } + + switch (n.kind) { + case "Document": + { + const parts = []; + path.map((pathChild, index) => { + parts.push(concat$b([pathChild.call(print)])); + + if (index !== n.definitions.length - 1) { + parts.push(hardline$9); + + if (isNextLineEmpty$4(options.originalText, pathChild.getValue(), options.locEnd)) { + parts.push(hardline$9); + } + } + }, "definitions"); + return concat$b([concat$b(parts), hardline$9]); + } + + case "OperationDefinition": + { + const hasOperation = options.originalText[options.locStart(n)] !== "{"; + const hasName = !!n.name; + return concat$b([hasOperation ? n.operation : "", hasOperation && hasName ? concat$b([" ", path.call(print, "name")]) : "", n.variableDefinitions && n.variableDefinitions.length ? group$c(concat$b(["(", indent$7(concat$b([softline$5, join$8(concat$b([ifBreak$4("", ", "), softline$5]), path.map(print, "variableDefinitions"))])), softline$5, ")"])) : "", printDirectives(path, print, n), n.selectionSet ? !hasOperation && !hasName ? "" : " " : "", path.call(print, "selectionSet")]); + } + + case "FragmentDefinition": + { + return concat$b(["fragment ", path.call(print, "name"), n.variableDefinitions && n.variableDefinitions.length ? group$c(concat$b(["(", indent$7(concat$b([softline$5, join$8(concat$b([ifBreak$4("", ", "), softline$5]), path.map(print, "variableDefinitions"))])), softline$5, ")"])) : "", " on ", path.call(print, "typeCondition"), printDirectives(path, print, n), " ", path.call(print, "selectionSet")]); + } + + case "SelectionSet": + { + return concat$b(["{", indent$7(concat$b([hardline$9, join$8(hardline$9, path.call(selectionsPath => printSequence(selectionsPath, options, print), "selections"))])), hardline$9, "}"]); + } + + case "Field": + { + return group$c(concat$b([n.alias ? concat$b([path.call(print, "alias"), ": "]) : "", path.call(print, "name"), n.arguments.length > 0 ? group$c(concat$b(["(", indent$7(concat$b([softline$5, join$8(concat$b([ifBreak$4("", ", "), softline$5]), path.call(argsPath => printSequence(argsPath, options, print), "arguments"))])), softline$5, ")"])) : "", printDirectives(path, print, n), n.selectionSet ? " " : "", path.call(print, "selectionSet")])); + } + + case "Name": + { + return n.value; + } + + case "StringValue": + { + if (n.block) { + return concat$b(['"""', hardline$9, join$8(hardline$9, n.value.replace(/"""/g, "\\$&").split("\n")), hardline$9, '"""']); + } + + return concat$b(['"', n.value.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\n"), '"']); + } + + case "IntValue": + case "FloatValue": + case "EnumValue": + { + return n.value; + } + + case "BooleanValue": + { + return n.value ? "true" : "false"; + } + + case "NullValue": + { + return "null"; + } + + case "Variable": + { + return concat$b(["$", path.call(print, "name")]); + } + + case "ListValue": + { + return group$c(concat$b(["[", indent$7(concat$b([softline$5, join$8(concat$b([ifBreak$4("", ", "), softline$5]), path.map(print, "values"))])), softline$5, "]"])); + } + + case "ObjectValue": + { + return group$c(concat$b(["{", options.bracketSpacing && n.fields.length > 0 ? " " : "", indent$7(concat$b([softline$5, join$8(concat$b([ifBreak$4("", ", "), softline$5]), path.map(print, "fields"))])), softline$5, ifBreak$4("", options.bracketSpacing && n.fields.length > 0 ? " " : ""), "}"])); + } + + case "ObjectField": + case "Argument": + { + return concat$b([path.call(print, "name"), ": ", path.call(print, "value")]); + } + + case "Directive": + { + return concat$b(["@", path.call(print, "name"), n.arguments.length > 0 ? group$c(concat$b(["(", indent$7(concat$b([softline$5, join$8(concat$b([ifBreak$4("", ", "), softline$5]), path.call(argsPath => printSequence(argsPath, options, print), "arguments"))])), softline$5, ")"])) : ""]); + } + + case "NamedType": + { + return path.call(print, "name"); + } + + case "VariableDefinition": + { + return concat$b([path.call(print, "variable"), ": ", path.call(print, "type"), n.defaultValue ? concat$b([" = ", path.call(print, "defaultValue")]) : "", printDirectives(path, print, n)]); + } + + case "TypeExtensionDefinition": + { + return concat$b(["extend ", path.call(print, "definition")]); + } + + case "ObjectTypeExtension": + case "ObjectTypeDefinition": + { + return concat$b([path.call(print, "description"), n.description ? hardline$9 : "", n.kind === "ObjectTypeExtension" ? "extend " : "", "type ", path.call(print, "name"), n.interfaces.length > 0 ? concat$b([" implements ", concat$b(printInterfaces(path, options, print))]) : "", printDirectives(path, print, n), n.fields.length > 0 ? concat$b([" {", indent$7(concat$b([hardline$9, join$8(hardline$9, path.call(fieldsPath => printSequence(fieldsPath, options, print), "fields"))])), hardline$9, "}"]) : ""]); + } + + case "FieldDefinition": + { + return concat$b([path.call(print, "description"), n.description ? hardline$9 : "", path.call(print, "name"), n.arguments.length > 0 ? group$c(concat$b(["(", indent$7(concat$b([softline$5, join$8(concat$b([ifBreak$4("", ", "), softline$5]), path.call(argsPath => printSequence(argsPath, options, print), "arguments"))])), softline$5, ")"])) : "", ": ", path.call(print, "type"), printDirectives(path, print, n)]); + } + + case "DirectiveDefinition": + { + return concat$b([path.call(print, "description"), n.description ? hardline$9 : "", "directive ", "@", path.call(print, "name"), n.arguments.length > 0 ? group$c(concat$b(["(", indent$7(concat$b([softline$5, join$8(concat$b([ifBreak$4("", ", "), softline$5]), path.call(argsPath => printSequence(argsPath, options, print), "arguments"))])), softline$5, ")"])) : "", n.repeatable ? " repeatable" : "", concat$b([" on ", join$8(" | ", path.map(print, "locations"))])]); + } + + case "EnumTypeExtension": + case "EnumTypeDefinition": + { + return concat$b([path.call(print, "description"), n.description ? hardline$9 : "", n.kind === "EnumTypeExtension" ? "extend " : "", "enum ", path.call(print, "name"), printDirectives(path, print, n), n.values.length > 0 ? concat$b([" {", indent$7(concat$b([hardline$9, join$8(hardline$9, path.call(valuesPath => printSequence(valuesPath, options, print), "values"))])), hardline$9, "}"]) : ""]); + } + + case "EnumValueDefinition": + { + return concat$b([path.call(print, "description"), n.description ? hardline$9 : "", path.call(print, "name"), printDirectives(path, print, n)]); + } + + case "InputValueDefinition": + { + return concat$b([path.call(print, "description"), n.description ? n.description.block ? hardline$9 : line$7 : "", path.call(print, "name"), ": ", path.call(print, "type"), n.defaultValue ? concat$b([" = ", path.call(print, "defaultValue")]) : "", printDirectives(path, print, n)]); + } + + case "InputObjectTypeExtension": + case "InputObjectTypeDefinition": + { + return concat$b([path.call(print, "description"), n.description ? hardline$9 : "", n.kind === "InputObjectTypeExtension" ? "extend " : "", "input ", path.call(print, "name"), printDirectives(path, print, n), n.fields.length > 0 ? concat$b([" {", indent$7(concat$b([hardline$9, join$8(hardline$9, path.call(fieldsPath => printSequence(fieldsPath, options, print), "fields"))])), hardline$9, "}"]) : ""]); + } + + case "SchemaDefinition": + { + return concat$b(["schema", printDirectives(path, print, n), " {", n.operationTypes.length > 0 ? indent$7(concat$b([hardline$9, join$8(hardline$9, path.call(opsPath => printSequence(opsPath, options, print), "operationTypes"))])) : "", hardline$9, "}"]); + } + + case "OperationTypeDefinition": + { + return concat$b([path.call(print, "operation"), ": ", path.call(print, "type")]); + } + + case "InterfaceTypeExtension": + case "InterfaceTypeDefinition": + { + return concat$b([path.call(print, "description"), n.description ? hardline$9 : "", n.kind === "InterfaceTypeExtension" ? "extend " : "", "interface ", path.call(print, "name"), printDirectives(path, print, n), n.fields.length > 0 ? concat$b([" {", indent$7(concat$b([hardline$9, join$8(hardline$9, path.call(fieldsPath => printSequence(fieldsPath, options, print), "fields"))])), hardline$9, "}"]) : ""]); + } + + case "FragmentSpread": + { + return concat$b(["...", path.call(print, "name"), printDirectives(path, print, n)]); + } + + case "InlineFragment": + { + return concat$b(["...", n.typeCondition ? concat$b([" on ", path.call(print, "typeCondition")]) : "", printDirectives(path, print, n), " ", path.call(print, "selectionSet")]); + } + + case "UnionTypeExtension": + case "UnionTypeDefinition": + { + return group$c(concat$b([path.call(print, "description"), n.description ? hardline$9 : "", group$c(concat$b([n.kind === "UnionTypeExtension" ? "extend " : "", "union ", path.call(print, "name"), printDirectives(path, print, n), n.types.length > 0 ? concat$b([" =", ifBreak$4("", " "), indent$7(concat$b([ifBreak$4(concat$b([line$7, " "])), join$8(concat$b([line$7, "| "]), path.map(print, "types"))]))]) : ""]))])); + } + + case "ScalarTypeExtension": + case "ScalarTypeDefinition": + { + return concat$b([path.call(print, "description"), n.description ? hardline$9 : "", n.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", path.call(print, "name"), printDirectives(path, print, n)]); + } + + case "NonNullType": + { + return concat$b([path.call(print, "type"), "!"]); + } + + case "ListType": + { + return concat$b(["[", path.call(print, "type"), "]"]); + } + + default: + /* istanbul ignore next */ + throw new Error("unknown graphql type: " + JSON.stringify(n.kind)); + } +} + +function printDirectives(path, print, n) { + if (n.directives.length === 0) { + return ""; + } + + return concat$b([" ", group$c(indent$7(concat$b([softline$5, join$8(concat$b([ifBreak$4("", " "), softline$5]), path.map(print, "directives"))])))]); +} + +function printSequence(sequencePath, options, print) { + const count = sequencePath.getValue().length; + return sequencePath.map((path, i) => { + const printed = print(path); + + if (isNextLineEmpty$4(options.originalText, path.getValue(), options.locEnd) && i < count - 1) { + return concat$b([printed, hardline$9]); + } + + return printed; + }); +} + +function canAttachComment$1(node) { + return node.kind && node.kind !== "Comment"; +} + +function printComment$2(commentPath) { + const comment = commentPath.getValue(); + + if (comment.kind === "Comment") { + return "#" + comment.value.trimEnd(); + } + + throw new Error("Not a comment: " + JSON.stringify(comment)); +} + +function determineInterfaceSeparatorBetween(first, second, options) { + const textBetween = options.originalText.slice(first.loc.end, second.loc.start).replace(/#.*/g, "").trim(); + return textBetween === "," ? ", " : " & "; +} + +function printInterfaces(path, options, print) { + const node = path.getNode(); + const parts = []; + const { + interfaces + } = node; + const printed = path.map(node => print(node), "interfaces"); + + for (let index = 0; index < interfaces.length; index++) { + const interfaceNode = interfaces[index]; + + if (index > 0) { + parts.push(determineInterfaceSeparatorBetween(interfaces[index - 1], interfaceNode, options)); + } + + parts.push(printed[index]); + } + + return parts; +} + +function clean$4(node, newNode +/*, parent*/ +) { + delete newNode.loc; + delete newNode.comments; +} + +var printerGraphql = { + print: genericPrint$3, + massageAstNode: clean$4, + hasPrettierIgnore: hasIgnoreComment$4, + insertPragma: insertPragma$5, + printComment: printComment$2, + canAttachComment: canAttachComment$1 +}; + +var options$4 = { + bracketSpacing: commonOptions.bracketSpacing +}; + +var name$e = "GraphQL"; +var type$c = "data"; +var extensions$c = [ + ".graphql", + ".gql", + ".graphqls" +]; +var tmScope$c = "source.graphql"; +var aceMode$c = "text"; +var languageId$c = 139; +var GraphQL = { + name: name$e, + type: type$c, + extensions: extensions$c, + tmScope: tmScope$c, + aceMode: aceMode$c, + languageId: languageId$c +}; + +var GraphQL$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$e, + type: type$c, + extensions: extensions$c, + tmScope: tmScope$c, + aceMode: aceMode$c, + languageId: languageId$c, + 'default': GraphQL +}); + +var require$$0$4 = getCjsExportFromNamespace(GraphQL$1); + +const languages$3 = [createLanguage(require$$0$4, () => ({ + since: "1.5.0", + parsers: ["graphql"], + vscodeLanguageIds: ["graphql"] +}))]; +const printers$3 = { + graphql: printerGraphql +}; +var languageGraphql = { + languages: languages$3, + options: options$4, + printers: printers$3 +}; + +var json = { + "cjkPattern": "[\\u02ea-\\u02eb\\u1100-\\u11ff\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u3000-\\u303f\\u3041-\\u3096\\u3099-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u3190-\\u3191\\u3196-\\u31ba\\u31c0-\\u31e3\\u31f0-\\u321e\\u322a-\\u3247\\u3260-\\u327e\\u328a-\\u32b0\\u32c0-\\u32cb\\u32d0-\\u3370\\u337b-\\u337f\\u33e0-\\u33fe\\u3400-\\u4db5\\u4e00-\\u9fef\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufe10-\\ufe1f\\ufe30-\\ufe6f\\uff00-\\uffef]|[\\ud840-\\ud868\\ud86a-\\ud86c\\ud86f-\\ud872\\ud874-\\ud879][\\udc00-\\udfff]|\\ud82c[\\udc00-\\udd1e\\udd50-\\udd52\\udd64-\\udd67]|\\ud83c[\\ude00\\ude50-\\ude51]|\\ud869[\\udc00-\\uded6\\udf00-\\udfff]|\\ud86d[\\udc00-\\udf34\\udf40-\\udfff]|\\ud86e[\\udc00-\\udc1d\\udc20-\\udfff]|\\ud873[\\udc00-\\udea1\\udeb0-\\udfff]|\\ud87a[\\udc00-\\udfe0]|\\ud87e[\\udc00-\\ude1d]", + "kPattern": "[\\u1100-\\u11ff\\u3001-\\u3003\\u3008-\\u3011\\u3013-\\u301f\\u302e-\\u3030\\u3037\\u30fb\\u3131-\\u318e\\u3200-\\u321e\\u3260-\\u327e\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\ufe45-\\ufe46\\uff61-\\uff65\\uffa0-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc]", + "punctuationPattern": "[\\u0021-\\u002f\\u003a-\\u0040\\u005b-\\u0060\\u007b-\\u007e\\u00a1\\u00a7\\u00ab\\u00b6-\\u00b7\\u00bb\\u00bf\\u037e\\u0387\\u055a-\\u055f\\u0589-\\u058a\\u05be\\u05c0\\u05c3\\u05c6\\u05f3-\\u05f4\\u0609-\\u060a\\u060c-\\u060d\\u061b\\u061e-\\u061f\\u066a-\\u066d\\u06d4\\u0700-\\u070d\\u07f7-\\u07f9\\u0830-\\u083e\\u085e\\u0964-\\u0965\\u0970\\u09fd\\u0a76\\u0af0\\u0c77\\u0c84\\u0df4\\u0e4f\\u0e5a-\\u0e5b\\u0f04-\\u0f12\\u0f14\\u0f3a-\\u0f3d\\u0f85\\u0fd0-\\u0fd4\\u0fd9-\\u0fda\\u104a-\\u104f\\u10fb\\u1360-\\u1368\\u1400\\u166e\\u169b-\\u169c\\u16eb-\\u16ed\\u1735-\\u1736\\u17d4-\\u17d6\\u17d8-\\u17da\\u1800-\\u180a\\u1944-\\u1945\\u1a1e-\\u1a1f\\u1aa0-\\u1aa6\\u1aa8-\\u1aad\\u1b5a-\\u1b60\\u1bfc-\\u1bff\\u1c3b-\\u1c3f\\u1c7e-\\u1c7f\\u1cc0-\\u1cc7\\u1cd3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205e\\u207d-\\u207e\\u208d-\\u208e\\u2308-\\u230b\\u2329-\\u232a\\u2768-\\u2775\\u27c5-\\u27c6\\u27e6-\\u27ef\\u2983-\\u2998\\u29d8-\\u29db\\u29fc-\\u29fd\\u2cf9-\\u2cfc\\u2cfe-\\u2cff\\u2d70\\u2e00-\\u2e2e\\u2e30-\\u2e4f\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301f\\u3030\\u303d\\u30a0\\u30fb\\ua4fe-\\ua4ff\\ua60d-\\ua60f\\ua673\\ua67e\\ua6f2-\\ua6f7\\ua874-\\ua877\\ua8ce-\\ua8cf\\ua8f8-\\ua8fa\\ua8fc\\ua92e-\\ua92f\\ua95f\\ua9c1-\\ua9cd\\ua9de-\\ua9df\\uaa5c-\\uaa5f\\uaade-\\uaadf\\uaaf0-\\uaaf1\\uabeb\\ufd3e-\\ufd3f\\ufe10-\\ufe19\\ufe30-\\ufe52\\ufe54-\\ufe61\\ufe63\\ufe68\\ufe6a-\\ufe6b\\uff01-\\uff03\\uff05-\\uff0a\\uff0c-\\uff0f\\uff1a-\\uff1b\\uff1f-\\uff20\\uff3b-\\uff3d\\uff3f\\uff5b\\uff5d\\uff5f-\\uff65]|\\ud800[\\udd00-\\udd02\\udf9f\\udfd0]|\\ud801[\\udd6f]|\\ud802[\\udc57\\udd1f\\udd3f\\ude50-\\ude58\\ude7f\\udef0-\\udef6\\udf39-\\udf3f\\udf99-\\udf9c]|\\ud803[\\udf55-\\udf59]|\\ud804[\\udc47-\\udc4d\\udcbb-\\udcbc\\udcbe-\\udcc1\\udd40-\\udd43\\udd74-\\udd75\\uddc5-\\uddc8\\uddcd\\udddb\\udddd-\\udddf\\ude38-\\ude3d\\udea9]|\\ud805[\\udc4b-\\udc4f\\udc5b\\udc5d\\udcc6\\uddc1-\\uddd7\\ude41-\\ude43\\ude60-\\ude6c\\udf3c-\\udf3e]|\\ud806[\\udc3b\\udde2\\ude3f-\\ude46\\ude9a-\\ude9c\\ude9e-\\udea2]|\\ud807[\\udc41-\\udc45\\udc70-\\udc71\\udef7-\\udef8\\udfff]|\\ud809[\\udc70-\\udc74]|\\ud81a[\\ude6e-\\ude6f\\udef5\\udf37-\\udf3b\\udf44]|\\ud81b[\\ude97-\\ude9a\\udfe2]|\\ud82f[\\udc9f]|\\ud836[\\ude87-\\ude8b]|\\ud83a[\\udd5e-\\udd5f]" +}; + +const { + cjkPattern, + kPattern, + punctuationPattern +} = json; +const { + getLast: getLast$4 +} = util$1; +const INLINE_NODE_TYPES = ["liquidNode", "inlineCode", "emphasis", "strong", "delete", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break", "inlineMath"]; +const INLINE_NODE_WRAPPER_TYPES = INLINE_NODE_TYPES.concat(["tableCell", "paragraph", "heading"]); +const kRegex = new RegExp(kPattern); +const punctuationRegex = new RegExp(punctuationPattern); +/** + * split text into whitespaces and words + * @param {string} text + * @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>} + */ + +function splitText(text, options) { + const KIND_NON_CJK = "non-cjk"; + const KIND_CJ_LETTER = "cj-letter"; + const KIND_K_LETTER = "k-letter"; + const KIND_CJK_PUNCTUATION = "cjk-punctuation"; + const nodes = []; + (options.proseWrap === "preserve" ? text : text.replace(new RegExp(`(${cjkPattern})\n(${cjkPattern})`, "g"), "$1$2")).split(/([ \t\n]+)/).forEach((token, index, tokens) => { + // whitespace + if (index % 2 === 1) { + nodes.push({ + type: "whitespace", + value: /\n/.test(token) ? "\n" : " " + }); + return; + } // word separated by whitespace + + + if ((index === 0 || index === tokens.length - 1) && token === "") { + return; + } + + token.split(new RegExp(`(${cjkPattern})`)).forEach((innerToken, innerIndex, innerTokens) => { + if ((innerIndex === 0 || innerIndex === innerTokens.length - 1) && innerToken === "") { + return; + } // non-CJK word + + + if (innerIndex % 2 === 0) { + if (innerToken !== "") { + appendNode({ + type: "word", + value: innerToken, + kind: KIND_NON_CJK, + hasLeadingPunctuation: punctuationRegex.test(innerToken[0]), + hasTrailingPunctuation: punctuationRegex.test(getLast$4(innerToken)) + }); + } + + return; + } // CJK character + + + appendNode(punctuationRegex.test(innerToken) ? { + type: "word", + value: innerToken, + kind: KIND_CJK_PUNCTUATION, + hasLeadingPunctuation: true, + hasTrailingPunctuation: true + } : { + type: "word", + value: innerToken, + kind: kRegex.test(innerToken) ? KIND_K_LETTER : KIND_CJ_LETTER, + hasLeadingPunctuation: false, + hasTrailingPunctuation: false + }); + }); + }); + return nodes; + + function appendNode(node) { + const lastNode = getLast$4(nodes); + + if (lastNode && lastNode.type === "word") { + if (lastNode.kind === KIND_NON_CJK && node.kind === KIND_CJ_LETTER && !lastNode.hasTrailingPunctuation || lastNode.kind === KIND_CJ_LETTER && node.kind === KIND_NON_CJK && !node.hasLeadingPunctuation) { + nodes.push({ + type: "whitespace", + value: " " + }); + } else if (!isBetween(KIND_NON_CJK, KIND_CJK_PUNCTUATION) && // disallow leading/trailing full-width whitespace + ![lastNode.value, node.value].some(value => /\u3000/.test(value))) { + nodes.push({ + type: "whitespace", + value: "" + }); + } + } + + nodes.push(node); + + function isBetween(kind1, kind2) { + return lastNode.kind === kind1 && node.kind === kind2 || lastNode.kind === kind2 && node.kind === kind1; + } + } +} + +function getOrderedListItemInfo(orderListItem, originalText) { + const [, numberText, marker, leadingSpaces] = originalText.slice(orderListItem.position.start.offset, orderListItem.position.end.offset).match(/^\s*(\d+)(\.|\))(\s*)/); + return { + numberText, + marker, + leadingSpaces + }; +} + +function hasGitDiffFriendlyOrderedList(node, options) { + if (!node.ordered) { + return false; + } + + if (node.children.length < 2) { + return false; + } + + const firstNumber = Number(getOrderedListItemInfo(node.children[0], options.originalText).numberText); + const secondNumber = Number(getOrderedListItemInfo(node.children[1], options.originalText).numberText); + + if (firstNumber === 0 && node.children.length > 2) { + const thirdNumber = Number(getOrderedListItemInfo(node.children[2], options.originalText).numberText); + return secondNumber === 1 && thirdNumber === 1; + } + + return secondNumber === 1; +} // workaround for https://github.com/remarkjs/remark/issues/351 +// leading and trailing newlines are stripped by remark + + +function getFencedCodeBlockValue(node, originalText) { + const text = originalText.slice(node.position.start.offset, node.position.end.offset); + const leadingSpaceCount = text.match(/^\s*/)[0].length; + const replaceRegex = new RegExp(`^\\s{0,${leadingSpaceCount}}`); + const lineContents = text.split("\n"); + const markerStyle = text[leadingSpaceCount]; // ` or ~ + + const marker = text.slice(leadingSpaceCount).match(new RegExp(`^[${markerStyle}]+`))[0]; // https://spec.commonmark.org/0.28/#example-104: Closing fences may be indented by 0-3 spaces + // https://spec.commonmark.org/0.28/#example-93: The closing code fence must be at least as long as the opening fence + + const hasEndMarker = new RegExp(`^\\s{0,3}${marker}`).test(lineContents[lineContents.length - 1].slice(getIndent(lineContents.length - 1))); + return lineContents.slice(1, hasEndMarker ? -1 : undefined).map((x, i) => x.slice(getIndent(i + 1)).replace(replaceRegex, "")).join("\n"); + + function getIndent(lineIndex) { + return node.position.indent[lineIndex - 1] - 1; + } +} + +function mapAst(ast, handler) { + return function preorder(node, index, parentStack) { + parentStack = parentStack || []; + const newNode = Object.assign({}, handler(node, index, parentStack)); + + if (newNode.children) { + newNode.children = newNode.children.map((child, index) => { + return preorder(child, index, [newNode].concat(parentStack)); + }); + } + + return newNode; + }(ast, null, null); +} + +var utils$9 = { + mapAst, + splitText, + punctuationPattern, + getFencedCodeBlockValue, + getOrderedListItemInfo, + hasGitDiffFriendlyOrderedList, + INLINE_NODE_TYPES, + INLINE_NODE_WRAPPER_TYPES +}; + +const { + builders: { + hardline: hardline$a, + literalline: literalline$4, + concat: concat$c, + markAsRoot: markAsRoot$2 + }, + utils: { + mapDoc: mapDoc$3 + } +} = document; +const { + getFencedCodeBlockValue: getFencedCodeBlockValue$1 +} = utils$9; + +function embed$2(path, print, textToDoc, options) { + const node = path.getValue(); + + if (node.type === "code" && node.lang !== null) { + // only look for the first string so as to support [markdown-preview-enhanced](https://shd101wyy.github.io/markdown-preview-enhanced/#/code-chunk) + const langMatch = node.lang.match(/^[A-Za-z0-9_-]+/); + const lang = langMatch ? langMatch[0] : ""; + const parser = getParserName(lang); + + if (parser) { + const styleUnit = options.__inJsTemplate ? "~" : "`"; + const style = styleUnit.repeat(Math.max(3, util$1.getMaxContinuousCount(node.value, styleUnit) + 1)); + const doc = textToDoc(getFencedCodeBlockValue$1(node, options.originalText), { + parser + }); + return markAsRoot$2(concat$c([style, node.lang, hardline$a, replaceNewlinesWithLiterallines(doc), style])); + } + } + + if (node.type === "yaml") { + return markAsRoot$2(concat$c(["---", hardline$a, node.value && node.value.trim() ? replaceNewlinesWithLiterallines(textToDoc(node.value, { + parser: "yaml" + })) : "", "---"])); + } // MDX + + + switch (node.type) { + case "importExport": + return textToDoc(node.value, { + parser: "babel" + }); + + case "jsx": + return textToDoc(`<$>${node.value}`, { + parser: "__js_expression", + rootMarker: "mdx" + }); + } + + return null; + + function getParserName(lang) { + const supportInfo = support.getSupportInfo({ + plugins: options.plugins + }); + const language = supportInfo.languages.find(language => language.name.toLowerCase() === lang || language.aliases && language.aliases.includes(lang) || language.extensions && language.extensions.find(ext => ext === `.${lang}`)); + + if (language) { + return language.parsers[0]; + } + + return null; + } + + function replaceNewlinesWithLiterallines(doc) { + return mapDoc$3(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$c(currentDoc.split(/(\n)/g).map((v, i) => i % 2 === 0 ? v : literalline$4)) : currentDoc); + } +} + +var embed_1$2 = embed$2; + +const pragmas = ["format", "prettier"]; + +function startWithPragma(text) { + const pragma = `@(${pragmas.join("|")})`; + const regex = new RegExp([``, ``].join("|"), "m"); + const matched = text.match(regex); + return matched && matched.index === 0; +} + +var pragma$3 = { + startWithPragma, + hasPragma: text => startWithPragma(frontMatter(text).content.trimStart()), + insertPragma: text => { + const extracted = frontMatter(text); + const pragma = ``; + return extracted.frontMatter ? `${extracted.frontMatter.raw}\n\n${pragma}\n\n${extracted.content}` : `${pragma}\n\n${extracted.content}`; + } +}; + +const { + getOrderedListItemInfo: getOrderedListItemInfo$1, + mapAst: mapAst$1, + splitText: splitText$1 +} = utils$9; // 0x0 ~ 0x10ffff +// eslint-disable-next-line no-control-regex + +const isSingleCharRegex = /^([\u0000-\uffff]|[\ud800-\udbff][\udc00-\udfff])$/; + +function preprocess$1(ast, options) { + ast = restoreUnescapedCharacter(ast, options); + ast = mergeContinuousTexts(ast); + ast = transformInlineCode(ast); + ast = transformIndentedCodeblockAndMarkItsParentList(ast, options); + ast = markAlignedList(ast, options); + ast = splitTextIntoSentences(ast, options); + ast = transformImportExport(ast); + ast = mergeContinuousImportExport(ast); + return ast; +} + +function transformImportExport(ast) { + return mapAst$1(ast, node => { + if (node.type !== "import" && node.type !== "export") { + return node; + } + + return Object.assign({}, node, { + type: "importExport" + }); + }); +} + +function transformInlineCode(ast) { + return mapAst$1(ast, node => { + if (node.type !== "inlineCode") { + return node; + } + + return Object.assign({}, node, { + value: node.value.replace(/\s+/g, " ") + }); + }); +} + +function restoreUnescapedCharacter(ast, options) { + return mapAst$1(ast, node => { + return node.type !== "text" ? node : Object.assign({}, node, { + value: node.value !== "*" && node.value !== "_" && node.value !== "$" && // handle these cases in printer + isSingleCharRegex.test(node.value) && node.position.end.offset - node.position.start.offset !== node.value.length ? options.originalText.slice(node.position.start.offset, node.position.end.offset) : node.value + }); + }); +} + +function mergeContinuousImportExport(ast) { + return mergeChildren(ast, (prevNode, node) => prevNode.type === "importExport" && node.type === "importExport", (prevNode, node) => ({ + type: "importExport", + value: prevNode.value + "\n\n" + node.value, + position: { + start: prevNode.position.start, + end: node.position.end + } + })); +} + +function mergeChildren(ast, shouldMerge, mergeNode) { + return mapAst$1(ast, node => { + if (!node.children) { + return node; + } + + const children = node.children.reduce((current, child) => { + const lastChild = current[current.length - 1]; + + if (lastChild && shouldMerge(lastChild, child)) { + current.splice(-1, 1, mergeNode(lastChild, child)); + } else { + current.push(child); + } + + return current; + }, []); + return Object.assign({}, node, { + children + }); + }); +} + +function mergeContinuousTexts(ast) { + return mergeChildren(ast, (prevNode, node) => prevNode.type === "text" && node.type === "text", (prevNode, node) => ({ + type: "text", + value: prevNode.value + node.value, + position: { + start: prevNode.position.start, + end: node.position.end + } + })); +} + +function splitTextIntoSentences(ast, options) { + return mapAst$1(ast, (node, index, [parentNode]) => { + if (node.type !== "text") { + return node; + } + + let { + value + } = node; + + if (parentNode.type === "paragraph") { + if (index === 0) { + value = value.trimStart(); + } + + if (index === parentNode.children.length - 1) { + value = value.trimEnd(); + } + } + + return { + type: "sentence", + position: node.position, + children: splitText$1(value, options) + }; + }); +} + +function transformIndentedCodeblockAndMarkItsParentList(ast, options) { + return mapAst$1(ast, (node, index, parentStack) => { + if (node.type === "code") { + // the first char may point to `\n`, e.g. `\n\t\tbar`, just ignore it + const isIndented = /^\n?( {4,}|\t)/.test(options.originalText.slice(node.position.start.offset, node.position.end.offset)); + node.isIndented = isIndented; + + if (isIndented) { + for (let i = 0; i < parentStack.length; i++) { + const parent = parentStack[i]; // no need to check checked items + + if (parent.hasIndentedCodeblock) { + break; + } + + if (parent.type === "list") { + parent.hasIndentedCodeblock = true; + } + } + } + } + + return node; + }); +} + +function markAlignedList(ast, options) { + return mapAst$1(ast, (node, index, parentStack) => { + if (node.type === "list" && node.children.length !== 0) { + // if one of its parents is not aligned, it's not possible to be aligned in sub-lists + for (let i = 0; i < parentStack.length; i++) { + const parent = parentStack[i]; + + if (parent.type === "list" && !parent.isAligned) { + node.isAligned = false; + return node; + } + } + + node.isAligned = isAligned(node); + } + + return node; + }); + + function getListItemStart(listItem) { + return listItem.children.length === 0 ? -1 : listItem.children[0].position.start.column - 1; + } + + function isAligned(list) { + if (!list.ordered) { + /** + * - 123 + * - 123 + */ + return true; + } + + const [firstItem, secondItem] = list.children; + const firstInfo = getOrderedListItemInfo$1(firstItem, options.originalText); + + if (firstInfo.leadingSpaces.length > 1) { + /** + * 1. 123 + * + * 1. 123 + * 1. 123 + */ + return true; + } + + const firstStart = getListItemStart(firstItem); + + if (firstStart === -1) { + /** + * 1. + * + * 1. + * 1. + */ + return false; + } + + if (list.children.length === 1) { + /** + * aligned: + * + * 11. 123 + * + * not aligned: + * + * 1. 123 + */ + return firstStart % options.tabWidth === 0; + } + + const secondStart = getListItemStart(secondItem); + + if (firstStart !== secondStart) { + /** + * 11. 123 + * 1. 123 + * + * 1. 123 + * 11. 123 + */ + return false; + } + + if (firstStart % options.tabWidth === 0) { + /** + * 11. 123 + * 12. 123 + */ + return true; + } + /** + * aligned: + * + * 11. 123 + * 1. 123 + * + * not aligned: + * + * 1. 123 + * 2. 123 + */ + + + const secondInfo = getOrderedListItemInfo$1(secondItem, options.originalText); + return secondInfo.leadingSpaces.length > 1; + } +} + +var preprocess_1$1 = preprocess$1; + +const { + builders: { + breakParent: breakParent$3, + concat: concat$d, + join: join$9, + line: line$8, + literalline: literalline$5, + markAsRoot: markAsRoot$3, + hardline: hardline$b, + softline: softline$6, + ifBreak: ifBreak$5, + fill: fill$5, + align: align$2, + indent: indent$8, + group: group$d + }, + utils: { + mapDoc: mapDoc$4 + }, + printer: { + printDocToString: printDocToString$3 + } +} = document; +const { + getFencedCodeBlockValue: getFencedCodeBlockValue$2, + hasGitDiffFriendlyOrderedList: hasGitDiffFriendlyOrderedList$1, + splitText: splitText$2, + punctuationPattern: punctuationPattern$1, + INLINE_NODE_TYPES: INLINE_NODE_TYPES$1, + INLINE_NODE_WRAPPER_TYPES: INLINE_NODE_WRAPPER_TYPES$1 +} = utils$9; +const { + replaceEndOfLineWith: replaceEndOfLineWith$1 +} = util$1; +const TRAILING_HARDLINE_NODES = ["importExport"]; +const SINGLE_LINE_NODE_TYPES = ["heading", "tableCell", "link"]; +const SIBLING_NODE_TYPES = ["listItem", "definition", "footnoteDefinition"]; + +function genericPrint$4(path, options, print) { + const node = path.getValue(); + + if (shouldRemainTheSameContent(path)) { + return concat$d(splitText$2(options.originalText.slice(node.position.start.offset, node.position.end.offset), options).map(node => node.type === "word" ? node.value : node.value === "" ? "" : printLine(path, node.value, options))); + } + + switch (node.type) { + case "root": + if (node.children.length === 0) { + return ""; + } + + return concat$d([normalizeDoc(printRoot(path, options, print)), !TRAILING_HARDLINE_NODES.includes(getLastDescendantNode(node).type) ? hardline$b : ""]); + + case "paragraph": + return printChildren$1(path, options, print, { + postprocessor: fill$5 + }); + + case "sentence": + return printChildren$1(path, options, print); + + case "word": + return node.value.replace(/[*$]/g, "\\$&") // escape all `*` and `$` (math) + .replace(new RegExp([`(^|${punctuationPattern$1})(_+)`, `(_+)(${punctuationPattern$1}|$)`].join("|"), "g"), (_, text1, underscore1, underscore2, text2) => (underscore1 ? `${text1}${underscore1}` : `${underscore2}${text2}`).replace(/_/g, "\\_")); + // escape all `_` except concating with non-punctuation, e.g. `1_2_3` is not considered emphasis + + case "whitespace": + { + const parentNode = path.getParentNode(); + const index = parentNode.children.indexOf(node); + const nextNode = parentNode.children[index + 1]; + const proseWrap = // leading char that may cause different syntax + nextNode && /^>|^([-+*]|#{1,6}|[0-9]+[.)])$/.test(nextNode.value) ? "never" : options.proseWrap; + return printLine(path, node.value, { + proseWrap + }); + } + + case "emphasis": + { + const parentNode = path.getParentNode(); + const index = parentNode.children.indexOf(node); + const prevNode = parentNode.children[index - 1]; + const nextNode = parentNode.children[index + 1]; + const hasPrevOrNextWord = // `1*2*3` is considered emphasis but `1_2_3` is not + prevNode && prevNode.type === "sentence" && prevNode.children.length > 0 && util$1.getLast(prevNode.children).type === "word" && !util$1.getLast(prevNode.children).hasTrailingPunctuation || nextNode && nextNode.type === "sentence" && nextNode.children.length > 0 && nextNode.children[0].type === "word" && !nextNode.children[0].hasLeadingPunctuation; + const style = hasPrevOrNextWord || getAncestorNode$2(path, "emphasis") ? "*" : "_"; + return concat$d([style, printChildren$1(path, options, print), style]); + } + + case "strong": + return concat$d(["**", printChildren$1(path, options, print), "**"]); + + case "delete": + return concat$d(["~~", printChildren$1(path, options, print), "~~"]); + + case "inlineCode": + { + const backtickCount = util$1.getMinNotPresentContinuousCount(node.value, "`"); + const style = "`".repeat(backtickCount || 1); + const gap = backtickCount ? " " : ""; + return concat$d([style, gap, node.value, gap, style]); + } + + case "link": + switch (options.originalText[node.position.start.offset]) { + case "<": + { + const mailto = "mailto:"; + const url = // is parsed as { url: "mailto:hello@example.com" } + node.url.startsWith(mailto) && options.originalText.slice(node.position.start.offset + 1, node.position.start.offset + 1 + mailto.length) !== mailto ? node.url.slice(mailto.length) : node.url; + return concat$d(["<", url, ">"]); + } + + case "[": + return concat$d(["[", printChildren$1(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]); + + default: + return options.originalText.slice(node.position.start.offset, node.position.end.offset); + } + + case "image": + return concat$d(["![", node.alt || "", "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]); + + case "blockquote": + return concat$d(["> ", align$2("> ", printChildren$1(path, options, print))]); + + case "heading": + return concat$d(["#".repeat(node.depth) + " ", printChildren$1(path, options, print)]); + + case "code": + { + if (node.isIndented) { + // indented code block + const alignment = " ".repeat(4); + return align$2(alignment, concat$d([alignment, concat$d(replaceEndOfLineWith$1(node.value, hardline$b))])); + } // fenced code block + + + const styleUnit = options.__inJsTemplate ? "~" : "`"; + const style = styleUnit.repeat(Math.max(3, util$1.getMaxContinuousCount(node.value, styleUnit) + 1)); + return concat$d([style, node.lang || "", hardline$b, concat$d(replaceEndOfLineWith$1(getFencedCodeBlockValue$2(node, options.originalText), hardline$b)), hardline$b, style]); + } + + case "yaml": + case "toml": + return options.originalText.slice(node.position.start.offset, node.position.end.offset); + + case "html": + { + const parentNode = path.getParentNode(); + const value = parentNode.type === "root" && util$1.getLast(parentNode.children) === node ? node.value.trimEnd() : node.value; + const isHtmlComment = /^$/.test(value); + return concat$d(replaceEndOfLineWith$1(value, isHtmlComment ? hardline$b : markAsRoot$3(literalline$5))); + } + + case "list": + { + const nthSiblingIndex = getNthListSiblingIndex(node, path.getParentNode()); + const isGitDiffFriendlyOrderedList = hasGitDiffFriendlyOrderedList$1(node, options); + return printChildren$1(path, options, print, { + processor: (childPath, index) => { + const prefix = getPrefix(); + const childNode = childPath.getValue(); + + if (childNode.children.length === 2 && childNode.children[1].type === "html" && childNode.children[0].position.start.column !== childNode.children[1].position.start.column) { + return concat$d([prefix, printListItem(childPath, options, print, prefix)]); + } + + return concat$d([prefix, align$2(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))]); + + function getPrefix() { + const rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* "; + return node.isAligned || + /* workaround for https://github.com/remarkjs/remark/issues/315 */ + node.hasIndentedCodeblock ? alignListPrefix(rawPrefix, options) : rawPrefix; + } + } + }); + } + + case "thematicBreak": + { + const counter = getAncestorCounter$1(path, "list"); + + if (counter === -1) { + return "---"; + } + + const nthSiblingIndex = getNthListSiblingIndex(path.getParentNode(counter), path.getParentNode(counter + 1)); + return nthSiblingIndex % 2 === 0 ? "***" : "---"; + } + + case "linkReference": + return concat$d(["[", printChildren$1(path, options, print), "]", node.referenceType === "full" ? concat$d(["[", node.identifier, "]"]) : node.referenceType === "collapsed" ? "[]" : ""]); + + case "imageReference": + switch (node.referenceType) { + case "full": + return concat$d(["![", node.alt || "", "][", node.identifier, "]"]); + + default: + return concat$d(["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""]); + } + + case "definition": + { + const lineOrSpace = options.proseWrap === "always" ? line$8 : " "; + return group$d(concat$d([concat$d(["[", node.identifier, "]:"]), indent$8(concat$d([lineOrSpace, printUrl(node.url), node.title === null ? "" : concat$d([lineOrSpace, printTitle(node.title, options, false)])]))])); + } + + case "footnote": + return concat$d(["[^", printChildren$1(path, options, print), "]"]); + + case "footnoteReference": + return concat$d(["[^", node.identifier, "]"]); + + case "footnoteDefinition": + { + const nextNode = path.getParentNode().children[path.getName() + 1]; + const shouldInlineFootnote = node.children.length === 1 && node.children[0].type === "paragraph" && (options.proseWrap === "never" || options.proseWrap === "preserve" && node.children[0].position.start.line === node.children[0].position.end.line); + return concat$d(["[^", node.identifier, "]: ", shouldInlineFootnote ? printChildren$1(path, options, print) : group$d(concat$d([align$2(" ".repeat(options.tabWidth), printChildren$1(path, options, print, { + processor: (childPath, index) => { + return index === 0 ? group$d(concat$d([softline$6, childPath.call(print)])) : childPath.call(print); + } + })), nextNode && nextNode.type === "footnoteDefinition" ? softline$6 : ""]))]); + } + + case "table": + return printTable(path, options, print); + + case "tableCell": + return printChildren$1(path, options, print); + + case "break": + return /\s/.test(options.originalText[node.position.start.offset]) ? concat$d([" ", markAsRoot$3(literalline$5)]) : concat$d(["\\", hardline$b]); + + case "liquidNode": + return concat$d(replaceEndOfLineWith$1(node.value, hardline$b)); + // MDX + + case "importExport": + case "jsx": + return node.value; + // fallback to the original text if multiparser failed + + case "math": + return concat$d(["$$", hardline$b, node.value ? concat$d([concat$d(replaceEndOfLineWith$1(node.value, hardline$b)), hardline$b]) : "", "$$"]); + + case "inlineMath": + { + // remark-math trims content but we don't want to remove whitespaces + // since it's very possible that it's recognized as math accidentally + return options.originalText.slice(options.locStart(node), options.locEnd(node)); + } + + case "tableRow": // handled in "table" + + case "listItem": // handled in "list" + + default: + throw new Error(`Unknown markdown type ${JSON.stringify(node.type)}`); + } +} + +function printListItem(path, options, print, listPrefix) { + const node = path.getValue(); + const prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] "; + return concat$d([prefix, printChildren$1(path, options, print, { + processor: (childPath, index) => { + if (index === 0 && childPath.getValue().type !== "list") { + return align$2(" ".repeat(prefix.length), childPath.call(print)); + } + + const alignment = " ".repeat(clamp(options.tabWidth - listPrefix.length, 0, 3) // 4+ will cause indented code block + ); + return concat$d([alignment, align$2(alignment, childPath.call(print))]); + } + })]); +} + +function alignListPrefix(prefix, options) { + const additionalSpaces = getAdditionalSpaces(); + return prefix + " ".repeat(additionalSpaces >= 4 ? 0 : additionalSpaces // 4+ will cause indented code block + ); + + function getAdditionalSpaces() { + const restSpaces = prefix.length % options.tabWidth; + return restSpaces === 0 ? 0 : options.tabWidth - restSpaces; + } +} + +function getNthListSiblingIndex(node, parentNode) { + return getNthSiblingIndex(node, parentNode, siblingNode => siblingNode.ordered === node.ordered); +} + +function getNthSiblingIndex(node, parentNode, condition) { + condition = condition || (() => true); + + let index = -1; + + for (const childNode of parentNode.children) { + if (childNode.type === node.type && condition(childNode)) { + index++; + } else { + index = -1; + } + + if (childNode === node) { + return index; + } + } +} + +function getAncestorCounter$1(path, typeOrTypes) { + const types = [].concat(typeOrTypes); + let counter = -1; + let ancestorNode; + + while (ancestorNode = path.getParentNode(++counter)) { + if (types.includes(ancestorNode.type)) { + return counter; + } + } + + return -1; +} + +function getAncestorNode$2(path, typeOrTypes) { + const counter = getAncestorCounter$1(path, typeOrTypes); + return counter === -1 ? null : path.getParentNode(counter); +} + +function printLine(path, value, options) { + if (options.proseWrap === "preserve" && value === "\n") { + return hardline$b; + } + + const isBreakable = options.proseWrap === "always" && !getAncestorNode$2(path, SINGLE_LINE_NODE_TYPES); + return value !== "" ? isBreakable ? line$8 : " " : isBreakable ? softline$6 : ""; +} + +function printTable(path, options, print) { + const hardlineWithoutBreakParent = hardline$b.parts[0]; + const node = path.getValue(); + const contents = []; // { [rowIndex: number]: { [columnIndex: number]: string } } + + path.map(rowPath => { + const rowContents = []; + rowPath.map(cellPath => { + rowContents.push(printDocToString$3(cellPath.call(print), options).formatted); + }, "children"); + contents.push(rowContents); + }, "children"); // Get the width of each column + + const columnMaxWidths = contents.reduce((currentWidths, rowContents) => currentWidths.map((width, columnIndex) => Math.max(width, util$1.getStringWidth(rowContents[columnIndex]))), contents[0].map(() => 3) // minimum width = 3 (---, :--, :-:, --:) + ); + const alignedTable = join$9(hardlineWithoutBreakParent, [printRow(contents[0]), printSeparator(), join$9(hardlineWithoutBreakParent, contents.slice(1).map(rowContents => printRow(rowContents)))]); + + if (options.proseWrap !== "never") { + return concat$d([breakParent$3, alignedTable]); + } // Only if the --prose-wrap never is set and it exceeds the print width. + + + const compactTable = join$9(hardlineWithoutBreakParent, [printRow(contents[0], + /* isCompact */ + true), printSeparator( + /* isCompact */ + true), join$9(hardlineWithoutBreakParent, contents.slice(1).map(rowContents => printRow(rowContents, + /* isCompact */ + true)))]); + return concat$d([breakParent$3, group$d(ifBreak$5(compactTable, alignedTable))]); + + function printSeparator(isCompact) { + return concat$d(["| ", join$9(" | ", columnMaxWidths.map((width, index) => { + const spaces = isCompact ? 3 : width; + + switch (node.align[index]) { + case "left": + return ":" + "-".repeat(spaces - 1); + + case "right": + return "-".repeat(spaces - 1) + ":"; + + case "center": + return ":" + "-".repeat(spaces - 2) + ":"; + + default: + return "-".repeat(spaces); + } + })), " |"]); + } + + function printRow(rowContents, isCompact) { + return concat$d(["| ", join$9(" | ", isCompact ? rowContents : rowContents.map((rowContent, columnIndex) => { + switch (node.align[columnIndex]) { + case "right": + return alignRight(rowContent, columnMaxWidths[columnIndex]); + + case "center": + return alignCenter(rowContent, columnMaxWidths[columnIndex]); + + default: + return alignLeft(rowContent, columnMaxWidths[columnIndex]); + } + })), " |"]); + } + + function alignLeft(text, width) { + const spaces = width - util$1.getStringWidth(text); + return concat$d([text, " ".repeat(spaces)]); + } + + function alignRight(text, width) { + const spaces = width - util$1.getStringWidth(text); + return concat$d([" ".repeat(spaces), text]); + } + + function alignCenter(text, width) { + const spaces = width - util$1.getStringWidth(text); + const left = Math.floor(spaces / 2); + const right = spaces - left; + return concat$d([" ".repeat(left), text, " ".repeat(right)]); + } +} + +function printRoot(path, options, print) { + /** @typedef {{ index: number, offset: number }} IgnorePosition */ + + /** @type {Array<{start: IgnorePosition, end: IgnorePosition}>} */ + const ignoreRanges = []; + /** @type {IgnorePosition | null} */ + + let ignoreStart = null; + const { + children + } = path.getValue(); + children.forEach((childNode, index) => { + switch (isPrettierIgnore(childNode)) { + case "start": + if (ignoreStart === null) { + ignoreStart = { + index, + offset: childNode.position.end.offset + }; + } + + break; + + case "end": + if (ignoreStart !== null) { + ignoreRanges.push({ + start: ignoreStart, + end: { + index, + offset: childNode.position.start.offset + } + }); + ignoreStart = null; + } + + break; + } + }); + return printChildren$1(path, options, print, { + processor: (childPath, index) => { + if (ignoreRanges.length !== 0) { + const ignoreRange = ignoreRanges[0]; + + if (index === ignoreRange.start.index) { + return concat$d([children[ignoreRange.start.index].value, options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), children[ignoreRange.end.index].value]); + } + + if (ignoreRange.start.index < index && index < ignoreRange.end.index) { + return false; + } + + if (index === ignoreRange.end.index) { + ignoreRanges.shift(); + return false; + } + } + + return childPath.call(print); + } + }); +} + +function printChildren$1(path, options, print, events) { + events = events || {}; + const postprocessor = events.postprocessor || concat$d; + + const processor = events.processor || (childPath => childPath.call(print)); + + const node = path.getValue(); + const parts = []; + let lastChildNode; + path.map((childPath, index) => { + const childNode = childPath.getValue(); + const result = processor(childPath, index); + + if (result !== false) { + const data = { + parts, + prevNode: lastChildNode, + parentNode: node, + options + }; + + if (!shouldNotPrePrintHardline(childNode, data)) { + parts.push(hardline$b); + + if (lastChildNode && TRAILING_HARDLINE_NODES.includes(lastChildNode.type)) { + if (shouldPrePrintTripleHardline(childNode, data)) { + parts.push(hardline$b); + } + } else { + if (shouldPrePrintDoubleHardline(childNode, data) || shouldPrePrintTripleHardline(childNode, data)) { + parts.push(hardline$b); + } + + if (shouldPrePrintTripleHardline(childNode, data)) { + parts.push(hardline$b); + } + } + } + + parts.push(result); + lastChildNode = childNode; + } + }, "children"); + return postprocessor(parts); +} + +function getLastDescendantNode(node) { + let current = node; + + while (current.children && current.children.length !== 0) { + current = current.children[current.children.length - 1]; + } + + return current; +} +/** @return {false | 'next' | 'start' | 'end'} */ + + +function isPrettierIgnore(node) { + if (node.type !== "html") { + return false; + } + + const match = node.value.match(/^$/); + return match === null ? false : match[1] ? match[1] : "next"; +} + +function shouldNotPrePrintHardline(node, data) { + const isFirstNode = data.parts.length === 0; + const isInlineNode = INLINE_NODE_TYPES$1.includes(node.type); + const isInlineHTML = node.type === "html" && INLINE_NODE_WRAPPER_TYPES$1.includes(data.parentNode.type); + return isFirstNode || isInlineNode || isInlineHTML; +} + +function shouldPrePrintDoubleHardline(node, data) { + const isSequence = (data.prevNode && data.prevNode.type) === node.type; + const isSiblingNode = isSequence && SIBLING_NODE_TYPES.includes(node.type); + const isInTightListItem = data.parentNode.type === "listItem" && !data.parentNode.loose; + const isPrevNodeLooseListItem = data.prevNode && data.prevNode.type === "listItem" && data.prevNode.loose; + const isPrevNodePrettierIgnore = isPrettierIgnore(data.prevNode) === "next"; + const isBlockHtmlWithoutBlankLineBetweenPrevHtml = node.type === "html" && data.prevNode && data.prevNode.type === "html" && data.prevNode.position.end.line + 1 === node.position.start.line; + const isHtmlDirectAfterListItem = node.type === "html" && data.parentNode.type === "listItem" && data.prevNode && data.prevNode.type === "paragraph" && data.prevNode.position.end.line + 1 === node.position.start.line; + return isPrevNodeLooseListItem || !(isSiblingNode || isInTightListItem || isPrevNodePrettierIgnore || isBlockHtmlWithoutBlankLineBetweenPrevHtml || isHtmlDirectAfterListItem); +} + +function shouldPrePrintTripleHardline(node, data) { + const isPrevNodeList = data.prevNode && data.prevNode.type === "list"; + const isIndentedCode = node.type === "code" && node.isIndented; + return isPrevNodeList && isIndentedCode; +} + +function shouldRemainTheSameContent(path) { + const ancestorNode = getAncestorNode$2(path, ["linkReference", "imageReference"]); + return ancestorNode && (ancestorNode.type !== "linkReference" || ancestorNode.referenceType !== "full"); +} + +function normalizeDoc(doc) { + return mapDoc$4(doc, currentDoc => { + if (!currentDoc.parts) { + return currentDoc; + } + + if (currentDoc.type === "concat" && currentDoc.parts.length === 1) { + return currentDoc.parts[0]; + } + + const parts = currentDoc.parts.reduce((parts, part) => { + if (part.type === "concat") { + parts.push(...part.parts); + } else if (part !== "") { + parts.push(part); + } + + return parts; + }, []); + return Object.assign({}, currentDoc, { + parts: normalizeParts(parts) + }); + }); +} + +function printUrl(url, dangerousCharOrChars) { + const dangerousChars = [" "].concat(dangerousCharOrChars || []); + return new RegExp(dangerousChars.map(x => `\\${x}`).join("|")).test(url) ? `<${url}>` : url; +} + +function printTitle(title, options, printSpace) { + if (printSpace == null) { + printSpace = true; + } + + if (!title) { + return ""; + } + + if (printSpace) { + return " " + printTitle(title, options, false); + } + + if (title.includes('"') && title.includes("'") && !title.includes(")")) { + return `(${title})`; // avoid escaped quotes + } // faster than using RegExps: https://jsperf.com/performance-of-match-vs-split + + + const singleCount = title.split("'").length - 1; + const doubleCount = title.split('"').length - 1; + const quote = singleCount > doubleCount ? '"' : doubleCount > singleCount ? "'" : options.singleQuote ? "'" : '"'; + title = title.replace(new RegExp(`(${quote})`, "g"), "\\$1"); + return `${quote}${title}${quote}`; +} + +function normalizeParts(parts) { + return parts.reduce((current, part) => { + const lastPart = util$1.getLast(current); + + if (typeof lastPart === "string" && typeof part === "string") { + current.splice(-1, 1, lastPart + part); + } else { + current.push(part); + } + + return current; + }, []); +} + +function clamp(value, min, max) { + return value < min ? min : value > max ? max : value; +} + +function clean$5(ast, newObj, parent) { + delete newObj.position; + delete newObj.raw; // front-matter + // for codeblock + + if (ast.type === "code" || ast.type === "yaml" || ast.type === "import" || ast.type === "export" || ast.type === "jsx") { + delete newObj.value; + } + + if (ast.type === "list") { + delete newObj.isAligned; + } // texts can be splitted or merged + + + if (ast.type === "text") { + return null; + } + + if (ast.type === "inlineCode") { + newObj.value = ast.value.replace(/[ \t\n]+/g, " "); + } // for insert pragma + + + if (parent && parent.type === "root" && parent.children.length > 0 && (parent.children[0] === ast || (parent.children[0].type === "yaml" || parent.children[0].type === "toml") && parent.children[1] === ast) && ast.type === "html" && pragma$3.startWithPragma(ast.value)) { + return null; + } +} + +function hasPrettierIgnore$4(path) { + const index = +path.getName(); + + if (index === 0) { + return false; + } + + const prevNode = path.getParentNode().children[index - 1]; + return isPrettierIgnore(prevNode) === "next"; +} + +var printerMarkdown = { + preprocess: preprocess_1$1, + print: genericPrint$4, + embed: embed_1$2, + massageAstNode: clean$5, + hasPrettierIgnore: hasPrettierIgnore$4, + insertPragma: pragma$3.insertPragma +}; + +var options$5 = { + proseWrap: commonOptions.proseWrap, + singleQuote: commonOptions.singleQuote +}; + +var name$f = "Markdown"; +var type$d = "prose"; +var aliases$4 = [ + "pandoc" +]; +var aceMode$d = "markdown"; +var codemirrorMode$a = "gfm"; +var codemirrorMimeType$a = "text/x-gfm"; +var wrap = true; +var extensions$d = [ + ".md", + ".markdown", + ".mdown", + ".mdwn", + ".mdx", + ".mkd", + ".mkdn", + ".mkdown", + ".ronn", + ".workbook" +]; +var filenames$3 = [ + "contents.lr" +]; +var tmScope$d = "source.gfm"; +var languageId$d = 222; +var Markdown = { + name: name$f, + type: type$d, + aliases: aliases$4, + aceMode: aceMode$d, + codemirrorMode: codemirrorMode$a, + codemirrorMimeType: codemirrorMimeType$a, + wrap: wrap, + extensions: extensions$d, + filenames: filenames$3, + tmScope: tmScope$d, + languageId: languageId$d +}; + +var Markdown$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + name: name$f, + type: type$d, + aliases: aliases$4, + aceMode: aceMode$d, + codemirrorMode: codemirrorMode$a, + codemirrorMimeType: codemirrorMimeType$a, + wrap: wrap, + extensions: extensions$d, + filenames: filenames$3, + tmScope: tmScope$d, + languageId: languageId$d, + 'default': Markdown +}); + +var require$$0$5 = getCjsExportFromNamespace(Markdown$1); + +const languages$4 = [createLanguage(require$$0$5, data => ({ + since: "1.8.0", + parsers: ["markdown"], + vscodeLanguageIds: ["markdown"], + filenames: data.filenames.concat(["README"]), + extensions: data.extensions.filter(extension => extension !== ".mdx") +})), createLanguage(require$$0$5, () => ({ + name: "MDX", + since: "1.15.0", + parsers: ["mdx"], + vscodeLanguageIds: ["mdx"], + filenames: [], + extensions: [".mdx"] +}))]; +const printers$4 = { + mdast: printerMarkdown +}; +var languageMarkdown = { + languages: languages$4, + options: options$5, + printers: printers$4 +}; + +var clean$6 = function (ast, newNode) { + delete newNode.sourceSpan; + delete newNode.startSourceSpan; + delete newNode.endSourceSpan; + delete newNode.nameSpan; + delete newNode.valueSpan; + + if (ast.type === "text" || ast.type === "comment") { + return null; + } // may be formatted by multiparser + + + if (ast.type === "yaml" || ast.type === "toml") { + return null; + } + + if (ast.type === "attribute") { + delete newNode.value; + } + + if (ast.type === "docType") { + delete newNode.value; + } +}; + +var json$1 = { + "CSS_DISPLAY_TAGS": { + "area": "none", + "base": "none", + "basefont": "none", + "datalist": "none", + "head": "none", + "link": "none", + "meta": "none", + "noembed": "none", + "noframes": "none", + "param": "none", + "rp": "none", + "script": "block", + "source": "block", + "style": "none", + "template": "inline", + "track": "block", + "title": "none", + "html": "block", + "body": "block", + "address": "block", + "blockquote": "block", + "center": "block", + "div": "block", + "figure": "block", + "figcaption": "block", + "footer": "block", + "form": "block", + "header": "block", + "hr": "block", + "legend": "block", + "listing": "block", + "main": "block", + "p": "block", + "plaintext": "block", + "pre": "block", + "xmp": "block", + "slot": "contents", + "ruby": "ruby", + "rt": "ruby-text", + "article": "block", + "aside": "block", + "h1": "block", + "h2": "block", + "h3": "block", + "h4": "block", + "h5": "block", + "h6": "block", + "hgroup": "block", + "nav": "block", + "section": "block", + "dir": "block", + "dd": "block", + "dl": "block", + "dt": "block", + "ol": "block", + "ul": "block", + "li": "list-item", + "table": "table", + "caption": "table-caption", + "colgroup": "table-column-group", + "col": "table-column", + "thead": "table-header-group", + "tbody": "table-row-group", + "tfoot": "table-footer-group", + "tr": "table-row", + "td": "table-cell", + "th": "table-cell", + "fieldset": "block", + "button": "inline-block", + "video": "inline-block", + "audio": "inline-block" + }, + "CSS_DISPLAY_DEFAULT": "inline", + "CSS_WHITE_SPACE_TAGS": { + "listing": "pre", + "plaintext": "pre", + "pre": "pre", + "xmp": "pre", + "nobr": "nowrap", + "table": "initial", + "textarea": "pre-wrap" + }, + "CSS_WHITE_SPACE_DEFAULT": "normal" +}; + +var index = [ + "a", + "abbr", + "acronym", + "address", + "applet", + "area", + "article", + "aside", + "audio", + "b", + "base", + "basefont", + "bdi", + "bdo", + "bgsound", + "big", + "blink", + "blockquote", + "body", + "br", + "button", + "canvas", + "caption", + "center", + "cite", + "code", + "col", + "colgroup", + "command", + "content", + "data", + "datalist", + "dd", + "del", + "details", + "dfn", + "dialog", + "dir", + "div", + "dl", + "dt", + "element", + "em", + "embed", + "fieldset", + "figcaption", + "figure", + "font", + "footer", + "form", + "frame", + "frameset", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "head", + "header", + "hgroup", + "hr", + "html", + "i", + "iframe", + "image", + "img", + "input", + "ins", + "isindex", + "kbd", + "keygen", + "label", + "legend", + "li", + "link", + "listing", + "main", + "map", + "mark", + "marquee", + "math", + "menu", + "menuitem", + "meta", + "meter", + "multicol", + "nav", + "nextid", + "nobr", + "noembed", + "noframes", + "noscript", + "object", + "ol", + "optgroup", + "option", + "output", + "p", + "param", + "picture", + "plaintext", + "pre", + "progress", + "q", + "rb", + "rbc", + "rp", + "rt", + "rtc", + "ruby", + "s", + "samp", + "script", + "section", + "select", + "shadow", + "slot", + "small", + "source", + "spacer", + "span", + "strike", + "strong", + "style", + "sub", + "summary", + "sup", + "svg", + "table", + "tbody", + "td", + "template", + "textarea", + "tfoot", + "th", + "thead", + "time", + "title", + "tr", + "track", + "tt", + "u", + "ul", + "var", + "video", + "wbr", + "xmp" +]; + +var htmlTagNames = /*#__PURE__*/Object.freeze({ + __proto__: null, + 'default': index +}); + +var a = [ + "accesskey", + "charset", + "coords", + "download", + "href", + "hreflang", + "name", + "ping", + "referrerpolicy", + "rel", + "rev", + "shape", + "tabindex", + "target", + "type" +]; +var abbr = [ + "title" +]; +var applet = [ + "align", + "alt", + "archive", + "code", + "codebase", + "height", + "hspace", + "name", + "object", + "vspace", + "width" +]; +var area = [ + "accesskey", + "alt", + "coords", + "download", + "href", + "hreflang", + "nohref", + "ping", + "referrerpolicy", + "rel", + "shape", + "tabindex", + "target", + "type" +]; +var audio = [ + "autoplay", + "controls", + "crossorigin", + "loop", + "muted", + "preload", + "src" +]; +var base = [ + "href", + "target" +]; +var basefont = [ + "color", + "face", + "size" +]; +var bdo = [ + "dir" +]; +var blockquote = [ + "cite" +]; +var body = [ + "alink", + "background", + "bgcolor", + "link", + "text", + "vlink" +]; +var br = [ + "clear" +]; +var button = [ + "accesskey", + "autofocus", + "disabled", + "form", + "formaction", + "formenctype", + "formmethod", + "formnovalidate", + "formtarget", + "name", + "tabindex", + "type", + "value" +]; +var canvas = [ + "height", + "width" +]; +var caption = [ + "align" +]; +var col = [ + "align", + "char", + "charoff", + "span", + "valign", + "width" +]; +var colgroup = [ + "align", + "char", + "charoff", + "span", + "valign", + "width" +]; +var data$1 = [ + "value" +]; +var del$1 = [ + "cite", + "datetime" +]; +var details = [ + "open" +]; +var dfn = [ + "title" +]; +var dialog = [ + "open" +]; +var dir = [ + "compact" +]; +var div = [ + "align" +]; +var dl = [ + "compact" +]; +var embed$3 = [ + "height", + "src", + "type", + "width" +]; +var fieldset = [ + "disabled", + "form", + "name" +]; +var font = [ + "color", + "face", + "size" +]; +var form = [ + "accept", + "accept-charset", + "action", + "autocomplete", + "enctype", + "method", + "name", + "novalidate", + "target" +]; +var frame = [ + "frameborder", + "longdesc", + "marginheight", + "marginwidth", + "name", + "noresize", + "scrolling", + "src" +]; +var frameset = [ + "cols", + "rows" +]; +var h1 = [ + "align" +]; +var h2 = [ + "align" +]; +var h3 = [ + "align" +]; +var h4 = [ + "align" +]; +var h5 = [ + "align" +]; +var h6 = [ + "align" +]; +var head = [ + "profile" +]; +var hr = [ + "align", + "noshade", + "size", + "width" +]; +var html = [ + "manifest", + "version" +]; +var iframe = [ + "align", + "allow", + "allowfullscreen", + "allowpaymentrequest", + "allowusermedia", + "frameborder", + "height", + "longdesc", + "marginheight", + "marginwidth", + "name", + "referrerpolicy", + "sandbox", + "scrolling", + "src", + "srcdoc", + "width" +]; +var img = [ + "align", + "alt", + "border", + "crossorigin", + "decoding", + "height", + "hspace", + "ismap", + "longdesc", + "name", + "referrerpolicy", + "sizes", + "src", + "srcset", + "usemap", + "vspace", + "width" +]; +var input = [ + "accept", + "accesskey", + "align", + "alt", + "autocomplete", + "autofocus", + "checked", + "dirname", + "disabled", + "form", + "formaction", + "formenctype", + "formmethod", + "formnovalidate", + "formtarget", + "height", + "ismap", + "list", + "max", + "maxlength", + "min", + "minlength", + "multiple", + "name", + "pattern", + "placeholder", + "readonly", + "required", + "size", + "src", + "step", + "tabindex", + "title", + "type", + "usemap", + "value", + "width" +]; +var ins = [ + "cite", + "datetime" +]; +var isindex = [ + "prompt" +]; +var label = [ + "accesskey", + "for", + "form" +]; +var legend = [ + "accesskey", + "align" +]; +var li = [ + "type", + "value" +]; +var link$3 = [ + "as", + "charset", + "color", + "crossorigin", + "href", + "hreflang", + "imagesizes", + "imagesrcset", + "integrity", + "media", + "nonce", + "referrerpolicy", + "rel", + "rev", + "sizes", + "target", + "title", + "type" +]; +var map$1 = [ + "name" +]; +var menu = [ + "compact" +]; +var meta = [ + "charset", + "content", + "http-equiv", + "name", + "scheme" +]; +var meter = [ + "high", + "low", + "max", + "min", + "optimum", + "value" +]; +var object = [ + "align", + "archive", + "border", + "classid", + "codebase", + "codetype", + "data", + "declare", + "form", + "height", + "hspace", + "name", + "standby", + "tabindex", + "type", + "typemustmatch", + "usemap", + "vspace", + "width" +]; +var ol = [ + "compact", + "reversed", + "start", + "type" +]; +var optgroup = [ + "disabled", + "label" +]; +var option = [ + "disabled", + "label", + "selected", + "value" +]; +var output = [ + "for", + "form", + "name" +]; +var p = [ + "align" +]; +var param = [ + "name", + "type", + "value", + "valuetype" +]; +var pre = [ + "width" +]; +var progress = [ + "max", + "value" +]; +var q = [ + "cite" +]; +var script = [ + "async", + "charset", + "crossorigin", + "defer", + "integrity", + "language", + "nomodule", + "nonce", + "referrerpolicy", + "src", + "type" +]; +var select = [ + "autocomplete", + "autofocus", + "disabled", + "form", + "multiple", + "name", + "required", + "size", + "tabindex" +]; +var slot = [ + "name" +]; +var source$1 = [ + "media", + "sizes", + "src", + "srcset", + "type" +]; +var style = [ + "media", + "nonce", + "title", + "type" +]; +var table = [ + "align", + "bgcolor", + "border", + "cellpadding", + "cellspacing", + "frame", + "rules", + "summary", + "width" +]; +var tbody = [ + "align", + "char", + "charoff", + "valign" +]; +var td = [ + "abbr", + "align", + "axis", + "bgcolor", + "char", + "charoff", + "colspan", + "headers", + "height", + "nowrap", + "rowspan", + "scope", + "valign", + "width" +]; +var textarea = [ + "accesskey", + "autocomplete", + "autofocus", + "cols", + "dirname", + "disabled", + "form", + "maxlength", + "minlength", + "name", + "placeholder", + "readonly", + "required", + "rows", + "tabindex", + "wrap" +]; +var tfoot = [ + "align", + "char", + "charoff", + "valign" +]; +var th = [ + "abbr", + "align", + "axis", + "bgcolor", + "char", + "charoff", + "colspan", + "headers", + "height", + "nowrap", + "rowspan", + "scope", + "valign", + "width" +]; +var thead = [ + "align", + "char", + "charoff", + "valign" +]; +var time = [ + "datetime" +]; +var tr = [ + "align", + "bgcolor", + "char", + "charoff", + "valign" +]; +var track = [ + "default", + "kind", + "label", + "src", + "srclang" +]; +var ul = [ + "compact", + "type" +]; +var video = [ + "autoplay", + "controls", + "crossorigin", + "height", + "loop", + "muted", + "playsinline", + "poster", + "preload", + "src", + "width" +]; +var index$1 = { + "*": [ + "accesskey", + "autocapitalize", + "autofocus", + "class", + "contenteditable", + "dir", + "draggable", + "enterkeyhint", + "hidden", + "id", + "inputmode", + "is", + "itemid", + "itemprop", + "itemref", + "itemscope", + "itemtype", + "lang", + "nonce", + "slot", + "spellcheck", + "style", + "tabindex", + "title", + "translate" +], + a: a, + abbr: abbr, + applet: applet, + area: area, + audio: audio, + base: base, + basefont: basefont, + bdo: bdo, + blockquote: blockquote, + body: body, + br: br, + button: button, + canvas: canvas, + caption: caption, + col: col, + colgroup: colgroup, + data: data$1, + del: del$1, + details: details, + dfn: dfn, + dialog: dialog, + dir: dir, + div: div, + dl: dl, + embed: embed$3, + fieldset: fieldset, + font: font, + form: form, + frame: frame, + frameset: frameset, + h1: h1, + h2: h2, + h3: h3, + h4: h4, + h5: h5, + h6: h6, + head: head, + hr: hr, + html: html, + iframe: iframe, + img: img, + input: input, + ins: ins, + isindex: isindex, + label: label, + legend: legend, + li: li, + link: link$3, + map: map$1, + menu: menu, + meta: meta, + meter: meter, + object: object, + ol: ol, + optgroup: optgroup, + option: option, + output: output, + p: p, + param: param, + pre: pre, + progress: progress, + q: q, + script: script, + select: select, + slot: slot, + source: source$1, + style: style, + table: table, + tbody: tbody, + td: td, + textarea: textarea, + tfoot: tfoot, + th: th, + thead: thead, + time: time, + tr: tr, + track: track, + ul: ul, + video: video +}; + +var htmlElementAttributes = /*#__PURE__*/Object.freeze({ + __proto__: null, + a: a, + abbr: abbr, + applet: applet, + area: area, + audio: audio, + base: base, + basefont: basefont, + bdo: bdo, + blockquote: blockquote, + body: body, + br: br, + button: button, + canvas: canvas, + caption: caption, + col: col, + colgroup: colgroup, + data: data$1, + del: del$1, + details: details, + dfn: dfn, + dialog: dialog, + dir: dir, + div: div, + dl: dl, + embed: embed$3, + fieldset: fieldset, + font: font, + form: form, + frame: frame, + frameset: frameset, + h1: h1, + h2: h2, + h3: h3, + h4: h4, + h5: h5, + h6: h6, + head: head, + hr: hr, + html: html, + iframe: iframe, + img: img, + input: input, + ins: ins, + isindex: isindex, + label: label, + legend: legend, + li: li, + link: link$3, + map: map$1, + menu: menu, + meta: meta, + meter: meter, + object: object, + ol: ol, + optgroup: optgroup, + option: option, + output: output, + p: p, + param: param, + pre: pre, + progress: progress, + q: q, + script: script, + select: select, + slot: slot, + source: source$1, + style: style, + table: table, + tbody: tbody, + td: td, + textarea: textarea, + tfoot: tfoot, + th: th, + thead: thead, + time: time, + tr: tr, + track: track, + ul: ul, + video: video, + 'default': index$1 +}); + +var htmlTagNames$1 = getCjsExportFromNamespace(htmlTagNames); + +var htmlElementAttributes$1 = getCjsExportFromNamespace(htmlElementAttributes); + +const { + CSS_DISPLAY_TAGS, + CSS_DISPLAY_DEFAULT, + CSS_WHITE_SPACE_TAGS, + CSS_WHITE_SPACE_DEFAULT +} = json$1; +const HTML_TAGS = arrayToMap(htmlTagNames$1); +const HTML_ELEMENT_ATTRIBUTES = mapObject(htmlElementAttributes$1, arrayToMap); + +function arrayToMap(array) { + const map = Object.create(null); + + for (const value of array) { + map[value] = true; + } + + return map; +} + +function mapObject(object, fn) { + const newObject = Object.create(null); + + for (const key of Object.keys(object)) { + newObject[key] = fn(object[key], key); + } + + return newObject; +} + +function shouldPreserveContent(node, options) { + if (!node.endSourceSpan) { + return false; + } + + if (node.type === "element" && node.fullName === "template" && node.attrMap.lang && node.attrMap.lang !== "html") { + return true; + } // unterminated node in ie conditional comment + // e.g. + + + if (node.type === "ieConditionalComment" && node.lastChild && !node.lastChild.isSelfClosing && !node.lastChild.endSourceSpan) { + return true; + } // incomplete html in ie conditional comment + // e.g. + + + if (node.type === "ieConditionalComment" && !node.complete) { + return true; + } // top-level elements (excluding